cadvisor_unsupported.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // +build !linux,!windows
  2. /*
  3. Copyright 2015 The Kubernetes Authors.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. package cadvisor
  15. import (
  16. "errors"
  17. "github.com/google/cadvisor/events"
  18. cadvisorapi "github.com/google/cadvisor/info/v1"
  19. cadvisorapiv2 "github.com/google/cadvisor/info/v2"
  20. )
  21. type cadvisorUnsupported struct {
  22. }
  23. var _ Interface = new(cadvisorUnsupported)
  24. // New creates a new cAdvisor Interface for unsupported systems.
  25. func New(imageFsInfoProvider ImageFsInfoProvider, rootPath string, cgroupsRoots []string, usingLegacyStats bool) (Interface, error) {
  26. return &cadvisorUnsupported{}, nil
  27. }
  28. var errUnsupported = errors.New("cAdvisor is unsupported in this build")
  29. func (cu *cadvisorUnsupported) Start() error {
  30. return errUnsupported
  31. }
  32. func (cu *cadvisorUnsupported) DockerContainer(name string, req *cadvisorapi.ContainerInfoRequest) (cadvisorapi.ContainerInfo, error) {
  33. return cadvisorapi.ContainerInfo{}, errUnsupported
  34. }
  35. func (cu *cadvisorUnsupported) ContainerInfo(name string, req *cadvisorapi.ContainerInfoRequest) (*cadvisorapi.ContainerInfo, error) {
  36. return nil, errUnsupported
  37. }
  38. func (cu *cadvisorUnsupported) ContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error) {
  39. return nil, errUnsupported
  40. }
  41. func (cu *cadvisorUnsupported) SubcontainerInfo(name string, req *cadvisorapi.ContainerInfoRequest) (map[string]*cadvisorapi.ContainerInfo, error) {
  42. return nil, errUnsupported
  43. }
  44. func (cu *cadvisorUnsupported) MachineInfo() (*cadvisorapi.MachineInfo, error) {
  45. return nil, errUnsupported
  46. }
  47. func (cu *cadvisorUnsupported) VersionInfo() (*cadvisorapi.VersionInfo, error) {
  48. return nil, errUnsupported
  49. }
  50. func (cu *cadvisorUnsupported) ImagesFsInfo() (cadvisorapiv2.FsInfo, error) {
  51. return cadvisorapiv2.FsInfo{}, errUnsupported
  52. }
  53. func (cu *cadvisorUnsupported) RootFsInfo() (cadvisorapiv2.FsInfo, error) {
  54. return cadvisorapiv2.FsInfo{}, errUnsupported
  55. }
  56. func (cu *cadvisorUnsupported) WatchEvents(request *events.Request) (*events.EventChannel, error) {
  57. return nil, errUnsupported
  58. }
  59. func (cu *cadvisorUnsupported) GetDirFsInfo(path string) (cadvisorapiv2.FsInfo, error) {
  60. return cadvisorapiv2.FsInfo{}, nil
  61. }