Documentation ¶
Index ¶
- Constants
- func NewProxyController(opts armrpc_controller.Options) (armrpc_controller.Controller, error)
- type ProxyController
- func (p *ProxyController) EnqueueTrackedResourceUpdate(ctx context.Context, id resources.ID, apiVersion string) error
- func (p *ProxyController) IsTerminalResponse(resp *http.Response) bool
- func (p *ProxyController) PrepareProxyRequest(ctx context.Context, originalReq *http.Request, downstream string, ...) (*http.Request, error)
- func (p *ProxyController) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
- func (p *ProxyController) ShouldTrackRequest(httpMethod string, id resources.ID, resp *http.Response) bool
- func (p *ProxyController) UpdateTrackedResource(ctx context.Context, downstream string, id resources.ID, apiVersion string) error
Constants ¶
const ( PlanesPath = "/planes" // ProcessOperationTimeout is the timeout for processing a tracked resource in the background. ProcessOperationTimeout = 12 * time.Hour // ProcessOperationRetryAfter is the retry interval for processing a tracked resource in the background. // This is used when the tracked resource is not in a terminal state. ProcessOperationRetryAfter = 5 * time.Second // EnqueueOperationRetryCount is the number of times to retry enqueueing an async operation before giving up. EnqueueOperationRetryCount = 10 )
Variables ¶
This section is empty.
Functions ¶
func NewProxyController ¶
func NewProxyController(opts armrpc_controller.Options) (armrpc_controller.Controller, error)
Function Explanation ¶
NewProxyController creates a new ProxyPlane controller with the given options and returns it, or returns an error if the controller cannot be created.
Types ¶
type ProxyController ¶
type ProxyController struct { armrpc_controller.Operation[*datamodel.Plane, datamodel.Plane] // contains filtered or unexported fields }
ProxyController is the controller implementation to proxy requests to appropriate RP or URL.
func (*ProxyController) EnqueueTrackedResourceUpdate ¶
func (p *ProxyController) EnqueueTrackedResourceUpdate(ctx context.Context, id resources.ID, apiVersion string) error
EnqueueTrackedResourceUpdate enqueues an async operation to update the tracked resource.
func (*ProxyController) IsTerminalResponse ¶
func (p *ProxyController) IsTerminalResponse(resp *http.Response) bool
IsTerminalResponse returns true if the response is terminal.
func (*ProxyController) PrepareProxyRequest ¶
func (p *ProxyController) PrepareProxyRequest(ctx context.Context, originalReq *http.Request, downstream string, relativePath string) (*http.Request, error)
PrepareProxyRequest constructs and initializes the proxy request.
func (*ProxyController) Run ¶
func (p *ProxyController) Run(ctx context.Context, w http.ResponseWriter, req *http.Request) (armrpc_rest.Response, error)
Function Explanation ¶
Run() takes in a request object and context, looks up the plane and resource provider associated with the request, and proxies the request to the appropriate resource provider.
func (*ProxyController) ShouldTrackRequest ¶
func (p *ProxyController) ShouldTrackRequest(httpMethod string, id resources.ID, resp *http.Response) bool
ShouldTrackRequest returns true if the request should be tracked.
func (*ProxyController) UpdateTrackedResource ¶
func (p *ProxyController) UpdateTrackedResource(ctx context.Context, downstream string, id resources.ID, apiVersion string) error
UpdateTrackedResource updates the tracked resource synchronously.