k8s/io/kubernetes/pkg/api/meta.RESTMapper 示例代码

2022-03-03

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

示例1:
kubectl.go开发语言: Go项目名称: kubernetes代码行数: 103
59type OutputVersionMapper struct {
60	meta.RESTMapper
61	OutputVersion string
63
64// RESTMapping implements meta.RESTMapper by prepending the output version to the preferred version list.
65func (m OutputVersionMapper) RESTMapping(kind string, versions ...string) (*meta.RESTMapping, error) {
72type ShortcutExpander struct {
73	meta.RESTMapper
74}
75
76// VersionAndKindForResource implements meta.RESTMapper. It expands the resource first, then invokes the wrapped
77// mapper.
83// expandResourceShortcut will return the expanded version of resource
84// (something that a pkg/api/meta.RESTMapper can understand), if it is
85// indeed a shortcut. Otherwise, will return resource unmodified.
示例2:
master.go开发语言: Go项目名称: kubernetes代码行数: 593
564// api_v1beta1 returns the resources and codec for API version v1beta1.
565func (m *Master) api_v1beta1() (map[string]apiserver.RESTStorage, runtime.Codec, string, string, runtime.SelfLinker, admission.Interface, api.RequestContextMapper, meta.RESTMapper) {
566	storage := make(map[string]apiserver.RESTStorage)
573// api_v1beta2 returns the resources and codec for API version v1beta2.
574func (m *Master) api_v1beta2() (map[string]apiserver.RESTStorage, runtime.Codec, string, string, runtime.SelfLinker, admission.Interface, api.RequestContextMapper, meta.RESTMapper) {
575	storage := make(map[string]apiserver.RESTStorage)
582// api_v1beta3 returns the resources and codec for API version v1beta3.
583func (m *Master) api_v1beta3() (map[string]apiserver.RESTStorage, runtime.Codec, string, string, runtime.SelfLinker, admission.Interface, api.RequestContextMapper, meta.RESTMapper) {
584	storage := make(map[string]apiserver.RESTStorage)
示例3:
cmd_test.go开发语言: Go项目名称: kubernetes代码行数: 247
56
57func newExternalScheme() (*runtime.Scheme, meta.RESTMapper, runtime.Codec) {
58	scheme := runtime.NewScheme()
103type testFactory struct {
104	Mapper       meta.RESTMapper
105	Typer        runtime.ObjectTyper
122	return &Factory{
123		Object: func(*cobra.Command) (meta.RESTMapper, runtime.ObjectTyper) {
124			return t.Mapper, t.Typer
151	return &Factory{
152		Object: func(*cobra.Command) (meta.RESTMapper, runtime.ObjectTyper) {
153			return latest.RESTMapper, api.Scheme
示例4:
handlers.go开发语言: Go项目名称: kubernetes代码行数: 362
162// NewAttributeGetter returns an object which implements the RequestAttributeGetter interface.
163func NewRequestAttributeGetter(requestContextMapper api.RequestContextMapper, restMapper meta.RESTMapper, apiRoots ...string) RequestAttributeGetter {
164	return &requestAttributeGetter{requestContextMapper, &APIRequestInfoResolver{util.NewStringSet(apiRoots...), restMapper}}
237	APIPrefixes util.StringSet
238	RestMapper  meta.RESTMapper
239}
示例5:
latest.go开发语言: Go项目名称: kubernetes代码行数: 147
65// Kubernetes versions.
66var RESTMapper meta.RESTMapper
67
示例6:
apiserver.go开发语言: Go项目名称: kubernetes代码行数: 309
100// Note: This method is used only in tests.
101func Handle(storage map[string]RESTStorage, codec runtime.Codec, root string, version string, linker runtime.SelfLinker, admissionControl admission.Interface, contextMapper api.RequestContextMapper, mapper meta.RESTMapper) http.Handler {
102	prefix := path.Join(root, version)
124	context api.RequestContextMapper
125	mapper  meta.RESTMapper
126	// TODO: put me into a cleaner interface
134// TODO: add multitype codec serialization
135func NewAPIGroupVersion(storage map[string]RESTStorage, codec runtime.Codec, root, prefix string, linker runtime.SelfLinker, admissionControl admission.Interface, contextMapper api.RequestContextMapper, mapper meta.RESTMapper) *APIGroupVersion {
136	return &APIGroupVersion{
示例7:
fake.go开发语言: Go项目名称: ddysher代码行数: 864
181
182func newExternalScheme() (*runtime.Scheme, meta.RESTMapper, runtime.Codec) {
183	scheme := runtime.NewScheme()
230type TestFactory struct {
231	Mapper             meta.RESTMapper
232	Typer              runtime.ObjectTyper
279
280func (f *FakeFactory) Object() (meta.RESTMapper, runtime.ObjectTyper) {
281	return api.Registry.RESTMapper(), f.tf.Typer
283
284func (f *FakeFactory) UnstructuredObject() (meta.RESTMapper, runtime.ObjectTyper, error) {
285	groupResources := testDynamicResources()
472
473func (f *FakeFactory) PrintObject(cmd *cobra.Command, isLocal bool, mapper meta.RESTMapper, obj runtime.Object, out io.Writer) error {
474	return nil
示例8:
fake.go开发语言: Go项目名称: detiber代码行数: 852
169
170func newExternalScheme() (*runtime.Scheme, meta.RESTMapper, runtime.Codec) {
171	scheme := runtime.NewScheme()
218type TestFactory struct {
219	Mapper             meta.RESTMapper
220	Typer              runtime.ObjectTyper
267
268func (f *FakeFactory) Object() (meta.RESTMapper, runtime.ObjectTyper) {
269	return api.Registry.RESTMapper(), f.tf.Typer
271
272func (f *FakeFactory) UnstructuredObject() (meta.RESTMapper, runtime.ObjectTyper, error) {
273	groupResources := testDynamicResources()
460
461func (f *FakeFactory) PrintObject(cmd *cobra.Command, isLocal bool, mapper meta.RESTMapper, obj runtime.Object, out io.Writer) error {
462	return nil
示例9:
cmd.go开发语言: Go项目名称: kubernetes代码行数: 424
53	// Returns interfaces for dealing with arbitrary runtime.Objects.
54	Object func(cmd *cobra.Command) (meta.RESTMapper, runtime.ObjectTyper)
55	// Returns a client for accessing Kubernetes resources or an error.
97
98		Object: func(cmd *cobra.Command) (meta.RESTMapper, runtime.ObjectTyper) {
99			cfg, err := clientConfig.ClientConfig()
示例10:
shortcut_restmapper.go开发语言: Go项目名称: ddysher代码行数: 140
32type shortcutExpander struct {
33	RESTMapper meta.RESTMapper
34
37
38var _ meta.RESTMapper = &shortcutExpander{}
39
40func NewShortcutExpander(delegate meta.RESTMapper, client discovery.DiscoveryInterface) (shortcutExpander, error) {
41	if client == nil {
107// expandResourceShortcut will return the expanded version of resource
108// (something that a pkg/api/meta.RESTMapper can understand), if it is
109// indeed a shortcut. If no match has been found, we will match on group prefixing.

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