Documentation ¶
Index ¶
- Constants
- func AsyncResource(t *testing.T, ts *testserver.TestServer, rootScope string, put BackendFunc, ...) func(w http.ResponseWriter, r *http.Request)
- func SyncResource(t *testing.T, ts *testserver.TestServer, rootScope string) func(w http.ResponseWriter, r *http.Request)
- func TestResourceDataModelToVersioned(model *TestResourceDatamodel, version string) (v1.VersionedModelInterface, error)
- type BackendFunc
- type BackendFuncController
- type Server
- type TestResource
- type TestResourceDatamodel
- type TestResourceDatamodelProperties
- type TestResourceList
- type TestResourceProperties
Constants ¶
const Version = "2023-10-01-preview"
Variables ¶
This section is empty.
Functions ¶
func AsyncResource ¶
func AsyncResource(t *testing.T, ts *testserver.TestServer, rootScope string, put BackendFunc, delete BackendFunc) func(w http.ResponseWriter, r *http.Request)
AsyncResource creates an HTTP handler that can be used to test asynchronous resource lifecycle operations.
func SyncResource ¶
func SyncResource(t *testing.T, ts *testserver.TestServer, rootScope string) func(w http.ResponseWriter, r *http.Request)
SyncResource creates an HTTP handler that can be used to test synchronous resource lifecycle operations.
func TestResourceDataModelToVersioned ¶
func TestResourceDataModelToVersioned(model *TestResourceDatamodel, version string) (v1.VersionedModelInterface, error)
TestResourceDataModelToVersioned converts version agnostic TestResource datamodel to versioned model.
Types ¶
type BackendFunc ¶
type BackendFunc func(ctx context.Context, request *backend_ctrl.Request) (backend_ctrl.Result, error)
type BackendFuncController ¶
type BackendFuncController struct { backend_ctrl.BaseController Func BackendFunc }
func (*BackendFuncController) Run ¶
func (b *BackendFuncController) Run(ctx context.Context, request *backend_ctrl.Request) (backend_ctrl.Result, error)
type Server ¶
type Server struct { // Handler is the http.Handler implementation for the server. This can be set or updated at any time, but must be // set before processing requests. Handler http.HandlerFunc // contains filtered or unexported fields }
Server is a test resource provider implementation. This will create a server on a local port that is scoped to a single test. Use Start to create and start a new server.
func Start ¶
Starts and returns a new test resource provider implementation. The caller is responsible for assigning the Handler field. The server will be stopped automatically when the test completes.
type TestResource ¶
type TestResource struct { ID *string `json:"id"` Type *string `json:"type"` Name *string `json:"name"` Location *string `json:"location"` Tags map[string]*string Properties TestResourceProperties `json:"properties,omitempty"` }
func (*TestResource) ConvertFrom ¶
func (dst *TestResource) ConvertFrom(src v1.DataModelInterface) error
ConvertFrom converts from version-agnostic datamodel to the versioned TestResource resource.
func (*TestResource) ConvertTo ¶
func (src *TestResource) ConvertTo() (v1.DataModelInterface, error)
type TestResourceDatamodel ¶
type TestResourceDatamodel struct { v1.BaseResource Properties TestResourceDatamodelProperties `json:"properties"` }
func TestResourceDataModelFromVersioned ¶
func TestResourceDataModelFromVersioned(content []byte, version string) (*TestResourceDatamodel, error)
TestResourceDataModelFromVersioned converts versioned TestResource model to datamodel.
type TestResourceDatamodelProperties ¶
type TestResourceDatamodelProperties struct {
Message *string `json:"message,omitempty"`
}
type TestResourceList ¶
type TestResourceList struct {
Value []TestResource `json:"value"`
}