本文整理汇总了Golang中k8s/io/kubernetes/pkg/apis/storage.Resource函数的典型用法代码示例。如果您正苦于以下问题:Golang Resource函数的具体用法?Golang Resource怎么用?Golang Resource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Resource函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Get
// Get retrieves the StorageClass from the index for a given name.
func (s *storageClassLister) Get(name string) (*storage.StorageClass, error) {
key := &storage.StorageClass{ObjectMeta: api.ObjectMeta{Name: name}}
obj, exists, err := s.indexer.Get(key)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(storage.Resource("storageclass"), name)
}
return obj.(*storage.StorageClass), nil
}
开发者ID:alex-mohr,项目名称:kubernetes,代码行数:12,代码来源:storageclass.go
示例2: v1beta1Storage
func (p StorageRESTStorageProvider) v1beta1Storage(apiResourceConfigSource genericapiserver.APIResourceConfigSource, restOptionsGetter RESTOptionsGetter) map[string]rest.Storage {
version := storageapiv1beta1.SchemeGroupVersion
storage := map[string]rest.Storage{}
if apiResourceConfigSource.ResourceEnabled(version.WithResource("storageclasses")) {
storageClassStorage := storageclassetcd.NewREST(restOptionsGetter(storageapi.Resource("storageclasses")))
storage["storageclasses"] = storageClassStorage
}
return storage
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:12,代码来源:storage_storage.go
示例3: NewREST
// NewREST returns a RESTStorage object that will work against persistent volumes.
func NewREST(opts generic.RESTOptions) *REST {
prefix := "/" + opts.ResourcePrefix
newListFunc := func() runtime.Object { return &storageapi.StorageClassList{} }
storageInterface, dFunc := opts.Decorator(
opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.StorageClasses),
&storageapi.StorageClass{},
prefix,
storageclass.Strategy,
newListFunc,
storageclass.GetAttrs,
storage.NoTriggerPublisher,
)
store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &storageapi.StorageClass{} },
NewListFunc: newListFunc,
KeyRootFunc: func(ctx api.Context) string {
return prefix
},
KeyFunc: func(ctx api.Context, name string) (string, error) {
return genericregistry.NoNamespaceKeyFunc(ctx, prefix, name)
},
ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*storageapi.StorageClass).Name, nil
},
PredicateFunc: storageclass.MatchStorageClasses,
QualifiedResource: storageapi.Resource("storageclasses"),
EnableGarbageCollection: opts.EnableGarbageCollection,
DeleteCollectionWorkers: opts.DeleteCollectionWorkers,
CreateStrategy: storageclass.Strategy,
UpdateStrategy: storageclass.Strategy,
DeleteStrategy: storageclass.Strategy,
ReturnDeletedObject: true,
Storage: storageInterface,
DestroyFunc: dFunc,
}
return &REST{store}
}
开发者ID:nak3,项目名称:kubernetes,代码行数:44,代码来源:etcd.go
示例4: NewREST
// NewREST returns a RESTStorage object that will work against persistent volumes.
func NewREST(optsGetter generic.RESTOptionsGetter) *REST {
store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &storageapi.StorageClass{} },
NewListFunc: func() runtime.Object { return &storageapi.StorageClassList{} },
ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*storageapi.StorageClass).Name, nil
},
PredicateFunc: storageclass.MatchStorageClasses,
QualifiedResource: storageapi.Resource("storageclasses"),
CreateStrategy: storageclass.Strategy,
UpdateStrategy: storageclass.Strategy,
DeleteStrategy: storageclass.Strategy,
ReturnDeletedObject: true,
}
options := &generic.StoreOptions{RESTOptions: optsGetter, AttrFunc: storageclass.GetAttrs}
if err := store.CompleteWithOptions(options); err != nil {
panic(err) // TODO: Propagate error up
}
return &REST{store}
}
开发者ID:alex-mohr,项目名称:kubernetes,代码行数:23,代码来源:etcd.go
注:本文中的k8s/io/kubernetes/pkg/apis/storage.Resource函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论