negotiated_codec.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. Copyright 2016 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package serializer
  14. import (
  15. "k8s.io/apimachinery/pkg/runtime"
  16. )
  17. // TODO: We should split negotiated serializers that we can change versions on from those we can change
  18. // serialization formats on
  19. type negotiatedSerializerWrapper struct {
  20. info runtime.SerializerInfo
  21. }
  22. func NegotiatedSerializerWrapper(info runtime.SerializerInfo) runtime.NegotiatedSerializer {
  23. return &negotiatedSerializerWrapper{info}
  24. }
  25. func (n *negotiatedSerializerWrapper) SupportedMediaTypes() []runtime.SerializerInfo {
  26. return []runtime.SerializerInfo{n.info}
  27. }
  28. func (n *negotiatedSerializerWrapper) EncoderForVersion(e runtime.Encoder, _ runtime.GroupVersioner) runtime.Encoder {
  29. return e
  30. }
  31. func (n *negotiatedSerializerWrapper) DecoderToVersion(d runtime.Decoder, _gv runtime.GroupVersioner) runtime.Decoder {
  32. return d
  33. }