istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/test/framework/components/namespace/static.go (about) 1 // Copyright Istio Authors 2 // 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 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package namespace 16 17 import "strings" 18 19 var ( 20 chck Static 21 _ Instance = &chck 22 ) 23 24 // Static is a namespace that may or may not exist. It is used for configuration purposes only 25 type Static string 26 27 func (s Static) Name() string { 28 return string(s) 29 } 30 31 func (s Static) Prefix() string { 32 return string(s) 33 } 34 35 func (s Static) Labels() (map[string]string, error) { 36 panic("implement me") 37 } 38 39 func (s Static) SetLabel(key, value string) error { 40 panic("implement me") 41 } 42 43 func (s Static) RemoveLabel(key string) error { 44 panic("implement me") 45 } 46 47 func (s Static) IsAmbient() bool { 48 return strings.Contains(string(s), "ambient") 49 } 50 51 func (s Static) IsInjected() bool { 52 return !s.IsAmbient() 53 } 54 55 func (s *Static) UnmarshalJSON(bytes []byte) error { 56 *s = Static(bytes) 57 return nil 58 }