backend.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // +build kube
  2. /*
  3. Copyright 2020 Docker Compose CLI 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 kube
  15. import (
  16. "context"
  17. "github.com/docker/compose-cli/api/backend"
  18. "github.com/docker/compose-cli/api/cloud"
  19. "github.com/docker/compose-cli/api/compose"
  20. "github.com/docker/compose-cli/api/containers"
  21. "github.com/docker/compose-cli/api/context/store"
  22. "github.com/docker/compose-cli/api/resources"
  23. "github.com/docker/compose-cli/api/secrets"
  24. "github.com/docker/compose-cli/api/volumes"
  25. )
  26. const backendType = store.KubeContextType
  27. type kubeAPIService struct {
  28. composeService compose.Service
  29. }
  30. func init() {
  31. backend.Register(backendType, backendType, service, cloud.NotImplementedCloudService)
  32. }
  33. func service(ctx context.Context) (backend.Service, error) {
  34. s, err := NewComposeService(ctx)
  35. if err != nil {
  36. return nil, err
  37. }
  38. return &kubeAPIService{
  39. composeService: s,
  40. }, nil
  41. }
  42. func (s *kubeAPIService) ContainerService() containers.Service {
  43. return nil
  44. }
  45. func (s *kubeAPIService) ComposeService() compose.Service {
  46. return s.composeService
  47. }
  48. func (s *kubeAPIService) SecretsService() secrets.Service {
  49. return nil
  50. }
  51. func (s *kubeAPIService) VolumeService() volumes.Service {
  52. return nil
  53. }
  54. func (s *kubeAPIService) ResourceService() resources.Service {
  55. return nil
  56. }