Documentation ¶
Overview ¶
sdk defines the functionality for interacting with Radius as a client. This includes opening a connection to the Radius control plane for making API calls as well as client APIs.
The sdk package can be safely used from the CLI and RPs in Radius as well as external packages. This means that the sdk package CANNOT reference other packages in the Radius codebase as it will be used from basically everywhere.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientOptions ¶
func NewClientOptions(connection Connection) *arm.ClientOptions
NewClientOptions creates a new ARM client options object with the given connection's endpoint, audience, transport and removes the authorization header policy.
func TestConnection ¶
func TestConnection(ctx context.Context, connection Connection) error
TestConnection tests the provided connection to determine if the Radius API is responding. This will return ErrRadiusNotInstalled when it can be determined that Radius is not installed, and a generic error for other failure conditions.
Creating a new connection with the various New functions in this package does not call TestConnection automatically. This allows a connection to be created before Radius has been installed.
Types ¶
type Connection ¶
type Connection interface { // Client returns an http.Client for communicating with Radius. This satisfies both the // autorest.Sender interface (autorest Track1 Go SDK) and policy.Transporter interface // (autorest Track2 Go SDK). Client() *http.Client // Endpoint returns the endpoint (aka. base URL) of the Radius API. This definitely includes // the URL scheme and authority, and may include path segments. Endpoint() string }
Connection represents the configuration needed to connect to Radius. Use the functions in this package to create a connection.
func NewDirectConnection ¶
func NewDirectConnection(endpoint string) (Connection, error)
NewDirectConnection parses the given endpoint string and returns a direct connection if the endpoint uses the http or https scheme, otherwise it returns an error.
func NewKubernetesConnectionFromConfig ¶
func NewKubernetesConnectionFromConfig(config *rest.Config) (Connection, error)
NewKubernetesConnectionFromConfig creates a new Kubernetes connection from a given configuration and returns a Connection and an error if one occurs.
type ErrRadiusNotInstalled ¶
type ErrRadiusNotInstalled struct { }
ErrRadiusNotInstalled is the error reported when Radius is not installed for a connection.
func (*ErrRadiusNotInstalled) Error ¶
func (*ErrRadiusNotInstalled) Error() string
ErrRadiusNotInstalled returns an error message when a Radius installation cannot be found.
func (*ErrRadiusNotInstalled) Is ¶
func (*ErrRadiusNotInstalled) Is(other error) bool
Is checks if the given error is an instance of ErrRadiusNotInstalled.