Documentation ¶
Overview ¶
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type BeforeHTTPOperation
- type HTTPOperation
- type Hook
- type MockKubeAPIServer
- func (s *MockKubeAPIServer) AddHook(hook Hook)
- func (s *MockKubeAPIServer) AddObject(obj *unstructured.Unstructured) error
- func (s *MockKubeAPIServer) AddObjectsFromManifest(y string) error
- func (s *MockKubeAPIServer) DirectTransport() http.RoundTripper
- func (s *MockKubeAPIServer) RegisterType(gvk schema.GroupVersionKind, resource string, scope meta.RESTScope)
- func (s *MockKubeAPIServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *MockKubeAPIServer) StartServing() (net.Addr, error)
- func (s *MockKubeAPIServer) Stop() error
- type Option
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeforeHTTPOperation ¶
type BeforeHTTPOperation interface {
BeforeHTTPOperation(op *HTTPOperation)
}
BeforeHTTPOperation is implemented by hooks that want to be called before every HTTP operation
type HTTPOperation ¶
HTTPOperation contains the details of an HTTP operation
type MockKubeAPIServer ¶
type MockKubeAPIServer struct {
// contains filtered or unexported fields
}
func NewMockKubeAPIServer ¶
func NewMockKubeAPIServer(addr string, options ...Option) (*MockKubeAPIServer, error)
func (*MockKubeAPIServer) AddHook ¶
func (s *MockKubeAPIServer) AddHook(hook Hook)
func (*MockKubeAPIServer) AddObject ¶
func (s *MockKubeAPIServer) AddObject(obj *unstructured.Unstructured) error
AddObject pre-creates an object
func (*MockKubeAPIServer) AddObjectsFromManifest ¶
func (s *MockKubeAPIServer) AddObjectsFromManifest(y string) error
AddObjectsFromManifest pre-creates the objects in the manifest
func (*MockKubeAPIServer) DirectTransport ¶
func (s *MockKubeAPIServer) DirectTransport() http.RoundTripper
DirectTransport returns an http.RoundTripper that can serve requests without needing a listening socket.
func (*MockKubeAPIServer) RegisterType ¶
func (s *MockKubeAPIServer) RegisterType(gvk schema.GroupVersionKind, resource string, scope meta.RESTScope)
RegisterType registers a type with the schema for the mock kubeapiserver
func (*MockKubeAPIServer) ServeHTTP ¶
func (s *MockKubeAPIServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*MockKubeAPIServer) StartServing ¶
func (s *MockKubeAPIServer) StartServing() (net.Addr, error)
func (*MockKubeAPIServer) Stop ¶
func (s *MockKubeAPIServer) Stop() error
type Option ¶
type Option func(config *MockKubeAPIServer) error
func WithStorage ¶
WithStorage is an Option that allows specifying the storage implementation.
type Request ¶
type Request interface { Run(ctx context.Context, s *MockKubeAPIServer) error Init(w http.ResponseWriter, r *http.Request) }