k8s/io/kubernetes/pkg/api/rest.Storage 示例代码

2022-03-03

以下示例是关于golang中包含rest.Storage用法的示例代码,想了解rest.Storage的具体用法?rest.Storage怎么用?rest.Storage使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
resttest.go开发语言: Go项目名称: ddysher代码行数: 1365
43	*testing.T
44	storage             rest.Storage
45	clusterScope        bool
52
53func New(t *testing.T, storage rest.Storage, scheme *runtime.Scheme) *Tester {
54	return &Tester{
示例2:
resttest.go开发语言: Go项目名称: detiber代码行数: 1365
43	*testing.T
44	storage             rest.Storage
45	clusterScope        bool
52
53func New(t *testing.T, storage rest.Storage, scheme *runtime.Scheme) *Tester {
54	return &Tester{
示例3:
apiserver_test.go开发语言: Go项目名称: ddysher代码行数: 4113
256// uses the default settings
257func handle(storage map[string]rest.Storage) http.Handler {
258	return handleInternal(storage, admissionControl, selfLinker, nil)
261// tests with a deny admission controller
262func handleDeny(storage map[string]rest.Storage) http.Handler {
263	return handleInternal(storage, alwaysDeny{}, selfLinker, nil)
266// tests using the new namespace scope mechanism
267func handleNamespaced(storage map[string]rest.Storage) http.Handler {
268	return handleInternal(storage, admissionControl, selfLinker, nil)
271// tests using a custom self linker
272func handleLinker(storage map[string]rest.Storage, selfLinker runtime.SelfLinker) http.Handler {
273	return handleInternal(storage, admissionControl, selfLinker, nil)
275
276func handleInternal(storage map[string]rest.Storage, admissionControl admission.Interface, selfLinker runtime.SelfLinker, auditSink audit.Sink) http.Handler {
277	container := restful.NewContainer()
示例4:
installer.go开发语言: Go项目名称: ddysher代码行数: 1078
137// the group version kind supplied in the override.
138func (a *APIInstaller) getResourceKind(path string, storage rest.Storage) (schema.GroupVersionKind, error) {
139	if fqKindToRegister, ok := a.group.SubresourceGroupVersionKind[path]; ok {
192
193func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storage, ws *restful.WebService, proxyHandler http.Handler) (*metav1.APIResource, error) {
194	admit := a.group.Admit
241	connecter, isConnecter := storage.(rest.Connecter)
242	storageMeta, isMetadata := storage.(rest.StorageMetadata)
243	if !isMetadata {
962
963// defaultStorageMetadata provides default answers to rest.StorageMetadata.
964type defaultStorageMetadata struct{}
965
966// defaultStorageMetadata implements rest.StorageMetadata
967var _ rest.StorageMetadata = defaultStorageMetadata{}
示例5:
apiserver_test.go开发语言: Go项目名称: detiber代码行数: 4123
265// uses the default settings
266func handle(storage map[string]rest.Storage) http.Handler {
267	return handleInternal(storage, admissionControl, selfLinker, nil)
270// tests with a deny admission controller
271func handleDeny(storage map[string]rest.Storage) http.Handler {
272	return handleInternal(storage, alwaysDeny{}, selfLinker, nil)
275// tests using the new namespace scope mechanism
276func handleNamespaced(storage map[string]rest.Storage) http.Handler {
277	return handleInternal(storage, admissionControl, selfLinker, nil)
280// tests using a custom self linker
281func handleLinker(storage map[string]rest.Storage, selfLinker runtime.SelfLinker) http.Handler {
282	return handleInternal(storage, admissionControl, selfLinker, nil)
284
285func handleInternal(storage map[string]rest.Storage, admissionControl admission.Interface, selfLinker runtime.SelfLinker, auditSink audit.Sink) http.Handler {
286	container := restful.NewContainer()
示例6:
installer.go开发语言: Go项目名称: detiber代码行数: 1078
137// the group version kind supplied in the override.
138func (a *APIInstaller) getResourceKind(path string, storage rest.Storage) (schema.GroupVersionKind, error) {
139	if fqKindToRegister, ok := a.group.SubresourceGroupVersionKind[path]; ok {
192
193func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storage, ws *restful.WebService, proxyHandler http.Handler) (*metav1.APIResource, error) {
194	admit := a.group.Admit
241	connecter, isConnecter := storage.(rest.Connecter)
242	storageMeta, isMetadata := storage.(rest.StorageMetadata)
243	if !isMetadata {
962
963// defaultStorageMetadata provides default answers to rest.StorageMetadata.
964type defaultStorageMetadata struct{}
965
966// defaultStorageMetadata implements rest.StorageMetadata
967var _ rest.StorageMetadata = defaultStorageMetadata{}
示例7:
resttest.go开发语言: Go项目名称: abhgupta代码行数: 1458
43	*testing.T
44	storage             rest.Storage
45	clusterScope        bool
51
52func New(t *testing.T, storage rest.Storage) *Tester {
53	return &Tester{
示例8:
resttest.go开发语言: Go项目名称: amygdala代码行数: 1005
39	*testing.T
40	storage             rest.Storage
41	clusterScope        bool
46
47func New(t *testing.T, storage rest.Storage) *Tester {
48	return &Tester{
示例9:
apiserver_test.go开发语言: Go项目名称: abhgupta代码行数: 4149
266// uses the default settings
267func handle(storage map[string]rest.Storage) http.Handler {
268	return handleInternal(storage, admissionControl, selfLinker, nil)
271// tests using the new namespace scope mechanism
272func handleNamespaced(storage map[string]rest.Storage) http.Handler {
273	return handleInternal(storage, admissionControl, selfLinker, nil)
276// tests using a custom self linker
277func handleLinker(storage map[string]rest.Storage, selfLinker runtime.SelfLinker) http.Handler {
278	return handleInternal(storage, admissionControl, selfLinker, nil)
280
281func handleInternal(storage map[string]rest.Storage, admissionControl admission.Interface, selfLinker runtime.SelfLinker, auditSink audit.Sink) http.Handler {
282	container := restful.NewContainer()
678
679var _ rest.StorageMetadata = &MetadataRESTStorage{}
680
示例10:
installer.go开发语言: Go项目名称: abhgupta代码行数: 1124
145// the group version kind supplied in the override.
146func (a *APIInstaller) getResourceKind(path string, storage rest.Storage) (schema.GroupVersionKind, error) {
147	// Let the storage tell us exactly what GVK it has
195
196func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storage, ws *restful.WebService, proxyHandler http.Handler) (*metav1.APIResource, error) {
197	admit := a.group.Admit
244	connecter, isConnecter := storage.(rest.Connecter)
245	storageMeta, isMetadata := storage.(rest.StorageMetadata)
246	if !isMetadata {
1008
1009// defaultStorageMetadata provides default answers to rest.StorageMetadata.
1010type defaultStorageMetadata struct{}
1011
1012// defaultStorageMetadata implements rest.StorageMetadata
1013var _ rest.StorageMetadata = defaultStorageMetadata{}

本文地址:https://www.itbaoku.cn/snippets/415772.html