diff --git a/go.mod b/go.mod
index 54e7f779e..a6f46e077 100644
--- a/go.mod
+++ b/go.mod
@@ -11,7 +11,7 @@ require (
github.com/spf13/pflag v1.0.5
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.26.4
- k8s.io/apimachinery v0.26.4
+ k8s.io/apimachinery v0.31.2
k8s.io/apiserver v0.26.4
k8s.io/client-go v0.26.4
k8s.io/component-base v0.26.4
@@ -28,26 +28,28 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
- github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
+ github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
- github.com/go-openapi/jsonpointer v0.19.5 // indirect
- github.com/go-openapi/jsonreference v0.20.0 // indirect
- github.com/go-openapi/swag v0.19.14 // indirect
+ github.com/go-openapi/jsonpointer v0.19.6 // indirect
+ github.com/go-openapi/jsonreference v0.20.2 // indirect
+ github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
- github.com/golang/protobuf v1.5.3 // indirect
+ github.com/golang/protobuf v1.5.4 // indirect
github.com/google/cel-go v0.12.6 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
+ github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
- github.com/google/gofuzz v1.1.0 // indirect
+ github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
- github.com/google/uuid v1.1.2 // indirect
+ github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
@@ -65,6 +67,7 @@ require (
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
+ github.com/x448/float16 v0.8.4 // indirect
go.etcd.io/etcd/api/v3 v3.5.5 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
go.etcd.io/etcd/client/v3 v3.5.5 // indirect
@@ -97,12 +100,12 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.1 // indirect
- k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
- k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect
+ k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
+ k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 // indirect
- sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
- sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
- sigs.k8s.io/yaml v1.3.0 // indirect
+ sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
+ sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
+ sigs.k8s.io/yaml v1.4.0 // indirect
)
replace github.com/kubean-io/kubean-api => ./api
diff --git a/go.sum b/go.sum
index 443d64bde..c15c9fea5 100644
--- a/go.sum
+++ b/go.sum
@@ -80,8 +80,9 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@@ -107,6 +108,8 @@ github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNy
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
+github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
+github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -126,14 +129,13 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A=
github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4=
-github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
-github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
-github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
-github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA=
-github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
-github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
-github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng=
-github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
+github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
+github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
+github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
+github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
+github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
+github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
+github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
@@ -172,8 +174,8 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
-github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
-github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
+github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
@@ -182,6 +184,8 @@ github.com/google/cel-go v0.12.6 h1:kjeKudqV0OygrAqA9fX6J55S8gj+Jre2tckIm5RoG4M=
github.com/google/cel-go v0.12.6/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw=
github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54=
github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ=
+github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
+github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -192,11 +196,12 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
-github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
+github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -209,8 +214,9 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
-github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
+github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
@@ -252,13 +258,13 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
-github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
-github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@@ -275,8 +281,6 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
-github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
-github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
@@ -285,8 +289,9 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
@@ -316,6 +321,8 @@ github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
+github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
@@ -333,16 +340,22 @@ github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ai
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
-github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
-github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
+github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA=
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
+github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
+github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -714,8 +727,8 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
-gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
@@ -746,8 +759,8 @@ k8s.io/api v0.26.4 h1:qSG2PmtcD23BkYiWfoYAcak870eF/hE7NNYBYavTT94=
k8s.io/api v0.26.4/go.mod h1:WwKEXU3R1rgCZ77AYa7DFksd9/BAIKyOmRlbVxgvjCk=
k8s.io/apiextensions-apiserver v0.26.1 h1:cB8h1SRk6e/+i3NOrQgSFij1B2S0Y0wDoNl66bn8RMI=
k8s.io/apiextensions-apiserver v0.26.1/go.mod h1:AptjOSXDGuE0JICx/Em15PaoO7buLwTs0dGleIHixSM=
-k8s.io/apimachinery v0.26.4 h1:rZccKdBLg9vP6J09JD+z8Yr99Ce8gk3Lbi9TCx05Jzs=
-k8s.io/apimachinery v0.26.4/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I=
+k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw=
+k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo=
k8s.io/apiserver v0.26.4 h1:3Oq4mnJv0mzVX7BR/Nod+8KjlELf/3Ljvu9ZWDyLUoA=
k8s.io/apiserver v0.26.4/go.mod h1:yAY3O1vBM4/0OIGAGeWcdfzQvgdwJ188VirLcuSAVnw=
k8s.io/client-go v0.26.4 h1:/7P/IbGBuT73A+G97trf44NTPSNqvuBREpOfdLbHvD4=
@@ -756,10 +769,10 @@ k8s.io/component-base v0.26.4 h1:Bg2xzyXNKL3eAuiTEu3XE198d6z22ENgFgGQv2GGOUk=
k8s.io/component-base v0.26.4/go.mod h1:lTuWL1Xz/a4e80gmIC3YZG2JCO4xNwtKWHJWeJmsq20=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
-k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E=
-k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4=
-k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 h1:KTgPnR10d5zhztWptI952TNtt/4u5h3IzDXkdIMuo2Y=
-k8s.io/utils v0.0.0-20221128185143-99ec85e7a448/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
+k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=
+k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
+k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
+k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
@@ -767,10 +780,10 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 h1:PUuX1qIFv309A
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36/go.mod h1:WxjusMwXlKzfAs4p9km6XJRndVt2FROgMVCE4cdohFo=
sigs.k8s.io/controller-runtime v0.14.6 h1:oxstGVvXGNnMvY7TAESYk+lzr6S3V5VFxQ6d92KcwQA=
sigs.k8s.io/controller-runtime v0.14.6/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0=
-sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
-sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
-sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
-sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
+sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
+sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
+sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
+sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
-sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
-sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
+sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
+sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
diff --git a/vendor/github.com/fxamacker/cbor/v2/.gitignore b/vendor/github.com/fxamacker/cbor/v2/.gitignore
new file mode 100644
index 000000000..f1c181ec9
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/.gitignore
@@ -0,0 +1,12 @@
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, build with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
diff --git a/vendor/github.com/fxamacker/cbor/v2/.golangci.yml b/vendor/github.com/fxamacker/cbor/v2/.golangci.yml
new file mode 100644
index 000000000..38cb9ae10
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/.golangci.yml
@@ -0,0 +1,104 @@
+# Do not delete linter settings. Linters like gocritic can be enabled on the command line.
+
+linters-settings:
+ depguard:
+ rules:
+ prevent_unmaintained_packages:
+ list-mode: strict
+ files:
+ - $all
+ - "!$test"
+ allow:
+ - $gostd
+ - github.com/x448/float16
+ deny:
+ - pkg: io/ioutil
+ desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
+ dupl:
+ threshold: 100
+ funlen:
+ lines: 100
+ statements: 50
+ goconst:
+ ignore-tests: true
+ min-len: 2
+ min-occurrences: 3
+ gocritic:
+ enabled-tags:
+ - diagnostic
+ - experimental
+ - opinionated
+ - performance
+ - style
+ disabled-checks:
+ - commentedOutCode
+ - dupImport # https://github.com/go-critic/go-critic/issues/845
+ - ifElseChain
+ - octalLiteral
+ - paramTypeCombine
+ - whyNoLint
+ gofmt:
+ simplify: false
+ goimports:
+ local-prefixes: github.com/fxamacker/cbor
+ golint:
+ min-confidence: 0
+ govet:
+ check-shadowing: true
+ lll:
+ line-length: 140
+ maligned:
+ suggest-new: true
+ misspell:
+ locale: US
+ staticcheck:
+ checks: ["all"]
+
+linters:
+ disable-all: true
+ enable:
+ - asciicheck
+ - bidichk
+ - depguard
+ - errcheck
+ - exportloopref
+ - goconst
+ - gocritic
+ - gocyclo
+ - gofmt
+ - goimports
+ - goprintffuncname
+ - gosec
+ - gosimple
+ - govet
+ - ineffassign
+ - misspell
+ - nilerr
+ - revive
+ - staticcheck
+ - stylecheck
+ - typecheck
+ - unconvert
+ - unused
+
+issues:
+ # max-issues-per-linter default is 50. Set to 0 to disable limit.
+ max-issues-per-linter: 0
+ # max-same-issues default is 3. Set to 0 to disable limit.
+ max-same-issues: 0
+
+ exclude-rules:
+ - path: decode.go
+ text: "string ` overflows ` has (\\d+) occurrences, make it a constant"
+ - path: decode.go
+ text: "string ` \\(range is \\[` has (\\d+) occurrences, make it a constant"
+ - path: decode.go
+ text: "string `, ` has (\\d+) occurrences, make it a constant"
+ - path: decode.go
+ text: "string ` overflows Go's int64` has (\\d+) occurrences, make it a constant"
+ - path: decode.go
+ text: "string `\\]\\)` has (\\d+) occurrences, make it a constant"
+ - path: valid.go
+ text: "string ` for type ` has (\\d+) occurrences, make it a constant"
+ - path: valid.go
+ text: "string `cbor: ` has (\\d+) occurrences, make it a constant"
diff --git a/vendor/github.com/fxamacker/cbor/v2/CODE_OF_CONDUCT.md b/vendor/github.com/fxamacker/cbor/v2/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..c794b2b0c
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/CODE_OF_CONDUCT.md
@@ -0,0 +1,133 @@
+
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, caste, color, religion, or sexual
+identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the overall
+ community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or advances of
+ any kind
+* Trolling, insulting or derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email address,
+ without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+faye.github@gmail.com.
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series of
+actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interactions in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or permanent
+ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within the
+community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.1, available at
+[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
+
+Community Impact Guidelines were inspired by
+[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
+
+For answers to common questions about this code of conduct, see the FAQ at
+[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
+[https://www.contributor-covenant.org/translations][translations].
+
+[homepage]: https://www.contributor-covenant.org
+[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
+[Mozilla CoC]: https://github.com/mozilla/diversity
+[FAQ]: https://www.contributor-covenant.org/faq
+[translations]: https://www.contributor-covenant.org/translations
diff --git a/vendor/github.com/fxamacker/cbor/v2/CONTRIBUTING.md b/vendor/github.com/fxamacker/cbor/v2/CONTRIBUTING.md
new file mode 100644
index 000000000..de0965e12
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/CONTRIBUTING.md
@@ -0,0 +1,41 @@
+# How to contribute
+
+You can contribute by using the library, opening issues, or opening pull requests.
+
+## Bug reports and security vulnerabilities
+
+Most issues are tracked publicly on [GitHub](https://github.com/fxamacker/cbor/issues).
+
+To report security vulnerabilities, please email faye.github@gmail.com and allow time for the problem to be resolved before disclosing it to the public. For more info, see [Security Policy](https://github.com/fxamacker/cbor#security-policy).
+
+Please do not send data that might contain personally identifiable information, even if you think you have permission. That type of support requires payment and a signed contract where I'm indemnified, held harmless, and defended by you for any data you send to me.
+
+## Pull requests
+
+Please [create an issue](https://github.com/fxamacker/cbor/issues/new/choose) before you begin work on a PR. The improvement may have already been considered, etc.
+
+Pull requests have signing requirements and must not be anonymous. Exceptions are usually made for docs and CI scripts.
+
+See the [Pull Request Template](https://github.com/fxamacker/cbor/blob/master/.github/pull_request_template.md) for details.
+
+Pull requests have a greater chance of being approved if:
+- it does not reduce speed, increase memory use, reduce security, etc. for people not using the new option or feature.
+- it has > 97% code coverage.
+
+## Describe your issue
+
+Clearly describe the issue:
+* If it's a bug, please provide: **version of this library** and **Go** (`go version`), **unmodified error message**, and describe **how to reproduce it**. Also state **what you expected to happen** instead of the error.
+* If you propose a change or addition, try to give an example how the improved code could look like or how to use it.
+* If you found a compilation error, please confirm you're using a supported version of Go. If you are, then provide the output of `go version` first, followed by the complete error message.
+
+## Please don't
+
+Please don't send data containing personally identifiable information, even if you think you have permission. That type of support requires payment and a contract where I'm indemnified, held harmless, and defended for any data you send to me.
+
+Please don't send CBOR data larger than 1024 bytes by email. If you want to send crash-producing CBOR data > 1024 bytes by email, please get my permission before sending it to me.
+
+## Credits
+
+- This guide used nlohmann/json contribution guidelines for inspiration as suggested in issue #22.
+- Special thanks to @lukseven for pointing out the contribution guidelines didn't mention signing requirements.
diff --git a/vendor/github.com/fxamacker/cbor/v2/LICENSE b/vendor/github.com/fxamacker/cbor/v2/LICENSE
new file mode 100644
index 000000000..eaa850492
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019-present Faye Amacker
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/fxamacker/cbor/v2/README.md b/vendor/github.com/fxamacker/cbor/v2/README.md
new file mode 100644
index 000000000..af0a79507
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/README.md
@@ -0,0 +1,691 @@
+# CBOR Codec in Go
+
+
+
+[fxamacker/cbor](https://github.com/fxamacker/cbor) is a library for encoding and decoding [CBOR](https://www.rfc-editor.org/info/std94) and [CBOR Sequences](https://www.rfc-editor.org/rfc/rfc8742.html).
+
+CBOR is a [trusted alternative](https://www.rfc-editor.org/rfc/rfc8949.html#name-comparison-of-other-binary-) to JSON, MessagePack, Protocol Buffers, etc. CBOR is an Internet Standard defined by [IETF STD 94 (RFC 8949)](https://www.rfc-editor.org/info/std94) and is designed to be relevant for decades.
+
+`fxamacker/cbor` is used in projects by Arm Ltd., Cisco, EdgeX Foundry, Flow Foundation, Fraunhofer‑AISEC, Kubernetes, Let's Encrypt (ISRG), Linux Foundation, Microsoft, Mozilla, Oasis Protocol, Tailscale, Teleport, [etc](https://github.com/fxamacker/cbor#who-uses-fxamackercbor).
+
+See [Quick Start](#quick-start) and [Releases](https://github.com/fxamacker/cbor/releases/). 🆕 `UnmarshalFirst` and `DiagnoseFirst` can decode CBOR Sequences. `cbor.MarshalToBuffer()` and `UserBufferEncMode` accepts user-specified buffer.
+
+## fxamacker/cbor
+
+[![](https://github.com/fxamacker/cbor/workflows/ci/badge.svg)](https://github.com/fxamacker/cbor/actions?query=workflow%3Aci)
+[![](https://github.com/fxamacker/cbor/workflows/cover%20%E2%89%A596%25/badge.svg)](https://github.com/fxamacker/cbor/actions?query=workflow%3A%22cover+%E2%89%A596%25%22)
+[![CodeQL](https://github.com/fxamacker/cbor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/fxamacker/cbor/actions/workflows/codeql-analysis.yml)
+[![](https://img.shields.io/badge/fuzzing-passing-44c010)](#fuzzing-and-code-coverage)
+[![Go Report Card](https://goreportcard.com/badge/github.com/fxamacker/cbor)](https://goreportcard.com/report/github.com/fxamacker/cbor)
+
+`fxamacker/cbor` is a CBOR codec in full conformance with [IETF STD 94 (RFC 8949)](https://www.rfc-editor.org/info/std94). It also supports CBOR Sequences ([RFC 8742](https://www.rfc-editor.org/rfc/rfc8742.html)) and Extended Diagnostic Notation ([Appendix G of RFC 8610](https://www.rfc-editor.org/rfc/rfc8610.html#appendix-G)).
+
+Features include full support for CBOR tags, [Core Deterministic Encoding](https://www.rfc-editor.org/rfc/rfc8949.html#name-core-deterministic-encoding), duplicate map key detection, etc.
+
+Design balances trade-offs between security, speed, concurrency, encoded data size, usability, etc.
+
+Highlights
+
+__🚀 Speed__
+
+Encoding and decoding is fast without using Go's `unsafe` package. Slower settings are opt-in. Default limits allow very fast and memory efficient rejection of malformed CBOR data.
+
+__🔒 Security__
+
+Decoder has configurable limits that defend against malicious inputs. Duplicate map key detection is supported. By contrast, `encoding/gob` is [not designed to be hardened against adversarial inputs](https://pkg.go.dev/encoding/gob#hdr-Security).
+
+Codec passed multiple confidential security assessments in 2022. No vulnerabilities found in subset of codec in a [nonconfidential security assessment](https://github.com/veraison/go-cose/blob/v1.0.0-rc.1/reports/NCC_Microsoft-go-cose-Report_2022-05-26_v1.0.pdf) prepared by NCC Group for Microsoft Corporation.
+
+__🗜️ Data Size__
+
+Struct tags (`toarray`, `keyasint`, `omitempty`) automatically reduce size of encoded structs. Encoding optionally shrinks float64→32→16 when values fit.
+
+__:jigsaw: Usability__
+
+API is mostly same as `encoding/json` plus interfaces that simplify concurrency for CBOR options. Encoding and decoding modes can be created at startup and reused by any goroutines.
+
+Presets include Core Deterministic Encoding, Preferred Serialization, CTAP2 Canonical CBOR, etc.
+
+__📆 Extensibility__
+
+Features include CBOR [extension points](https://www.rfc-editor.org/rfc/rfc8949.html#section-7.1) (e.g. CBOR tags) and extensive settings. API has interfaces that allow users to create custom encoding and decoding without modifying this library.
+
+
+
+
+
+### Secure Decoding with Configurable Settings
+
+`fxamacker/cbor` has configurable limits, etc. that defend against malicious CBOR data.
+
+By contrast, `encoding/gob` is [not designed to be hardened against adversarial inputs](https://pkg.go.dev/encoding/gob#hdr-Security).
+
+Example decoding with encoding/gob 💥 fatal error (out of memory)
+
+```Go
+// Example of encoding/gob having "fatal error: runtime: out of memory"
+// while decoding 181 bytes.
+package main
+import (
+ "bytes"
+ "encoding/gob"
+ "encoding/hex"
+ "fmt"
+)
+
+// Example data is from https://github.com/golang/go/issues/24446
+// (shortened to 181 bytes).
+const data = "4dffb503010102303001ff30000109010130010800010130010800010130" +
+ "01ffb80001014a01ffb60001014b01ff860001013001ff860001013001ff" +
+ "860001013001ff860001013001ffb80000001eff850401010e3030303030" +
+ "30303030303030303001ff3000010c0104000016ffb70201010830303030" +
+ "3030303001ff3000010c000030ffb6040405fcff00303030303030303030" +
+ "303030303030303030303030303030303030303030303030303030303030" +
+ "30"
+
+type X struct {
+ J *X
+ K map[string]int
+}
+
+func main() {
+ raw, _ := hex.DecodeString(data)
+ decoder := gob.NewDecoder(bytes.NewReader(raw))
+
+ var x X
+ decoder.Decode(&x) // fatal error: runtime: out of memory
+ fmt.Println("Decoding finished.")
+}
+```
+
+
+
+
+
+`fxamacker/cbor` is fast at rejecting malformed CBOR data. E.g. attempts to
+decode 10 bytes of malicious CBOR data to `[]byte` (with default settings):
+
+| Codec | Speed (ns/op) | Memory | Allocs |
+| :---- | ------------: | -----: | -----: |
+| fxamacker/cbor 2.5.0 | 44 ± 5% | 32 B/op | 2 allocs/op |
+| ugorji/go 1.2.11 | 5353261 ± 4% | 67111321 B/op | 13 allocs/op |
+
+Benchmark details
+
+Latest comparison used:
+- Input: `[]byte{0x9B, 0x00, 0x00, 0x42, 0xFA, 0x42, 0xFA, 0x42, 0xFA, 0x42}`
+- go1.19.10, linux/amd64, i5-13600K (disabled all e-cores, DDR4 @2933)
+- go test -bench=. -benchmem -count=20
+
+#### Prior comparisons
+
+| Codec | Speed (ns/op) | Memory | Allocs |
+| :---- | ------------: | -----: | -----: |
+| fxamacker/cbor 2.5.0-beta2 | 44.33 ± 2% | 32 B/op | 2 allocs/op |
+| fxamacker/cbor 0.1.0 - 2.4.0 | ~44.68 ± 6% | 32 B/op | 2 allocs/op |
+| ugorji/go 1.2.10 | 5524792.50 ± 3% | 67110491 B/op | 12 allocs/op |
+| ugorji/go 1.1.0 - 1.2.6 | 💥 runtime: | out of memory: | cannot allocate |
+
+- Input: `[]byte{0x9B, 0x00, 0x00, 0x42, 0xFA, 0x42, 0xFA, 0x42, 0xFA, 0x42}`
+- go1.19.6, linux/amd64, i5-13600K (DDR4)
+- go test -bench=. -benchmem -count=20
+
+
+
+
+
+### Smaller Encodings with Struct Tags
+
+Struct tags (`toarray`, `keyasint`, `omitempty`) reduce encoded size of structs.
+
+Example encoding 3-level nested Go struct to 1 byte CBOR
+
+https://go.dev/play/p/YxwvfPdFQG2
+
+```Go
+// Example encoding nested struct (with omitempty tag)
+// - encoding/json: 18 byte JSON
+// - fxamacker/cbor: 1 byte CBOR
+package main
+
+import (
+ "encoding/hex"
+ "encoding/json"
+ "fmt"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+type GrandChild struct {
+ Quux int `json:",omitempty"`
+}
+
+type Child struct {
+ Baz int `json:",omitempty"`
+ Qux GrandChild `json:",omitempty"`
+}
+
+type Parent struct {
+ Foo Child `json:",omitempty"`
+ Bar int `json:",omitempty"`
+}
+
+func cb() {
+ results, _ := cbor.Marshal(Parent{})
+ fmt.Println("hex(CBOR): " + hex.EncodeToString(results))
+
+ text, _ := cbor.Diagnose(results) // Diagnostic Notation
+ fmt.Println("DN: " + text)
+}
+
+func js() {
+ results, _ := json.Marshal(Parent{})
+ fmt.Println("hex(JSON): " + hex.EncodeToString(results))
+
+ text := string(results) // JSON
+ fmt.Println("JSON: " + text)
+}
+
+func main() {
+ cb()
+ fmt.Println("-------------")
+ js()
+}
+```
+
+Output (DN is Diagnostic Notation):
+```
+hex(CBOR): a0
+DN: {}
+-------------
+hex(JSON): 7b22466f6f223a7b22517578223a7b7d7d7d
+JSON: {"Foo":{"Qux":{}}}
+```
+
+
+
+
+
+Example using different struct tags together:
+
+![alt text](https://github.com/fxamacker/images/raw/master/cbor/v2.3.0/cbor_struct_tags_api.svg?sanitize=1 "CBOR API and Go Struct Tags")
+
+API is mostly same as `encoding/json`, plus interfaces that simplify concurrency for CBOR options.
+
+## Quick Start
+
+__Install__: `go get github.com/fxamacker/cbor/v2` and `import "github.com/fxamacker/cbor/v2"`.
+
+### Key Points
+
+This library can encode and decode CBOR (RFC 8949) and CBOR Sequences (RFC 8742).
+
+- __CBOR data item__ is a single piece of CBOR data and its structure may contain 0 or more nested data items.
+- __CBOR sequence__ is a concatenation of 0 or more encoded CBOR data items.
+
+Configurable limits and options can be used to balance trade-offs.
+
+- Encoding and decoding modes are created from options (settings).
+- Modes can be created at startup and reused.
+- Modes are safe for concurrent use.
+
+### Default Mode
+
+Package level functions only use this library's default settings.
+They provide the "default mode" of encoding and decoding.
+
+```go
+// API matches encoding/json for Marshal, Unmarshal, Encode, Decode, etc.
+b, err = cbor.Marshal(v) // encode v to []byte b
+err = cbor.Unmarshal(b, &v) // decode []byte b to v
+decoder = cbor.NewDecoder(r) // create decoder with io.Reader r
+err = decoder.Decode(&v) // decode a CBOR data item to v
+
+// v2.7.0 added MarshalToBuffer() and UserBufferEncMode interface.
+err = cbor.MarshalToBuffer(v, b) // encode v to b instead of using built-in buf pool.
+
+// v2.5.0 added new functions that return remaining bytes.
+
+// UnmarshalFirst decodes first CBOR data item and returns remaining bytes.
+rest, err = cbor.UnmarshalFirst(b, &v) // decode []byte b to v
+
+// DiagnoseFirst translates first CBOR data item to text and returns remaining bytes.
+text, rest, err = cbor.DiagnoseFirst(b) // decode []byte b to Diagnostic Notation text
+
+// NOTE: Unmarshal returns ExtraneousDataError if there are remaining bytes,
+// but new funcs UnmarshalFirst and DiagnoseFirst do not.
+```
+
+__IMPORTANT__: 👉 CBOR settings allow trade-offs between speed, security, encoding size, etc.
+
+- Different CBOR libraries may use different default settings.
+- CBOR-based formats or protocols usually require specific settings.
+
+For example, WebAuthn uses "CTAP2 Canonical CBOR" which is available as a preset.
+
+### Presets
+
+Presets can be used as-is or as a starting point for custom settings.
+
+```go
+// EncOptions is a struct of encoder settings.
+func CoreDetEncOptions() EncOptions // RFC 8949 Core Deterministic Encoding
+func PreferredUnsortedEncOptions() EncOptions // RFC 8949 Preferred Serialization
+func CanonicalEncOptions() EncOptions // RFC 7049 Canonical CBOR
+func CTAP2EncOptions() EncOptions // FIDO2 CTAP2 Canonical CBOR
+```
+
+Presets are used to create custom modes.
+
+### Custom Modes
+
+Modes are created from settings. Once created, modes have immutable settings.
+
+💡 Create the mode at startup and reuse it. It is safe for concurrent use.
+
+```Go
+// Create encoding mode.
+opts := cbor.CoreDetEncOptions() // use preset options as a starting point
+opts.Time = cbor.TimeUnix // change any settings if needed
+em, err := opts.EncMode() // create an immutable encoding mode
+
+// Reuse the encoding mode. It is safe for concurrent use.
+
+// API matches encoding/json.
+b, err := em.Marshal(v) // encode v to []byte b
+encoder := em.NewEncoder(w) // create encoder with io.Writer w
+err := encoder.Encode(v) // encode v to io.Writer w
+```
+
+Default mode and custom modes automatically apply struct tags.
+
+### User Specified Buffer for Encoding (v2.7.0)
+
+`UserBufferEncMode` interface extends `EncMode` interface to add `MarshalToBuffer()`. It accepts a user-specified buffer instead of using built-in buffer pool.
+
+```Go
+em, err := myEncOptions.UserBufferEncMode() // create UserBufferEncMode mode
+
+var buf bytes.Buffer
+err = em.MarshalToBuffer(v, &buf) // encode v to provided buf
+```
+
+### Struct Tags
+
+Struct tags (`toarray`, `keyasint`, `omitempty`) reduce encoded size of structs.
+
+Example encoding 3-level nested Go struct to 1 byte CBOR
+
+https://go.dev/play/p/YxwvfPdFQG2
+
+```Go
+// Example encoding nested struct (with omitempty tag)
+// - encoding/json: 18 byte JSON
+// - fxamacker/cbor: 1 byte CBOR
+package main
+
+import (
+ "encoding/hex"
+ "encoding/json"
+ "fmt"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+type GrandChild struct {
+ Quux int `json:",omitempty"`
+}
+
+type Child struct {
+ Baz int `json:",omitempty"`
+ Qux GrandChild `json:",omitempty"`
+}
+
+type Parent struct {
+ Foo Child `json:",omitempty"`
+ Bar int `json:",omitempty"`
+}
+
+func cb() {
+ results, _ := cbor.Marshal(Parent{})
+ fmt.Println("hex(CBOR): " + hex.EncodeToString(results))
+
+ text, _ := cbor.Diagnose(results) // Diagnostic Notation
+ fmt.Println("DN: " + text)
+}
+
+func js() {
+ results, _ := json.Marshal(Parent{})
+ fmt.Println("hex(JSON): " + hex.EncodeToString(results))
+
+ text := string(results) // JSON
+ fmt.Println("JSON: " + text)
+}
+
+func main() {
+ cb()
+ fmt.Println("-------------")
+ js()
+}
+```
+
+Output (DN is Diagnostic Notation):
+```
+hex(CBOR): a0
+DN: {}
+-------------
+hex(JSON): 7b22466f6f223a7b22517578223a7b7d7d7d
+JSON: {"Foo":{"Qux":{}}}
+```
+
+
+
+
+
+Example using several struct tags
+
+![alt text](https://github.com/fxamacker/images/raw/master/cbor/v2.3.0/cbor_struct_tags_api.svg?sanitize=1 "CBOR API and Go Struct Tags")
+
+
+
+Struct tags simplify use of CBOR-based protocols that require CBOR arrays or maps with integer keys.
+
+### CBOR Tags
+
+CBOR tags are specified in a `TagSet`.
+
+Custom modes can be created with a `TagSet` to handle CBOR tags.
+
+```go
+em, err := opts.EncMode() // no CBOR tags
+em, err := opts.EncModeWithTags(ts) // immutable CBOR tags
+em, err := opts.EncModeWithSharedTags(ts) // mutable shared CBOR tags
+```
+
+`TagSet` and modes using it are safe for concurrent use. Equivalent API is available for `DecMode`.
+
+Example using TagSet and TagOptions
+
+```go
+// Use signedCWT struct defined in "Decoding CWT" example.
+
+// Create TagSet (safe for concurrency).
+tags := cbor.NewTagSet()
+// Register tag COSE_Sign1 18 with signedCWT type.
+tags.Add(
+ cbor.TagOptions{EncTag: cbor.EncTagRequired, DecTag: cbor.DecTagRequired},
+ reflect.TypeOf(signedCWT{}),
+ 18)
+
+// Create DecMode with immutable tags.
+dm, _ := cbor.DecOptions{}.DecModeWithTags(tags)
+
+// Unmarshal to signedCWT with tag support.
+var v signedCWT
+if err := dm.Unmarshal(data, &v); err != nil {
+ return err
+}
+
+// Create EncMode with immutable tags.
+em, _ := cbor.EncOptions{}.EncModeWithTags(tags)
+
+// Marshal signedCWT with tag number.
+if data, err := cbor.Marshal(v); err != nil {
+ return err
+}
+```
+
+
+
+### Functions and Interfaces
+
+Functions and interfaces at a glance
+
+Common functions with same API as `encoding/json`:
+- `Marshal`, `Unmarshal`
+- `NewEncoder`, `(*Encoder).Encode`
+- `NewDecoder`, `(*Decoder).Decode`
+
+NOTE: `Unmarshal` will return `ExtraneousDataError` if there are remaining bytes
+because RFC 8949 treats CBOR data item with remaining bytes as malformed.
+- 💡 Use `UnmarshalFirst` to decode first CBOR data item and return any remaining bytes.
+
+Other useful functions:
+- `Diagnose`, `DiagnoseFirst` produce human-readable [Extended Diagnostic Notation](https://www.rfc-editor.org/rfc/rfc8610.html#appendix-G) from CBOR data.
+- `UnmarshalFirst` decodes first CBOR data item and return any remaining bytes.
+- `Wellformed` returns true if the the CBOR data item is well-formed.
+
+Interfaces identical or comparable to Go `encoding` packages include:
+`Marshaler`, `Unmarshaler`, `BinaryMarshaler`, and `BinaryUnmarshaler`.
+
+The `RawMessage` type can be used to delay CBOR decoding or precompute CBOR encoding.
+
+
+
+### Security Tips
+
+🔒 Use Go's `io.LimitReader` to limit size when decoding very large or indefinite size data.
+
+Default limits may need to be increased for systems handling very large data (e.g. blockchains).
+
+`DecOptions` can be used to modify default limits for `MaxArrayElements`, `MaxMapPairs`, and `MaxNestedLevels`.
+
+## Status
+
+v2.7.0 (June 23, 2024) adds features and improvements that help large projects (e.g. Kubernetes) use CBOR as an alternative to JSON and Protocol Buffers. Other improvements include speedups, improved memory use, bug fixes, new serialization options, etc. It passed fuzz tests (5+ billion executions) and is production quality.
+
+For more details, see [release notes](https://github.com/fxamacker/cbor/releases).
+
+### Prior Release
+
+[v2.6.0](https://github.com/fxamacker/cbor/releases/tag/v2.6.0) (February 2024) adds important new features, optimizations, and bug fixes. It is especially useful to systems that need to convert data between CBOR and JSON. New options and optimizations improve handling of bignum, integers, maps, and strings.
+
+v2.5.0 was released on Sunday, August 13, 2023 with new features and important bug fixes. It is fuzz tested and production quality after extended beta [v2.5.0-beta](https://github.com/fxamacker/cbor/releases/tag/v2.5.0-beta) (Dec 2022) -> [v2.5.0](https://github.com/fxamacker/cbor/releases/tag/v2.5.0) (Aug 2023).
+
+__IMPORTANT__: 👉 Before upgrading from v2.4 or older release, please read the notable changes highlighted in the release notes. v2.5.0 is a large release with bug fixes to error handling for extraneous data in `Unmarshal`, etc. that should be reviewed before upgrading.
+
+See [v2.5.0 release notes](https://github.com/fxamacker/cbor/releases/tag/v2.5.0) for list of new features, improvements, and bug fixes.
+
+See ["Version and API Changes"](https://github.com/fxamacker/cbor#versions-and-api-changes) section for more info about version numbering, etc.
+
+
+
+## Who uses fxamacker/cbor
+
+`fxamacker/cbor` is used in projects by Arm Ltd., Berlin Institute of Health at Charité, Chainlink, Cisco, Confidential Computing Consortium, ConsenSys, Dapper Labs, EdgeX Foundry, F5, FIDO Alliance, Fraunhofer‑AISEC, Kubernetes, Let's Encrypt (ISRG), Linux Foundation, Matrix.org, Microsoft, Mozilla, National Cybersecurity Agency of France (govt), Netherlands (govt), Oasis Protocol, Smallstep, Tailscale, Taurus SA, Teleport, TIBCO, and others.
+
+`fxamacker/cbor` passed multiple confidential security assessments. A [nonconfidential security assessment](https://github.com/veraison/go-cose/blob/v1.0.0-rc.1/reports/NCC_Microsoft-go-cose-Report_2022-05-26_v1.0.pdf) (prepared by NCC Group for Microsoft Corporation) includes a subset of fxamacker/cbor v2.4.0 in its scope.
+
+## Standards
+
+`fxamacker/cbor` is a CBOR codec in full conformance with [IETF STD 94 (RFC 8949)](https://www.rfc-editor.org/info/std94). It also supports CBOR Sequences ([RFC 8742](https://www.rfc-editor.org/rfc/rfc8742.html)) and Extended Diagnostic Notation ([Appendix G of RFC 8610](https://www.rfc-editor.org/rfc/rfc8610.html#appendix-G)).
+
+Notable CBOR features include:
+
+| CBOR Feature | Description |
+| :--- | :--- |
+| CBOR tags | API supports built-in and user-defined tags. |
+| Preferred serialization | Integers encode to fewest bytes. Optional float64 → float32 → float16. |
+| Map key sorting | Unsorted, length-first (Canonical CBOR), and bytewise-lexicographic (CTAP2). |
+| Duplicate map keys | Always forbid for encoding and option to allow/forbid for decoding. |
+| Indefinite length data | Option to allow/forbid for encoding and decoding. |
+| Well-formedness | Always checked and enforced. |
+| Basic validity checks | Optionally check UTF-8 validity and duplicate map keys. |
+| Security considerations | Prevent integer overflow and resource exhaustion (RFC 8949 Section 10). |
+
+Known limitations are noted in the [Limitations section](#limitations).
+
+Go nil values for slices, maps, pointers, etc. are encoded as CBOR null. Empty slices, maps, etc. are encoded as empty CBOR arrays and maps.
+
+Decoder checks for all required well-formedness errors, including all "subkinds" of syntax errors and too little data.
+
+After well-formedness is verified, basic validity errors are handled as follows:
+
+* Invalid UTF-8 string: Decoder has option to check and return invalid UTF-8 string error. This check is enabled by default.
+* Duplicate keys in a map: Decoder has options to ignore or enforce rejection of duplicate map keys.
+
+When decoding well-formed CBOR arrays and maps, decoder saves the first error it encounters and continues with the next item. Options to handle this differently may be added in the future.
+
+By default, decoder treats time values of floating-point NaN and Infinity as if they are CBOR Null or CBOR Undefined.
+
+__Click to expand topic:__
+
+
+ Duplicate Map Keys
+
+This library provides options for fast detection and rejection of duplicate map keys based on applying a Go-specific data model to CBOR's extended generic data model in order to determine duplicate vs distinct map keys. Detection relies on whether the CBOR map key would be a duplicate "key" when decoded and applied to the user-provided Go map or struct.
+
+`DupMapKeyQuiet` turns off detection of duplicate map keys. It tries to use a "keep fastest" method by choosing either "keep first" or "keep last" depending on the Go data type.
+
+`DupMapKeyEnforcedAPF` enforces detection and rejection of duplidate map keys. Decoding stops immediately and returns `DupMapKeyError` when the first duplicate key is detected. The error includes the duplicate map key and the index number.
+
+APF suffix means "Allow Partial Fill" so the destination map or struct can contain some decoded values at the time of error. It is the caller's responsibility to respond to the `DupMapKeyError` by discarding the partially filled result if that's required by their protocol.
+
+
+
+
+ Tag Validity
+
+This library checks tag validity for built-in tags (currently tag numbers 0, 1, 2, 3, and 55799):
+
+* Inadmissible type for tag content
+* Inadmissible value for tag content
+
+Unknown tag data items (not tag number 0, 1, 2, 3, or 55799) are handled in two ways:
+
+* When decoding into an empty interface, unknown tag data item will be decoded into `cbor.Tag` data type, which contains tag number and tag content. The tag content will be decoded into the default Go data type for the CBOR data type.
+* When decoding into other Go types, unknown tag data item is decoded into the specified Go type. If Go type is registered with a tag number, the tag number can optionally be verified.
+
+Decoder also has an option to forbid tag data items (treat any tag data item as error) which is specified by protocols such as CTAP2 Canonical CBOR.
+
+For more information, see [decoding options](#decoding-options-1) and [tag options](#tag-options).
+
+
+
+## Limitations
+
+If any of these limitations prevent you from using this library, please open an issue along with a link to your project.
+
+* CBOR `Undefined` (0xf7) value decodes to Go's `nil` value. CBOR `Null` (0xf6) more closely matches Go's `nil`.
+* CBOR map keys with data types not supported by Go for map keys are ignored and an error is returned after continuing to decode remaining items.
+* When decoding registered CBOR tag data to interface type, decoder creates a pointer to registered Go type matching CBOR tag number. Requiring a pointer for this is a Go limitation.
+
+## Fuzzing and Code Coverage
+
+__Code coverage__ is always 95% or higher (with `go test -cover`) when tagging a release.
+
+__Coverage-guided fuzzing__ must pass billions of execs using before tagging a release. Fuzzing is done using nonpublic code which may eventually get merged into this project. Until then, reports like OpenSSF Scorecard can't detect fuzz tests being used by this project.
+
+
+
+## Versions and API Changes
+This project uses [Semantic Versioning](https://semver.org), so the API is always backwards compatible unless the major version number changes.
+
+These functions have signatures identical to encoding/json and their API will continue to match `encoding/json` even after major new releases:
+`Marshal`, `Unmarshal`, `NewEncoder`, `NewDecoder`, `(*Encoder).Encode`, and `(*Decoder).Decode`.
+
+Exclusions from SemVer:
+- Newly added API documented as "subject to change".
+- Newly added API in the master branch that has never been tagged in non-beta release.
+- If function parameters are unchanged, bug fixes that change behavior (e.g. return error for edge case was missed in prior version). We try to highlight these in the release notes and add extended beta period. E.g. [v2.5.0-beta](https://github.com/fxamacker/cbor/releases/tag/v2.5.0-beta) (Dec 2022) -> [v2.5.0](https://github.com/fxamacker/cbor/releases/tag/v2.5.0) (Aug 2023).
+
+This project avoids breaking changes to behavior of encoding and decoding functions unless required to improve conformance with supported RFCs (e.g. RFC 8949, RFC 8742, etc.) Visible changes that don't improve conformance to standards are typically made available as new opt-in settings or new functions.
+
+## Code of Conduct
+
+This project has adopted the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). Contact [faye.github@gmail.com](mailto:faye.github@gmail.com) with any questions or comments.
+
+## Contributing
+
+Please open an issue before beginning work on a PR. The improvement may have already been considered, etc.
+
+For more info, see [How to Contribute](CONTRIBUTING.md).
+
+## Security Policy
+
+Security fixes are provided for the latest released version of fxamacker/cbor.
+
+For the full text of the Security Policy, see [SECURITY.md](SECURITY.md).
+
+## Acknowledgements
+
+Many thanks to all the contributors on this project!
+
+I'm especially grateful to Bastian Müller and Dieter Shirley for suggesting and collaborating on CBOR stream mode, and much more.
+
+I'm very grateful to Stefan Tatschner, Yawning Angel, Jernej Kos, x448, ZenGround0, and Jakob Borg for their contributions or support in the very early days.
+
+Big thanks to Ben Luddy for his contributions in v2.6.0 and v2.7.0.
+
+This library clearly wouldn't be possible without Carsten Bormann authoring CBOR RFCs.
+
+Special thanks to Laurence Lundblade and Jeffrey Yasskin for their help on IETF mailing list or at [7049bis](https://github.com/cbor-wg/CBORbis).
+
+Huge thanks to The Go Authors for creating a fun and practical programming language with batteries included!
+
+This library uses `x448/float16` which used to be included. As a standalone package, `x448/float16` is useful to other projects as well.
+
+## License
+
+Copyright © 2019-2024 [Faye Amacker](https://github.com/fxamacker).
+
+fxamacker/cbor is licensed under the MIT License. See [LICENSE](LICENSE) for the full license text.
+
+
diff --git a/vendor/github.com/fxamacker/cbor/v2/SECURITY.md b/vendor/github.com/fxamacker/cbor/v2/SECURITY.md
new file mode 100644
index 000000000..9c05146d1
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/SECURITY.md
@@ -0,0 +1,7 @@
+# Security Policy
+
+Security fixes are provided for the latest released version of fxamacker/cbor.
+
+If the security vulnerability is already known to the public, then you can open an issue as a bug report.
+
+To report security vulnerabilities not yet known to the public, please email faye.github@gmail.com and allow time for the problem to be resolved before reporting it to the public.
diff --git a/vendor/github.com/fxamacker/cbor/v2/bytestring.go b/vendor/github.com/fxamacker/cbor/v2/bytestring.go
new file mode 100644
index 000000000..823bff12c
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/bytestring.go
@@ -0,0 +1,63 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "errors"
+)
+
+// ByteString represents CBOR byte string (major type 2). ByteString can be used
+// when using a Go []byte is not possible or convenient. For example, Go doesn't
+// allow []byte as map key, so ByteString can be used to support data formats
+// having CBOR map with byte string keys. ByteString can also be used to
+// encode invalid UTF-8 string as CBOR byte string.
+// See DecOption.MapKeyByteStringMode for more details.
+type ByteString string
+
+// Bytes returns bytes representing ByteString.
+func (bs ByteString) Bytes() []byte {
+ return []byte(bs)
+}
+
+// MarshalCBOR encodes ByteString as CBOR byte string (major type 2).
+func (bs ByteString) MarshalCBOR() ([]byte, error) {
+ e := getEncodeBuffer()
+ defer putEncodeBuffer(e)
+
+ // Encode length
+ encodeHead(e, byte(cborTypeByteString), uint64(len(bs)))
+
+ // Encode data
+ buf := make([]byte, e.Len()+len(bs))
+ n := copy(buf, e.Bytes())
+ copy(buf[n:], bs)
+
+ return buf, nil
+}
+
+// UnmarshalCBOR decodes CBOR byte string (major type 2) to ByteString.
+// Decoding CBOR null and CBOR undefined sets ByteString to be empty.
+func (bs *ByteString) UnmarshalCBOR(data []byte) error {
+ if bs == nil {
+ return errors.New("cbor.ByteString: UnmarshalCBOR on nil pointer")
+ }
+
+ // Decoding CBOR null and CBOR undefined to ByteString resets data.
+ // This behavior is similar to decoding CBOR null and CBOR undefined to []byte.
+ if len(data) == 1 && (data[0] == 0xf6 || data[0] == 0xf7) {
+ *bs = ""
+ return nil
+ }
+
+ d := decoder{data: data, dm: defaultDecMode}
+
+ // Check if CBOR data type is byte string
+ if typ := d.nextCBORType(); typ != cborTypeByteString {
+ return &UnmarshalTypeError{CBORType: typ.String(), GoType: typeByteString.String()}
+ }
+
+ b, _ := d.parseByteString()
+ *bs = ByteString(b)
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/cache.go b/vendor/github.com/fxamacker/cbor/v2/cache.go
new file mode 100644
index 000000000..ea0f39e24
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/cache.go
@@ -0,0 +1,363 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "reflect"
+ "sort"
+ "strconv"
+ "strings"
+ "sync"
+)
+
+type encodeFuncs struct {
+ ef encodeFunc
+ ief isEmptyFunc
+}
+
+var (
+ decodingStructTypeCache sync.Map // map[reflect.Type]*decodingStructType
+ encodingStructTypeCache sync.Map // map[reflect.Type]*encodingStructType
+ encodeFuncCache sync.Map // map[reflect.Type]encodeFuncs
+ typeInfoCache sync.Map // map[reflect.Type]*typeInfo
+)
+
+type specialType int
+
+const (
+ specialTypeNone specialType = iota
+ specialTypeUnmarshalerIface
+ specialTypeEmptyIface
+ specialTypeIface
+ specialTypeTag
+ specialTypeTime
+)
+
+type typeInfo struct {
+ elemTypeInfo *typeInfo
+ keyTypeInfo *typeInfo
+ typ reflect.Type
+ kind reflect.Kind
+ nonPtrType reflect.Type
+ nonPtrKind reflect.Kind
+ spclType specialType
+}
+
+func newTypeInfo(t reflect.Type) *typeInfo {
+ tInfo := typeInfo{typ: t, kind: t.Kind()}
+
+ for t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+
+ k := t.Kind()
+
+ tInfo.nonPtrType = t
+ tInfo.nonPtrKind = k
+
+ if k == reflect.Interface {
+ if t.NumMethod() == 0 {
+ tInfo.spclType = specialTypeEmptyIface
+ } else {
+ tInfo.spclType = specialTypeIface
+ }
+ } else if t == typeTag {
+ tInfo.spclType = specialTypeTag
+ } else if t == typeTime {
+ tInfo.spclType = specialTypeTime
+ } else if reflect.PtrTo(t).Implements(typeUnmarshaler) {
+ tInfo.spclType = specialTypeUnmarshalerIface
+ }
+
+ switch k {
+ case reflect.Array, reflect.Slice:
+ tInfo.elemTypeInfo = getTypeInfo(t.Elem())
+ case reflect.Map:
+ tInfo.keyTypeInfo = getTypeInfo(t.Key())
+ tInfo.elemTypeInfo = getTypeInfo(t.Elem())
+ }
+
+ return &tInfo
+}
+
+type decodingStructType struct {
+ fields fields
+ fieldIndicesByName map[string]int
+ err error
+ toArray bool
+}
+
+// The stdlib errors.Join was introduced in Go 1.20, and we still support Go 1.17, so instead,
+// here's a very basic implementation of an aggregated error.
+type multierror []error
+
+func (m multierror) Error() string {
+ var sb strings.Builder
+ for i, err := range m {
+ sb.WriteString(err.Error())
+ if i < len(m)-1 {
+ sb.WriteString(", ")
+ }
+ }
+ return sb.String()
+}
+
+func getDecodingStructType(t reflect.Type) *decodingStructType {
+ if v, _ := decodingStructTypeCache.Load(t); v != nil {
+ return v.(*decodingStructType)
+ }
+
+ flds, structOptions := getFields(t)
+
+ toArray := hasToArrayOption(structOptions)
+
+ var errs []error
+ for i := 0; i < len(flds); i++ {
+ if flds[i].keyAsInt {
+ nameAsInt, numErr := strconv.Atoi(flds[i].name)
+ if numErr != nil {
+ errs = append(errs, errors.New("cbor: failed to parse field name \""+flds[i].name+"\" to int ("+numErr.Error()+")"))
+ break
+ }
+ flds[i].nameAsInt = int64(nameAsInt)
+ }
+
+ flds[i].typInfo = getTypeInfo(flds[i].typ)
+ }
+
+ fieldIndicesByName := make(map[string]int, len(flds))
+ for i, fld := range flds {
+ if _, ok := fieldIndicesByName[fld.name]; ok {
+ errs = append(errs, fmt.Errorf("cbor: two or more fields of %v have the same name %q", t, fld.name))
+ continue
+ }
+ fieldIndicesByName[fld.name] = i
+ }
+
+ var err error
+ {
+ var multi multierror
+ for _, each := range errs {
+ if each != nil {
+ multi = append(multi, each)
+ }
+ }
+ if len(multi) == 1 {
+ err = multi[0]
+ } else if len(multi) > 1 {
+ err = multi
+ }
+ }
+
+ structType := &decodingStructType{
+ fields: flds,
+ fieldIndicesByName: fieldIndicesByName,
+ err: err,
+ toArray: toArray,
+ }
+ decodingStructTypeCache.Store(t, structType)
+ return structType
+}
+
+type encodingStructType struct {
+ fields fields
+ bytewiseFields fields
+ lengthFirstFields fields
+ omitEmptyFieldsIdx []int
+ err error
+ toArray bool
+}
+
+func (st *encodingStructType) getFields(em *encMode) fields {
+ switch em.sort {
+ case SortNone, SortFastShuffle:
+ return st.fields
+ case SortLengthFirst:
+ return st.lengthFirstFields
+ default:
+ return st.bytewiseFields
+ }
+}
+
+type bytewiseFieldSorter struct {
+ fields fields
+}
+
+func (x *bytewiseFieldSorter) Len() int {
+ return len(x.fields)
+}
+
+func (x *bytewiseFieldSorter) Swap(i, j int) {
+ x.fields[i], x.fields[j] = x.fields[j], x.fields[i]
+}
+
+func (x *bytewiseFieldSorter) Less(i, j int) bool {
+ return bytes.Compare(x.fields[i].cborName, x.fields[j].cborName) <= 0
+}
+
+type lengthFirstFieldSorter struct {
+ fields fields
+}
+
+func (x *lengthFirstFieldSorter) Len() int {
+ return len(x.fields)
+}
+
+func (x *lengthFirstFieldSorter) Swap(i, j int) {
+ x.fields[i], x.fields[j] = x.fields[j], x.fields[i]
+}
+
+func (x *lengthFirstFieldSorter) Less(i, j int) bool {
+ if len(x.fields[i].cborName) != len(x.fields[j].cborName) {
+ return len(x.fields[i].cborName) < len(x.fields[j].cborName)
+ }
+ return bytes.Compare(x.fields[i].cborName, x.fields[j].cborName) <= 0
+}
+
+func getEncodingStructType(t reflect.Type) (*encodingStructType, error) {
+ if v, _ := encodingStructTypeCache.Load(t); v != nil {
+ structType := v.(*encodingStructType)
+ return structType, structType.err
+ }
+
+ flds, structOptions := getFields(t)
+
+ if hasToArrayOption(structOptions) {
+ return getEncodingStructToArrayType(t, flds)
+ }
+
+ var err error
+ var hasKeyAsInt bool
+ var hasKeyAsStr bool
+ var omitEmptyIdx []int
+ e := getEncodeBuffer()
+ for i := 0; i < len(flds); i++ {
+ // Get field's encodeFunc
+ flds[i].ef, flds[i].ief = getEncodeFunc(flds[i].typ)
+ if flds[i].ef == nil {
+ err = &UnsupportedTypeError{t}
+ break
+ }
+
+ // Encode field name
+ if flds[i].keyAsInt {
+ nameAsInt, numErr := strconv.Atoi(flds[i].name)
+ if numErr != nil {
+ err = errors.New("cbor: failed to parse field name \"" + flds[i].name + "\" to int (" + numErr.Error() + ")")
+ break
+ }
+ flds[i].nameAsInt = int64(nameAsInt)
+ if nameAsInt >= 0 {
+ encodeHead(e, byte(cborTypePositiveInt), uint64(nameAsInt))
+ } else {
+ n := nameAsInt*(-1) - 1
+ encodeHead(e, byte(cborTypeNegativeInt), uint64(n))
+ }
+ flds[i].cborName = make([]byte, e.Len())
+ copy(flds[i].cborName, e.Bytes())
+ e.Reset()
+
+ hasKeyAsInt = true
+ } else {
+ encodeHead(e, byte(cborTypeTextString), uint64(len(flds[i].name)))
+ flds[i].cborName = make([]byte, e.Len()+len(flds[i].name))
+ n := copy(flds[i].cborName, e.Bytes())
+ copy(flds[i].cborName[n:], flds[i].name)
+ e.Reset()
+
+ // If cborName contains a text string, then cborNameByteString contains a
+ // string that has the byte string major type but is otherwise identical to
+ // cborName.
+ flds[i].cborNameByteString = make([]byte, len(flds[i].cborName))
+ copy(flds[i].cborNameByteString, flds[i].cborName)
+ // Reset encoded CBOR type to byte string, preserving the "additional
+ // information" bits:
+ flds[i].cborNameByteString[0] = byte(cborTypeByteString) |
+ getAdditionalInformation(flds[i].cborNameByteString[0])
+
+ hasKeyAsStr = true
+ }
+
+ // Check if field can be omitted when empty
+ if flds[i].omitEmpty {
+ omitEmptyIdx = append(omitEmptyIdx, i)
+ }
+ }
+ putEncodeBuffer(e)
+
+ if err != nil {
+ structType := &encodingStructType{err: err}
+ encodingStructTypeCache.Store(t, structType)
+ return structType, structType.err
+ }
+
+ // Sort fields by canonical order
+ bytewiseFields := make(fields, len(flds))
+ copy(bytewiseFields, flds)
+ sort.Sort(&bytewiseFieldSorter{bytewiseFields})
+
+ lengthFirstFields := bytewiseFields
+ if hasKeyAsInt && hasKeyAsStr {
+ lengthFirstFields = make(fields, len(flds))
+ copy(lengthFirstFields, flds)
+ sort.Sort(&lengthFirstFieldSorter{lengthFirstFields})
+ }
+
+ structType := &encodingStructType{
+ fields: flds,
+ bytewiseFields: bytewiseFields,
+ lengthFirstFields: lengthFirstFields,
+ omitEmptyFieldsIdx: omitEmptyIdx,
+ }
+
+ encodingStructTypeCache.Store(t, structType)
+ return structType, structType.err
+}
+
+func getEncodingStructToArrayType(t reflect.Type, flds fields) (*encodingStructType, error) {
+ for i := 0; i < len(flds); i++ {
+ // Get field's encodeFunc
+ flds[i].ef, flds[i].ief = getEncodeFunc(flds[i].typ)
+ if flds[i].ef == nil {
+ structType := &encodingStructType{err: &UnsupportedTypeError{t}}
+ encodingStructTypeCache.Store(t, structType)
+ return structType, structType.err
+ }
+ }
+
+ structType := &encodingStructType{
+ fields: flds,
+ toArray: true,
+ }
+ encodingStructTypeCache.Store(t, structType)
+ return structType, structType.err
+}
+
+func getEncodeFunc(t reflect.Type) (encodeFunc, isEmptyFunc) {
+ if v, _ := encodeFuncCache.Load(t); v != nil {
+ fs := v.(encodeFuncs)
+ return fs.ef, fs.ief
+ }
+ ef, ief := getEncodeFuncInternal(t)
+ encodeFuncCache.Store(t, encodeFuncs{ef, ief})
+ return ef, ief
+}
+
+func getTypeInfo(t reflect.Type) *typeInfo {
+ if v, _ := typeInfoCache.Load(t); v != nil {
+ return v.(*typeInfo)
+ }
+ tInfo := newTypeInfo(t)
+ typeInfoCache.Store(t, tInfo)
+ return tInfo
+}
+
+func hasToArrayOption(tag string) bool {
+ s := ",toarray"
+ idx := strings.Index(tag, s)
+ return idx >= 0 && (len(tag) == idx+len(s) || tag[idx+len(s)] == ',')
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/common.go b/vendor/github.com/fxamacker/cbor/v2/common.go
new file mode 100644
index 000000000..ec038a49e
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/common.go
@@ -0,0 +1,182 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "fmt"
+ "strconv"
+)
+
+type cborType uint8
+
+const (
+ cborTypePositiveInt cborType = 0x00
+ cborTypeNegativeInt cborType = 0x20
+ cborTypeByteString cborType = 0x40
+ cborTypeTextString cborType = 0x60
+ cborTypeArray cborType = 0x80
+ cborTypeMap cborType = 0xa0
+ cborTypeTag cborType = 0xc0
+ cborTypePrimitives cborType = 0xe0
+)
+
+func (t cborType) String() string {
+ switch t {
+ case cborTypePositiveInt:
+ return "positive integer"
+ case cborTypeNegativeInt:
+ return "negative integer"
+ case cborTypeByteString:
+ return "byte string"
+ case cborTypeTextString:
+ return "UTF-8 text string"
+ case cborTypeArray:
+ return "array"
+ case cborTypeMap:
+ return "map"
+ case cborTypeTag:
+ return "tag"
+ case cborTypePrimitives:
+ return "primitives"
+ default:
+ return "Invalid type " + strconv.Itoa(int(t))
+ }
+}
+
+type additionalInformation uint8
+
+const (
+ maxAdditionalInformationWithoutArgument = 23
+ additionalInformationWith1ByteArgument = 24
+ additionalInformationWith2ByteArgument = 25
+ additionalInformationWith4ByteArgument = 26
+ additionalInformationWith8ByteArgument = 27
+
+ // For major type 7.
+ additionalInformationAsFalse = 20
+ additionalInformationAsTrue = 21
+ additionalInformationAsNull = 22
+ additionalInformationAsUndefined = 23
+ additionalInformationAsFloat16 = 25
+ additionalInformationAsFloat32 = 26
+ additionalInformationAsFloat64 = 27
+
+ // For major type 2, 3, 4, 5.
+ additionalInformationAsIndefiniteLengthFlag = 31
+)
+
+const (
+ maxSimpleValueInAdditionalInformation = 23
+ minSimpleValueIn1ByteArgument = 32
+)
+
+func (ai additionalInformation) isIndefiniteLength() bool {
+ return ai == additionalInformationAsIndefiniteLengthFlag
+}
+
+const (
+ // From RFC 8949 Section 3:
+ // "The initial byte of each encoded data item contains both information about the major type
+ // (the high-order 3 bits, described in Section 3.1) and additional information
+ // (the low-order 5 bits)."
+
+ // typeMask is used to extract major type in initial byte of encoded data item.
+ typeMask = 0xe0
+
+ // additionalInformationMask is used to extract additional information in initial byte of encoded data item.
+ additionalInformationMask = 0x1f
+)
+
+func getType(raw byte) cborType {
+ return cborType(raw & typeMask)
+}
+
+func getAdditionalInformation(raw byte) byte {
+ return raw & additionalInformationMask
+}
+
+func isBreakFlag(raw byte) bool {
+ return raw == cborBreakFlag
+}
+
+func parseInitialByte(b byte) (t cborType, ai byte) {
+ return getType(b), getAdditionalInformation(b)
+}
+
+const (
+ tagNumRFC3339Time = 0
+ tagNumEpochTime = 1
+ tagNumUnsignedBignum = 2
+ tagNumNegativeBignum = 3
+ tagNumExpectedLaterEncodingBase64URL = 21
+ tagNumExpectedLaterEncodingBase64 = 22
+ tagNumExpectedLaterEncodingBase16 = 23
+ tagNumSelfDescribedCBOR = 55799
+)
+
+const (
+ cborBreakFlag = byte(0xff)
+ cborByteStringWithIndefiniteLengthHead = byte(0x5f)
+ cborTextStringWithIndefiniteLengthHead = byte(0x7f)
+ cborArrayWithIndefiniteLengthHead = byte(0x9f)
+ cborMapWithIndefiniteLengthHead = byte(0xbf)
+)
+
+var (
+ cborFalse = []byte{0xf4}
+ cborTrue = []byte{0xf5}
+ cborNil = []byte{0xf6}
+ cborNaN = []byte{0xf9, 0x7e, 0x00}
+ cborPositiveInfinity = []byte{0xf9, 0x7c, 0x00}
+ cborNegativeInfinity = []byte{0xf9, 0xfc, 0x00}
+)
+
+// validBuiltinTag checks that supported built-in tag numbers are followed by expected content types.
+func validBuiltinTag(tagNum uint64, contentHead byte) error {
+ t := getType(contentHead)
+ switch tagNum {
+ case tagNumRFC3339Time:
+ // Tag content (date/time text string in RFC 3339 format) must be string type.
+ if t != cborTypeTextString {
+ return newInadmissibleTagContentTypeError(
+ tagNumRFC3339Time,
+ "text string",
+ t.String())
+ }
+ return nil
+
+ case tagNumEpochTime:
+ // Tag content (epoch date/time) must be uint, int, or float type.
+ if t != cborTypePositiveInt && t != cborTypeNegativeInt && (contentHead < 0xf9 || contentHead > 0xfb) {
+ return newInadmissibleTagContentTypeError(
+ tagNumEpochTime,
+ "integer or floating-point number",
+ t.String())
+ }
+ return nil
+
+ case tagNumUnsignedBignum, tagNumNegativeBignum:
+ // Tag content (bignum) must be byte type.
+ if t != cborTypeByteString {
+ return newInadmissibleTagContentTypeErrorf(
+ fmt.Sprintf(
+ "tag number %d or %d must be followed by byte string, got %s",
+ tagNumUnsignedBignum,
+ tagNumNegativeBignum,
+ t.String(),
+ ))
+ }
+ return nil
+
+ case tagNumExpectedLaterEncodingBase64URL, tagNumExpectedLaterEncodingBase64, tagNumExpectedLaterEncodingBase16:
+ // From RFC 8949 3.4.5.2:
+ // The data item tagged can be a byte string or any other data item. In the latter
+ // case, the tag applies to all of the byte string data items contained in the data
+ // item, except for those contained in a nested data item tagged with an expected
+ // conversion.
+ return nil
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/decode.go b/vendor/github.com/fxamacker/cbor/v2/decode.go
new file mode 100644
index 000000000..85842ac73
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/decode.go
@@ -0,0 +1,3187 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "encoding"
+ "encoding/base64"
+ "encoding/binary"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "math/big"
+ "reflect"
+ "strconv"
+ "strings"
+ "time"
+ "unicode/utf8"
+
+ "github.com/x448/float16"
+)
+
+// Unmarshal parses the CBOR-encoded data into the value pointed to by v
+// using default decoding options. If v is nil, not a pointer, or
+// a nil pointer, Unmarshal returns an error.
+//
+// To unmarshal CBOR into a value implementing the Unmarshaler interface,
+// Unmarshal calls that value's UnmarshalCBOR method with a valid
+// CBOR value.
+//
+// To unmarshal CBOR byte string into a value implementing the
+// encoding.BinaryUnmarshaler interface, Unmarshal calls that value's
+// UnmarshalBinary method with decoded CBOR byte string.
+//
+// To unmarshal CBOR into a pointer, Unmarshal sets the pointer to nil
+// if CBOR data is null (0xf6) or undefined (0xf7). Otherwise, Unmarshal
+// unmarshals CBOR into the value pointed to by the pointer. If the
+// pointer is nil, Unmarshal creates a new value for it to point to.
+//
+// To unmarshal CBOR into an empty interface value, Unmarshal uses the
+// following rules:
+//
+// CBOR booleans decode to bool.
+// CBOR positive integers decode to uint64.
+// CBOR negative integers decode to int64 (big.Int if value overflows).
+// CBOR floating points decode to float64.
+// CBOR byte strings decode to []byte.
+// CBOR text strings decode to string.
+// CBOR arrays decode to []interface{}.
+// CBOR maps decode to map[interface{}]interface{}.
+// CBOR null and undefined values decode to nil.
+// CBOR times (tag 0 and 1) decode to time.Time.
+// CBOR bignums (tag 2 and 3) decode to big.Int.
+// CBOR tags with an unrecognized number decode to cbor.Tag
+//
+// To unmarshal a CBOR array into a slice, Unmarshal allocates a new slice
+// if the CBOR array is empty or slice capacity is less than CBOR array length.
+// Otherwise Unmarshal overwrites existing elements, and sets slice length
+// to CBOR array length.
+//
+// To unmarshal a CBOR array into a Go array, Unmarshal decodes CBOR array
+// elements into Go array elements. If the Go array is smaller than the
+// CBOR array, the extra CBOR array elements are discarded. If the CBOR
+// array is smaller than the Go array, the extra Go array elements are
+// set to zero values.
+//
+// To unmarshal a CBOR array into a struct, struct must have a special field "_"
+// with struct tag `cbor:",toarray"`. Go array elements are decoded into struct
+// fields. Any "omitempty" struct field tag option is ignored in this case.
+//
+// To unmarshal a CBOR map into a map, Unmarshal allocates a new map only if the
+// map is nil. Otherwise Unmarshal reuses the existing map and keeps existing
+// entries. Unmarshal stores key-value pairs from the CBOR map into Go map.
+// See DecOptions.DupMapKey to enable duplicate map key detection.
+//
+// To unmarshal a CBOR map into a struct, Unmarshal matches CBOR map keys to the
+// keys in the following priority:
+//
+// 1. "cbor" key in struct field tag,
+// 2. "json" key in struct field tag,
+// 3. struct field name.
+//
+// Unmarshal tries an exact match for field name, then a case-insensitive match.
+// Map key-value pairs without corresponding struct fields are ignored. See
+// DecOptions.ExtraReturnErrors to return error at unknown field.
+//
+// To unmarshal a CBOR text string into a time.Time value, Unmarshal parses text
+// string formatted in RFC3339. To unmarshal a CBOR integer/float into a
+// time.Time value, Unmarshal creates an unix time with integer/float as seconds
+// and fractional seconds since January 1, 1970 UTC. As a special case, Infinite
+// and NaN float values decode to time.Time's zero value.
+//
+// To unmarshal CBOR null (0xf6) and undefined (0xf7) values into a
+// slice/map/pointer, Unmarshal sets Go value to nil. Because null is often
+// used to mean "not present", unmarshalling CBOR null and undefined value
+// into any other Go type has no effect and returns no error.
+//
+// Unmarshal supports CBOR tag 55799 (self-describe CBOR), tag 0 and 1 (time),
+// and tag 2 and 3 (bignum).
+//
+// Unmarshal returns ExtraneousDataError error (without decoding into v)
+// if there are any remaining bytes following the first valid CBOR data item.
+// See UnmarshalFirst, if you want to unmarshal only the first
+// CBOR data item without ExtraneousDataError caused by remaining bytes.
+func Unmarshal(data []byte, v interface{}) error {
+ return defaultDecMode.Unmarshal(data, v)
+}
+
+// UnmarshalFirst parses the first CBOR data item into the value pointed to by v
+// using default decoding options. Any remaining bytes are returned in rest.
+//
+// If v is nil, not a pointer, or a nil pointer, UnmarshalFirst returns an error.
+//
+// See the documentation for Unmarshal for details.
+func UnmarshalFirst(data []byte, v interface{}) (rest []byte, err error) {
+ return defaultDecMode.UnmarshalFirst(data, v)
+}
+
+// Valid checks whether data is a well-formed encoded CBOR data item and
+// that it complies with default restrictions such as MaxNestedLevels,
+// MaxArrayElements, MaxMapPairs, etc.
+//
+// If there are any remaining bytes after the CBOR data item,
+// an ExtraneousDataError is returned.
+//
+// WARNING: Valid doesn't check if encoded CBOR data item is valid (i.e. validity)
+// and RFC 8949 distinctly defines what is "Valid" and what is "Well-formed".
+//
+// Deprecated: Valid is kept for compatibility and should not be used.
+// Use Wellformed instead because it has a more appropriate name.
+func Valid(data []byte) error {
+ return defaultDecMode.Valid(data)
+}
+
+// Wellformed checks whether data is a well-formed encoded CBOR data item and
+// that it complies with default restrictions such as MaxNestedLevels,
+// MaxArrayElements, MaxMapPairs, etc.
+//
+// If there are any remaining bytes after the CBOR data item,
+// an ExtraneousDataError is returned.
+func Wellformed(data []byte) error {
+ return defaultDecMode.Wellformed(data)
+}
+
+// Unmarshaler is the interface implemented by types that wish to unmarshal
+// CBOR data themselves. The input is a valid CBOR value. UnmarshalCBOR
+// must copy the CBOR data if it needs to use it after returning.
+type Unmarshaler interface {
+ UnmarshalCBOR([]byte) error
+}
+
+// InvalidUnmarshalError describes an invalid argument passed to Unmarshal.
+type InvalidUnmarshalError struct {
+ s string
+}
+
+func (e *InvalidUnmarshalError) Error() string {
+ return e.s
+}
+
+// UnmarshalTypeError describes a CBOR value that can't be decoded to a Go type.
+type UnmarshalTypeError struct {
+ CBORType string // type of CBOR value
+ GoType string // type of Go value it could not be decoded into
+ StructFieldName string // name of the struct field holding the Go value (optional)
+ errorMsg string // additional error message (optional)
+}
+
+func (e *UnmarshalTypeError) Error() string {
+ var s string
+ if e.StructFieldName != "" {
+ s = "cbor: cannot unmarshal " + e.CBORType + " into Go struct field " + e.StructFieldName + " of type " + e.GoType
+ } else {
+ s = "cbor: cannot unmarshal " + e.CBORType + " into Go value of type " + e.GoType
+ }
+ if e.errorMsg != "" {
+ s += " (" + e.errorMsg + ")"
+ }
+ return s
+}
+
+// InvalidMapKeyTypeError describes invalid Go map key type when decoding CBOR map.
+// For example, Go doesn't allow slice as map key.
+type InvalidMapKeyTypeError struct {
+ GoType string
+}
+
+func (e *InvalidMapKeyTypeError) Error() string {
+ return "cbor: invalid map key type: " + e.GoType
+}
+
+// DupMapKeyError describes detected duplicate map key in CBOR map.
+type DupMapKeyError struct {
+ Key interface{}
+ Index int
+}
+
+func (e *DupMapKeyError) Error() string {
+ return fmt.Sprintf("cbor: found duplicate map key \"%v\" at map element index %d", e.Key, e.Index)
+}
+
+// UnknownFieldError describes detected unknown field in CBOR map when decoding to Go struct.
+type UnknownFieldError struct {
+ Index int
+}
+
+func (e *UnknownFieldError) Error() string {
+ return fmt.Sprintf("cbor: found unknown field at map element index %d", e.Index)
+}
+
+// UnacceptableDataItemError is returned when unmarshaling a CBOR input that contains a data item
+// that is not acceptable to a specific CBOR-based application protocol ("invalid or unexpected" as
+// described in RFC 8949 Section 5 Paragraph 3).
+type UnacceptableDataItemError struct {
+ CBORType string
+ Message string
+}
+
+func (e UnacceptableDataItemError) Error() string {
+ return fmt.Sprintf("cbor: data item of cbor type %s is not accepted by protocol: %s", e.CBORType, e.Message)
+}
+
+// ByteStringExpectedFormatError is returned when unmarshaling CBOR byte string fails when
+// using non-default ByteStringExpectedFormat decoding option that makes decoder expect
+// a specified format such as base64, hex, etc.
+type ByteStringExpectedFormatError struct {
+ expectedFormatOption ByteStringExpectedFormatMode
+ err error
+}
+
+func newByteStringExpectedFormatError(expectedFormatOption ByteStringExpectedFormatMode, err error) *ByteStringExpectedFormatError {
+ return &ByteStringExpectedFormatError{expectedFormatOption, err}
+}
+
+func (e *ByteStringExpectedFormatError) Error() string {
+ switch e.expectedFormatOption {
+ case ByteStringExpectedBase64URL:
+ return fmt.Sprintf("cbor: failed to decode base64url from byte string: %s", e.err)
+
+ case ByteStringExpectedBase64:
+ return fmt.Sprintf("cbor: failed to decode base64 from byte string: %s", e.err)
+
+ case ByteStringExpectedBase16:
+ return fmt.Sprintf("cbor: failed to decode hex from byte string: %s", e.err)
+
+ default:
+ return fmt.Sprintf("cbor: failed to decode byte string in expected format %d: %s", e.expectedFormatOption, e.err)
+ }
+}
+
+func (e *ByteStringExpectedFormatError) Unwrap() error {
+ return e.err
+}
+
+// InadmissibleTagContentTypeError is returned when unmarshaling built-in CBOR tags
+// fails because of inadmissible type for tag content. Currently, the built-in
+// CBOR tags in this codec are tags 0-3 and 21-23.
+// See "Tag validity" in RFC 8949 Section 5.3.2.
+type InadmissibleTagContentTypeError struct {
+ s string
+ tagNum int
+ expectedTagContentType string
+ gotTagContentType string
+}
+
+func newInadmissibleTagContentTypeError(
+ tagNum int,
+ expectedTagContentType string,
+ gotTagContentType string,
+) *InadmissibleTagContentTypeError {
+ return &InadmissibleTagContentTypeError{
+ tagNum: tagNum,
+ expectedTagContentType: expectedTagContentType,
+ gotTagContentType: gotTagContentType,
+ }
+}
+
+func newInadmissibleTagContentTypeErrorf(s string) *InadmissibleTagContentTypeError {
+ return &InadmissibleTagContentTypeError{s: "cbor: " + s} //nolint:goconst // ignore "cbor"
+}
+
+func (e *InadmissibleTagContentTypeError) Error() string {
+ if e.s == "" {
+ return fmt.Sprintf(
+ "cbor: tag number %d must be followed by %s, got %s",
+ e.tagNum,
+ e.expectedTagContentType,
+ e.gotTagContentType,
+ )
+ }
+ return e.s
+}
+
+// DupMapKeyMode specifies how to enforce duplicate map key. Two map keys are considered duplicates if:
+// 1. When decoding into a struct, both keys match the same struct field. The keys are also
+// considered duplicates if neither matches any field and decoding to interface{} would produce
+// equal (==) values for both keys.
+// 2. When decoding into a map, both keys are equal (==) when decoded into values of the
+// destination map's key type.
+type DupMapKeyMode int
+
+const (
+ // DupMapKeyQuiet doesn't enforce duplicate map key. Decoder quietly (no error)
+ // uses faster of "keep first" or "keep last" depending on Go data type and other factors.
+ DupMapKeyQuiet DupMapKeyMode = iota
+
+ // DupMapKeyEnforcedAPF enforces detection and rejection of duplicate map keys.
+ // APF means "Allow Partial Fill" and the destination map or struct can be partially filled.
+ // If a duplicate map key is detected, DupMapKeyError is returned without further decoding
+ // of the map. It's the caller's responsibility to respond to DupMapKeyError by
+ // discarding the partially filled result if their protocol requires it.
+ // WARNING: using DupMapKeyEnforcedAPF will decrease performance and increase memory use.
+ DupMapKeyEnforcedAPF
+
+ maxDupMapKeyMode
+)
+
+func (dmkm DupMapKeyMode) valid() bool {
+ return dmkm >= 0 && dmkm < maxDupMapKeyMode
+}
+
+// IndefLengthMode specifies whether to allow indefinite length items.
+type IndefLengthMode int
+
+const (
+ // IndefLengthAllowed allows indefinite length items.
+ IndefLengthAllowed IndefLengthMode = iota
+
+ // IndefLengthForbidden disallows indefinite length items.
+ IndefLengthForbidden
+
+ maxIndefLengthMode
+)
+
+func (m IndefLengthMode) valid() bool {
+ return m >= 0 && m < maxIndefLengthMode
+}
+
+// TagsMode specifies whether to allow CBOR tags.
+type TagsMode int
+
+const (
+ // TagsAllowed allows CBOR tags.
+ TagsAllowed TagsMode = iota
+
+ // TagsForbidden disallows CBOR tags.
+ TagsForbidden
+
+ maxTagsMode
+)
+
+func (tm TagsMode) valid() bool {
+ return tm >= 0 && tm < maxTagsMode
+}
+
+// IntDecMode specifies which Go type (int64, uint64, or big.Int) should
+// be used when decoding CBOR integers (major type 0 and 1) to Go interface{}.
+type IntDecMode int
+
+const (
+ // IntDecConvertNone affects how CBOR integers (major type 0 and 1) decode to Go interface{}.
+ // It decodes CBOR unsigned integer (major type 0) to:
+ // - uint64
+ // It decodes CBOR negative integer (major type 1) to:
+ // - int64 if value fits
+ // - big.Int or *big.Int (see BigIntDecMode) if value doesn't fit into int64
+ IntDecConvertNone IntDecMode = iota
+
+ // IntDecConvertSigned affects how CBOR integers (major type 0 and 1) decode to Go interface{}.
+ // It decodes CBOR integers (major type 0 and 1) to:
+ // - int64 if value fits
+ // - big.Int or *big.Int (see BigIntDecMode) if value < math.MinInt64
+ // - return UnmarshalTypeError if value > math.MaxInt64
+ // Deprecated: IntDecConvertSigned should not be used.
+ // Please use other options, such as IntDecConvertSignedOrError, IntDecConvertSignedOrBigInt, IntDecConvertNone.
+ IntDecConvertSigned
+
+ // IntDecConvertSignedOrFail affects how CBOR integers (major type 0 and 1) decode to Go interface{}.
+ // It decodes CBOR integers (major type 0 and 1) to:
+ // - int64 if value fits
+ // - return UnmarshalTypeError if value doesn't fit into int64
+ IntDecConvertSignedOrFail
+
+ // IntDecConvertSigned affects how CBOR integers (major type 0 and 1) decode to Go interface{}.
+ // It makes CBOR integers (major type 0 and 1) decode to:
+ // - int64 if value fits
+ // - big.Int or *big.Int (see BigIntDecMode) if value doesn't fit into int64
+ IntDecConvertSignedOrBigInt
+
+ maxIntDec
+)
+
+func (idm IntDecMode) valid() bool {
+ return idm >= 0 && idm < maxIntDec
+}
+
+// MapKeyByteStringMode specifies how to decode CBOR byte string (major type 2)
+// as Go map key when decoding CBOR map key into an empty Go interface value.
+// Specifically, this option applies when decoding CBOR map into
+// - Go empty interface, or
+// - Go map with empty interface as key type.
+// The CBOR map key types handled by this option are
+// - byte string
+// - tagged byte string
+// - nested tagged byte string
+type MapKeyByteStringMode int
+
+const (
+ // MapKeyByteStringAllowed allows CBOR byte string to be decoded as Go map key.
+ // Since Go doesn't allow []byte as map key, CBOR byte string is decoded to
+ // ByteString which has underlying string type.
+ // This is the default setting.
+ MapKeyByteStringAllowed MapKeyByteStringMode = iota
+
+ // MapKeyByteStringForbidden forbids CBOR byte string being decoded as Go map key.
+ // Attempting to decode CBOR byte string as map key into empty interface value
+ // returns a decoding error.
+ MapKeyByteStringForbidden
+
+ maxMapKeyByteStringMode
+)
+
+func (mkbsm MapKeyByteStringMode) valid() bool {
+ return mkbsm >= 0 && mkbsm < maxMapKeyByteStringMode
+}
+
+// ExtraDecErrorCond specifies extra conditions that should be treated as errors.
+type ExtraDecErrorCond uint
+
+// ExtraDecErrorNone indicates no extra error condition.
+const ExtraDecErrorNone ExtraDecErrorCond = 0
+
+const (
+ // ExtraDecErrorUnknownField indicates error condition when destination
+ // Go struct doesn't have a field matching a CBOR map key.
+ ExtraDecErrorUnknownField ExtraDecErrorCond = 1 << iota
+
+ maxExtraDecError
+)
+
+func (ec ExtraDecErrorCond) valid() bool {
+ return ec < maxExtraDecError
+}
+
+// UTF8Mode option specifies if decoder should
+// decode CBOR Text containing invalid UTF-8 string.
+type UTF8Mode int
+
+const (
+ // UTF8RejectInvalid rejects CBOR Text containing
+ // invalid UTF-8 string.
+ UTF8RejectInvalid UTF8Mode = iota
+
+ // UTF8DecodeInvalid allows decoding CBOR Text containing
+ // invalid UTF-8 string.
+ UTF8DecodeInvalid
+
+ maxUTF8Mode
+)
+
+func (um UTF8Mode) valid() bool {
+ return um >= 0 && um < maxUTF8Mode
+}
+
+// FieldNameMatchingMode specifies how string keys in CBOR maps are matched to Go struct field names.
+type FieldNameMatchingMode int
+
+const (
+ // FieldNameMatchingPreferCaseSensitive prefers to decode map items into struct fields whose names (or tag
+ // names) exactly match the item's key. If there is no such field, a map item will be decoded into a field whose
+ // name is a case-insensitive match for the item's key.
+ FieldNameMatchingPreferCaseSensitive FieldNameMatchingMode = iota
+
+ // FieldNameMatchingCaseSensitive decodes map items only into a struct field whose name (or tag name) is an
+ // exact match for the item's key.
+ FieldNameMatchingCaseSensitive
+
+ maxFieldNameMatchingMode
+)
+
+func (fnmm FieldNameMatchingMode) valid() bool {
+ return fnmm >= 0 && fnmm < maxFieldNameMatchingMode
+}
+
+// BigIntDecMode specifies how to decode CBOR bignum to Go interface{}.
+type BigIntDecMode int
+
+const (
+ // BigIntDecodeValue makes CBOR bignum decode to big.Int (instead of *big.Int)
+ // when unmarshalling into a Go interface{}.
+ BigIntDecodeValue BigIntDecMode = iota
+
+ // BigIntDecodePointer makes CBOR bignum decode to *big.Int when
+ // unmarshalling into a Go interface{}.
+ BigIntDecodePointer
+
+ maxBigIntDecMode
+)
+
+func (bidm BigIntDecMode) valid() bool {
+ return bidm >= 0 && bidm < maxBigIntDecMode
+}
+
+// ByteStringToStringMode specifies the behavior when decoding a CBOR byte string into a Go string.
+type ByteStringToStringMode int
+
+const (
+ // ByteStringToStringForbidden generates an error on an attempt to decode a CBOR byte string into a Go string.
+ ByteStringToStringForbidden ByteStringToStringMode = iota
+
+ // ByteStringToStringAllowed permits decoding a CBOR byte string into a Go string.
+ ByteStringToStringAllowed
+
+ // ByteStringToStringAllowedWithExpectedLaterEncoding permits decoding a CBOR byte string
+ // into a Go string. Also, if the byte string is enclosed (directly or indirectly) by one of
+ // the "expected later encoding" tags (numbers 21 through 23), the destination string will
+ // be populated by applying the designated text encoding to the contents of the input byte
+ // string.
+ ByteStringToStringAllowedWithExpectedLaterEncoding
+
+ maxByteStringToStringMode
+)
+
+func (bstsm ByteStringToStringMode) valid() bool {
+ return bstsm >= 0 && bstsm < maxByteStringToStringMode
+}
+
+// FieldNameByteStringMode specifies the behavior when decoding a CBOR byte string map key as a Go struct field name.
+type FieldNameByteStringMode int
+
+const (
+ // FieldNameByteStringForbidden generates an error on an attempt to decode a CBOR byte string map key as a Go struct field name.
+ FieldNameByteStringForbidden FieldNameByteStringMode = iota
+
+ // FieldNameByteStringAllowed permits CBOR byte string map keys to be recognized as Go struct field names.
+ FieldNameByteStringAllowed
+
+ maxFieldNameByteStringMode
+)
+
+func (fnbsm FieldNameByteStringMode) valid() bool {
+ return fnbsm >= 0 && fnbsm < maxFieldNameByteStringMode
+}
+
+// UnrecognizedTagToAnyMode specifies how to decode unrecognized CBOR tag into an empty interface (any).
+// Currently, recognized CBOR tag numbers are 0, 1, 2, 3, or registered by TagSet.
+type UnrecognizedTagToAnyMode int
+
+const (
+ // UnrecognizedTagNumAndContentToAny decodes CBOR tag number and tag content to cbor.Tag
+ // when decoding unrecognized CBOR tag into an empty interface.
+ UnrecognizedTagNumAndContentToAny UnrecognizedTagToAnyMode = iota
+
+ // UnrecognizedTagContentToAny decodes only CBOR tag content (into its default type)
+ // when decoding unrecognized CBOR tag into an empty interface.
+ UnrecognizedTagContentToAny
+
+ maxUnrecognizedTagToAny
+)
+
+func (uttam UnrecognizedTagToAnyMode) valid() bool {
+ return uttam >= 0 && uttam < maxUnrecognizedTagToAny
+}
+
+// TimeTagToAnyMode specifies how to decode CBOR tag 0 and 1 into an empty interface (any).
+// Based on the specified mode, Unmarshal can return a time.Time value or a time string in a specific format.
+type TimeTagToAnyMode int
+
+const (
+ // TimeTagToTime decodes CBOR tag 0 and 1 into a time.Time value
+ // when decoding tag 0 or 1 into an empty interface.
+ TimeTagToTime TimeTagToAnyMode = iota
+
+ // TimeTagToRFC3339 decodes CBOR tag 0 and 1 into a time string in RFC3339 format
+ // when decoding tag 0 or 1 into an empty interface.
+ TimeTagToRFC3339
+
+ // TimeTagToRFC3339Nano decodes CBOR tag 0 and 1 into a time string in RFC3339Nano format
+ // when decoding tag 0 or 1 into an empty interface.
+ TimeTagToRFC3339Nano
+
+ maxTimeTagToAnyMode
+)
+
+func (tttam TimeTagToAnyMode) valid() bool {
+ return tttam >= 0 && tttam < maxTimeTagToAnyMode
+}
+
+// SimpleValueRegistry is a registry of unmarshaling behaviors for each possible CBOR simple value
+// number (0...23 and 32...255).
+type SimpleValueRegistry struct {
+ rejected [256]bool
+}
+
+// WithRejectedSimpleValue registers the given simple value as rejected. If the simple value is
+// encountered in a CBOR input during unmarshaling, an UnacceptableDataItemError is returned.
+func WithRejectedSimpleValue(sv SimpleValue) func(*SimpleValueRegistry) error {
+ return func(r *SimpleValueRegistry) error {
+ if sv >= 24 && sv <= 31 {
+ return fmt.Errorf("cbor: cannot set analog for reserved simple value %d", sv)
+ }
+ r.rejected[sv] = true
+ return nil
+ }
+}
+
+// Creates a new SimpleValueRegistry. The registry state is initialized by executing the provided
+// functions in order against a registry that is pre-populated with the defaults for all well-formed
+// simple value numbers.
+func NewSimpleValueRegistryFromDefaults(fns ...func(*SimpleValueRegistry) error) (*SimpleValueRegistry, error) {
+ var r SimpleValueRegistry
+ for _, fn := range fns {
+ if err := fn(&r); err != nil {
+ return nil, err
+ }
+ }
+ return &r, nil
+}
+
+// NaNMode specifies how to decode floating-point values (major type 7, additional information 25
+// through 27) representing NaN (not-a-number).
+type NaNMode int
+
+const (
+ // NaNDecodeAllowed will decode NaN values to Go float32 or float64.
+ NaNDecodeAllowed NaNMode = iota
+
+ // NaNDecodeForbidden will return an UnacceptableDataItemError on an attempt to decode a NaN value.
+ NaNDecodeForbidden
+
+ maxNaNDecode
+)
+
+func (ndm NaNMode) valid() bool {
+ return ndm >= 0 && ndm < maxNaNDecode
+}
+
+// InfMode specifies how to decode floating-point values (major type 7, additional information 25
+// through 27) representing positive or negative infinity.
+type InfMode int
+
+const (
+ // InfDecodeAllowed will decode infinite values to Go float32 or float64.
+ InfDecodeAllowed InfMode = iota
+
+ // InfDecodeForbidden will return an UnacceptableDataItemError on an attempt to decode an
+ // infinite value.
+ InfDecodeForbidden
+
+ maxInfDecode
+)
+
+func (idm InfMode) valid() bool {
+ return idm >= 0 && idm < maxInfDecode
+}
+
+// ByteStringToTimeMode specifies the behavior when decoding a CBOR byte string into a Go time.Time.
+type ByteStringToTimeMode int
+
+const (
+ // ByteStringToTimeForbidden generates an error on an attempt to decode a CBOR byte string into a Go time.Time.
+ ByteStringToTimeForbidden ByteStringToTimeMode = iota
+
+ // ByteStringToTimeAllowed permits decoding a CBOR byte string into a Go time.Time.
+ ByteStringToTimeAllowed
+
+ maxByteStringToTimeMode
+)
+
+func (bttm ByteStringToTimeMode) valid() bool {
+ return bttm >= 0 && bttm < maxByteStringToTimeMode
+}
+
+// ByteStringExpectedFormatMode specifies how to decode CBOR byte string into Go byte slice
+// when the byte string is NOT enclosed in CBOR tag 21, 22, or 23. An error is returned if
+// the CBOR byte string does not contain the expected format (e.g. base64) specified.
+// For tags 21-23, see "Expected Later Encoding for CBOR-to-JSON Converters"
+// in RFC 8949 Section 3.4.5.2.
+type ByteStringExpectedFormatMode int
+
+const (
+ // ByteStringExpectedFormatNone copies the unmodified CBOR byte string into Go byte slice
+ // if the byte string is not tagged by CBOR tag 21-23.
+ ByteStringExpectedFormatNone ByteStringExpectedFormatMode = iota
+
+ // ByteStringExpectedBase64URL expects CBOR byte strings to contain base64url-encoded bytes
+ // if the byte string is not tagged by CBOR tag 21-23. The decoder will attempt to decode
+ // the base64url-encoded bytes into Go slice.
+ ByteStringExpectedBase64URL
+
+ // ByteStringExpectedBase64 expects CBOR byte strings to contain base64-encoded bytes
+ // if the byte string is not tagged by CBOR tag 21-23. The decoder will attempt to decode
+ // the base64-encoded bytes into Go slice.
+ ByteStringExpectedBase64
+
+ // ByteStringExpectedBase16 expects CBOR byte strings to contain base16-encoded bytes
+ // if the byte string is not tagged by CBOR tag 21-23. The decoder will attempt to decode
+ // the base16-encoded bytes into Go slice.
+ ByteStringExpectedBase16
+
+ maxByteStringExpectedFormatMode
+)
+
+func (bsefm ByteStringExpectedFormatMode) valid() bool {
+ return bsefm >= 0 && bsefm < maxByteStringExpectedFormatMode
+}
+
+// BignumTagMode specifies whether or not the "bignum" tags 2 and 3 (RFC 8949 Section 3.4.3) can be
+// decoded.
+type BignumTagMode int
+
+const (
+ // BignumTagAllowed allows bignum tags to be decoded.
+ BignumTagAllowed BignumTagMode = iota
+
+ // BignumTagForbidden produces an UnacceptableDataItemError during Unmarshal if a bignum tag
+ // is encountered in the input.
+ BignumTagForbidden
+
+ maxBignumTag
+)
+
+func (btm BignumTagMode) valid() bool {
+ return btm >= 0 && btm < maxBignumTag
+}
+
+// BinaryUnmarshalerMode specifies how to decode into types that implement
+// encoding.BinaryUnmarshaler.
+type BinaryUnmarshalerMode int
+
+const (
+ // BinaryUnmarshalerByteString will invoke UnmarshalBinary on the contents of a CBOR byte
+ // string when decoding into a value that implements BinaryUnmarshaler.
+ BinaryUnmarshalerByteString BinaryUnmarshalerMode = iota
+
+ // BinaryUnmarshalerNone does not recognize BinaryUnmarshaler implementations during decode.
+ BinaryUnmarshalerNone
+
+ maxBinaryUnmarshalerMode
+)
+
+func (bum BinaryUnmarshalerMode) valid() bool {
+ return bum >= 0 && bum < maxBinaryUnmarshalerMode
+}
+
+// DecOptions specifies decoding options.
+type DecOptions struct {
+ // DupMapKey specifies whether to enforce duplicate map key.
+ DupMapKey DupMapKeyMode
+
+ // TimeTag specifies whether or not untagged data items, or tags other
+ // than tag 0 and tag 1, can be decoded to time.Time. If tag 0 or tag 1
+ // appears in an input, the type of its content is always validated as
+ // specified in RFC 8949. That behavior is not controlled by this
+ // option. The behavior of the supported modes are:
+ //
+ // DecTagIgnored (default): Untagged text strings and text strings
+ // enclosed in tags other than 0 and 1 are decoded as though enclosed
+ // in tag 0. Untagged unsigned integers, negative integers, and
+ // floating-point numbers (or those enclosed in tags other than 0 and
+ // 1) are decoded as though enclosed in tag 1. Decoding a tag other
+ // than 0 or 1 enclosing simple values null or undefined into a
+ // time.Time does not modify the destination value.
+ //
+ // DecTagOptional: Untagged text strings are decoded as though
+ // enclosed in tag 0. Untagged unsigned integers, negative integers,
+ // and floating-point numbers are decoded as though enclosed in tag
+ // 1. Tags other than 0 and 1 will produce an error on attempts to
+ // decode them into a time.Time.
+ //
+ // DecTagRequired: Only tags 0 and 1 can be decoded to time.Time. Any
+ // other input will produce an error.
+ TimeTag DecTagMode
+
+ // MaxNestedLevels specifies the max nested levels allowed for any combination of CBOR array, maps, and tags.
+ // Default is 32 levels and it can be set to [4, 65535]. Note that higher maximum levels of nesting can
+ // require larger amounts of stack to deserialize. Don't increase this higher than you require.
+ MaxNestedLevels int
+
+ // MaxArrayElements specifies the max number of elements for CBOR arrays.
+ // Default is 128*1024=131072 and it can be set to [16, 2147483647]
+ MaxArrayElements int
+
+ // MaxMapPairs specifies the max number of key-value pairs for CBOR maps.
+ // Default is 128*1024=131072 and it can be set to [16, 2147483647]
+ MaxMapPairs int
+
+ // IndefLength specifies whether to allow indefinite length CBOR items.
+ IndefLength IndefLengthMode
+
+ // TagsMd specifies whether to allow CBOR tags (major type 6).
+ TagsMd TagsMode
+
+ // IntDec specifies which Go integer type (int64 or uint64) to use
+ // when decoding CBOR int (major type 0 and 1) to Go interface{}.
+ IntDec IntDecMode
+
+ // MapKeyByteString specifies how to decode CBOR byte string as map key
+ // when decoding CBOR map with byte string key into an empty interface value.
+ // By default, an error is returned when attempting to decode CBOR byte string
+ // as map key because Go doesn't allow []byte as map key.
+ MapKeyByteString MapKeyByteStringMode
+
+ // ExtraReturnErrors specifies extra conditions that should be treated as errors.
+ ExtraReturnErrors ExtraDecErrorCond
+
+ // DefaultMapType specifies Go map type to create and decode to
+ // when unmarshalling CBOR into an empty interface value.
+ // By default, unmarshal uses map[interface{}]interface{}.
+ DefaultMapType reflect.Type
+
+ // UTF8 specifies if decoder should decode CBOR Text containing invalid UTF-8.
+ // By default, unmarshal rejects CBOR text containing invalid UTF-8.
+ UTF8 UTF8Mode
+
+ // FieldNameMatching specifies how string keys in CBOR maps are matched to Go struct field names.
+ FieldNameMatching FieldNameMatchingMode
+
+ // BigIntDec specifies how to decode CBOR bignum to Go interface{}.
+ BigIntDec BigIntDecMode
+
+ // DefaultByteStringType is the Go type that should be produced when decoding a CBOR byte
+ // string into an empty interface value. Types to which a []byte is convertible are valid
+ // for this option, except for array and pointer-to-array types. If nil, the default is
+ // []byte.
+ DefaultByteStringType reflect.Type
+
+ // ByteStringToString specifies the behavior when decoding a CBOR byte string into a Go string.
+ ByteStringToString ByteStringToStringMode
+
+ // FieldNameByteString specifies the behavior when decoding a CBOR byte string map key as a
+ // Go struct field name.
+ FieldNameByteString FieldNameByteStringMode
+
+ // UnrecognizedTagToAny specifies how to decode unrecognized CBOR tag into an empty interface.
+ // Currently, recognized CBOR tag numbers are 0, 1, 2, 3, or registered by TagSet.
+ UnrecognizedTagToAny UnrecognizedTagToAnyMode
+
+ // TimeTagToAny specifies how to decode CBOR tag 0 and 1 into an empty interface (any).
+ // Based on the specified mode, Unmarshal can return a time.Time value or a time string in a specific format.
+ TimeTagToAny TimeTagToAnyMode
+
+ // SimpleValues is an immutable mapping from each CBOR simple value to a corresponding
+ // unmarshal behavior. If nil, the simple values false, true, null, and undefined are mapped
+ // to the Go analog values false, true, nil, and nil, respectively, and all other simple
+ // values N (except the reserved simple values 24 through 31) are mapped to
+ // cbor.SimpleValue(N). In other words, all well-formed simple values can be decoded.
+ //
+ // Users may provide a custom SimpleValueRegistry constructed via
+ // NewSimpleValueRegistryFromDefaults.
+ SimpleValues *SimpleValueRegistry
+
+ // NaN specifies how to decode floating-point values (major type 7, additional information
+ // 25 through 27) representing NaN (not-a-number).
+ NaN NaNMode
+
+ // Inf specifies how to decode floating-point values (major type 7, additional information
+ // 25 through 27) representing positive or negative infinity.
+ Inf InfMode
+
+ // ByteStringToTime specifies how to decode CBOR byte string into Go time.Time.
+ ByteStringToTime ByteStringToTimeMode
+
+ // ByteStringExpectedFormat specifies how to decode CBOR byte string into Go byte slice
+ // when the byte string is NOT enclosed in CBOR tag 21, 22, or 23. An error is returned if
+ // the CBOR byte string does not contain the expected format (e.g. base64) specified.
+ // For tags 21-23, see "Expected Later Encoding for CBOR-to-JSON Converters"
+ // in RFC 8949 Section 3.4.5.2.
+ ByteStringExpectedFormat ByteStringExpectedFormatMode
+
+ // BignumTag specifies whether or not the "bignum" tags 2 and 3 (RFC 8949 Section 3.4.3) can
+ // be decoded. Unlike BigIntDec, this option applies to all bignum tags encountered in a
+ // CBOR input, independent of the type of the destination value of a particular Unmarshal
+ // operation.
+ BignumTag BignumTagMode
+
+ // BinaryUnmarshaler specifies how to decode into types that implement
+ // encoding.BinaryUnmarshaler.
+ BinaryUnmarshaler BinaryUnmarshalerMode
+}
+
+// DecMode returns DecMode with immutable options and no tags (safe for concurrency).
+func (opts DecOptions) DecMode() (DecMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.decMode()
+}
+
+// validForTags checks that the provided tag set is compatible with these options and returns a
+// non-nil error if and only if the provided tag set is incompatible.
+func (opts DecOptions) validForTags(tags TagSet) error { //nolint:gocritic // ignore hugeParam
+ if opts.TagsMd == TagsForbidden {
+ return errors.New("cbor: cannot create DecMode with TagSet when TagsMd is TagsForbidden")
+ }
+ if tags == nil {
+ return errors.New("cbor: cannot create DecMode with nil value as TagSet")
+ }
+ if opts.ByteStringToString == ByteStringToStringAllowedWithExpectedLaterEncoding ||
+ opts.ByteStringExpectedFormat != ByteStringExpectedFormatNone {
+ for _, tagNum := range []uint64{
+ tagNumExpectedLaterEncodingBase64URL,
+ tagNumExpectedLaterEncodingBase64,
+ tagNumExpectedLaterEncodingBase16,
+ } {
+ if rt := tags.getTypeFromTagNum([]uint64{tagNum}); rt != nil {
+ return fmt.Errorf("cbor: DecMode with non-default StringExpectedEncoding or ByteSliceExpectedEncoding treats tag %d as built-in and conflicts with the provided TagSet's registration of %v", tagNum, rt)
+ }
+ }
+
+ }
+ return nil
+}
+
+// DecModeWithTags returns DecMode with options and tags that are both immutable (safe for concurrency).
+func (opts DecOptions) DecModeWithTags(tags TagSet) (DecMode, error) { //nolint:gocritic // ignore hugeParam
+ if err := opts.validForTags(tags); err != nil {
+ return nil, err
+ }
+ dm, err := opts.decMode()
+ if err != nil {
+ return nil, err
+ }
+
+ // Copy tags
+ ts := tagSet(make(map[reflect.Type]*tagItem))
+ syncTags := tags.(*syncTagSet)
+ syncTags.RLock()
+ for contentType, tag := range syncTags.t {
+ if tag.opts.DecTag != DecTagIgnored {
+ ts[contentType] = tag
+ }
+ }
+ syncTags.RUnlock()
+
+ if len(ts) > 0 {
+ dm.tags = ts
+ }
+
+ return dm, nil
+}
+
+// DecModeWithSharedTags returns DecMode with immutable options and mutable shared tags (safe for concurrency).
+func (opts DecOptions) DecModeWithSharedTags(tags TagSet) (DecMode, error) { //nolint:gocritic // ignore hugeParam
+ if err := opts.validForTags(tags); err != nil {
+ return nil, err
+ }
+ dm, err := opts.decMode()
+ if err != nil {
+ return nil, err
+ }
+ dm.tags = tags
+ return dm, nil
+}
+
+const (
+ defaultMaxArrayElements = 131072
+ minMaxArrayElements = 16
+ maxMaxArrayElements = 2147483647
+
+ defaultMaxMapPairs = 131072
+ minMaxMapPairs = 16
+ maxMaxMapPairs = 2147483647
+
+ defaultMaxNestedLevels = 32
+ minMaxNestedLevels = 4
+ maxMaxNestedLevels = 65535
+)
+
+var defaultSimpleValues = func() *SimpleValueRegistry {
+ registry, err := NewSimpleValueRegistryFromDefaults()
+ if err != nil {
+ panic(err)
+ }
+ return registry
+}()
+
+//nolint:gocyclo // Each option comes with some manageable boilerplate
+func (opts DecOptions) decMode() (*decMode, error) { //nolint:gocritic // ignore hugeParam
+ if !opts.DupMapKey.valid() {
+ return nil, errors.New("cbor: invalid DupMapKey " + strconv.Itoa(int(opts.DupMapKey)))
+ }
+
+ if !opts.TimeTag.valid() {
+ return nil, errors.New("cbor: invalid TimeTag " + strconv.Itoa(int(opts.TimeTag)))
+ }
+
+ if !opts.IndefLength.valid() {
+ return nil, errors.New("cbor: invalid IndefLength " + strconv.Itoa(int(opts.IndefLength)))
+ }
+
+ if !opts.TagsMd.valid() {
+ return nil, errors.New("cbor: invalid TagsMd " + strconv.Itoa(int(opts.TagsMd)))
+ }
+
+ if !opts.IntDec.valid() {
+ return nil, errors.New("cbor: invalid IntDec " + strconv.Itoa(int(opts.IntDec)))
+ }
+
+ if !opts.MapKeyByteString.valid() {
+ return nil, errors.New("cbor: invalid MapKeyByteString " + strconv.Itoa(int(opts.MapKeyByteString)))
+ }
+
+ if opts.MaxNestedLevels == 0 {
+ opts.MaxNestedLevels = defaultMaxNestedLevels
+ } else if opts.MaxNestedLevels < minMaxNestedLevels || opts.MaxNestedLevels > maxMaxNestedLevels {
+ return nil, errors.New("cbor: invalid MaxNestedLevels " + strconv.Itoa(opts.MaxNestedLevels) +
+ " (range is [" + strconv.Itoa(minMaxNestedLevels) + ", " + strconv.Itoa(maxMaxNestedLevels) + "])")
+ }
+
+ if opts.MaxArrayElements == 0 {
+ opts.MaxArrayElements = defaultMaxArrayElements
+ } else if opts.MaxArrayElements < minMaxArrayElements || opts.MaxArrayElements > maxMaxArrayElements {
+ return nil, errors.New("cbor: invalid MaxArrayElements " + strconv.Itoa(opts.MaxArrayElements) +
+ " (range is [" + strconv.Itoa(minMaxArrayElements) + ", " + strconv.Itoa(maxMaxArrayElements) + "])")
+ }
+
+ if opts.MaxMapPairs == 0 {
+ opts.MaxMapPairs = defaultMaxMapPairs
+ } else if opts.MaxMapPairs < minMaxMapPairs || opts.MaxMapPairs > maxMaxMapPairs {
+ return nil, errors.New("cbor: invalid MaxMapPairs " + strconv.Itoa(opts.MaxMapPairs) +
+ " (range is [" + strconv.Itoa(minMaxMapPairs) + ", " + strconv.Itoa(maxMaxMapPairs) + "])")
+ }
+
+ if !opts.ExtraReturnErrors.valid() {
+ return nil, errors.New("cbor: invalid ExtraReturnErrors " + strconv.Itoa(int(opts.ExtraReturnErrors)))
+ }
+
+ if opts.DefaultMapType != nil && opts.DefaultMapType.Kind() != reflect.Map {
+ return nil, fmt.Errorf("cbor: invalid DefaultMapType %s", opts.DefaultMapType)
+ }
+
+ if !opts.UTF8.valid() {
+ return nil, errors.New("cbor: invalid UTF8 " + strconv.Itoa(int(opts.UTF8)))
+ }
+
+ if !opts.FieldNameMatching.valid() {
+ return nil, errors.New("cbor: invalid FieldNameMatching " + strconv.Itoa(int(opts.FieldNameMatching)))
+ }
+
+ if !opts.BigIntDec.valid() {
+ return nil, errors.New("cbor: invalid BigIntDec " + strconv.Itoa(int(opts.BigIntDec)))
+ }
+
+ if opts.DefaultByteStringType != nil &&
+ opts.DefaultByteStringType.Kind() != reflect.String &&
+ (opts.DefaultByteStringType.Kind() != reflect.Slice || opts.DefaultByteStringType.Elem().Kind() != reflect.Uint8) {
+ return nil, fmt.Errorf("cbor: invalid DefaultByteStringType: %s is not of kind string or []uint8", opts.DefaultByteStringType)
+ }
+
+ if !opts.ByteStringToString.valid() {
+ return nil, errors.New("cbor: invalid ByteStringToString " + strconv.Itoa(int(opts.ByteStringToString)))
+ }
+
+ if !opts.FieldNameByteString.valid() {
+ return nil, errors.New("cbor: invalid FieldNameByteString " + strconv.Itoa(int(opts.FieldNameByteString)))
+ }
+
+ if !opts.UnrecognizedTagToAny.valid() {
+ return nil, errors.New("cbor: invalid UnrecognizedTagToAnyMode " + strconv.Itoa(int(opts.UnrecognizedTagToAny)))
+ }
+ simpleValues := opts.SimpleValues
+ if simpleValues == nil {
+ simpleValues = defaultSimpleValues
+ }
+
+ if !opts.TimeTagToAny.valid() {
+ return nil, errors.New("cbor: invalid TimeTagToAny " + strconv.Itoa(int(opts.TimeTagToAny)))
+ }
+
+ if !opts.NaN.valid() {
+ return nil, errors.New("cbor: invalid NaNDec " + strconv.Itoa(int(opts.NaN)))
+ }
+
+ if !opts.Inf.valid() {
+ return nil, errors.New("cbor: invalid InfDec " + strconv.Itoa(int(opts.Inf)))
+ }
+
+ if !opts.ByteStringToTime.valid() {
+ return nil, errors.New("cbor: invalid ByteStringToTime " + strconv.Itoa(int(opts.ByteStringToTime)))
+ }
+
+ if !opts.ByteStringExpectedFormat.valid() {
+ return nil, errors.New("cbor: invalid ByteStringExpectedFormat " + strconv.Itoa(int(opts.ByteStringExpectedFormat)))
+ }
+
+ if !opts.BignumTag.valid() {
+ return nil, errors.New("cbor: invalid BignumTag " + strconv.Itoa(int(opts.BignumTag)))
+ }
+
+ if !opts.BinaryUnmarshaler.valid() {
+ return nil, errors.New("cbor: invalid BinaryUnmarshaler " + strconv.Itoa(int(opts.BinaryUnmarshaler)))
+ }
+
+ dm := decMode{
+ dupMapKey: opts.DupMapKey,
+ timeTag: opts.TimeTag,
+ maxNestedLevels: opts.MaxNestedLevels,
+ maxArrayElements: opts.MaxArrayElements,
+ maxMapPairs: opts.MaxMapPairs,
+ indefLength: opts.IndefLength,
+ tagsMd: opts.TagsMd,
+ intDec: opts.IntDec,
+ mapKeyByteString: opts.MapKeyByteString,
+ extraReturnErrors: opts.ExtraReturnErrors,
+ defaultMapType: opts.DefaultMapType,
+ utf8: opts.UTF8,
+ fieldNameMatching: opts.FieldNameMatching,
+ bigIntDec: opts.BigIntDec,
+ defaultByteStringType: opts.DefaultByteStringType,
+ byteStringToString: opts.ByteStringToString,
+ fieldNameByteString: opts.FieldNameByteString,
+ unrecognizedTagToAny: opts.UnrecognizedTagToAny,
+ timeTagToAny: opts.TimeTagToAny,
+ simpleValues: simpleValues,
+ nanDec: opts.NaN,
+ infDec: opts.Inf,
+ byteStringToTime: opts.ByteStringToTime,
+ byteStringExpectedFormat: opts.ByteStringExpectedFormat,
+ bignumTag: opts.BignumTag,
+ binaryUnmarshaler: opts.BinaryUnmarshaler,
+ }
+
+ return &dm, nil
+}
+
+// DecMode is the main interface for CBOR decoding.
+type DecMode interface {
+ // Unmarshal parses the CBOR-encoded data into the value pointed to by v
+ // using the decoding mode. If v is nil, not a pointer, or a nil pointer,
+ // Unmarshal returns an error.
+ //
+ // See the documentation for Unmarshal for details.
+ Unmarshal(data []byte, v interface{}) error
+
+ // UnmarshalFirst parses the first CBOR data item into the value pointed to by v
+ // using the decoding mode. Any remaining bytes are returned in rest.
+ //
+ // If v is nil, not a pointer, or a nil pointer, UnmarshalFirst returns an error.
+ //
+ // See the documentation for Unmarshal for details.
+ UnmarshalFirst(data []byte, v interface{}) (rest []byte, err error)
+
+ // Valid checks whether data is a well-formed encoded CBOR data item and
+ // that it complies with configurable restrictions such as MaxNestedLevels,
+ // MaxArrayElements, MaxMapPairs, etc.
+ //
+ // If there are any remaining bytes after the CBOR data item,
+ // an ExtraneousDataError is returned.
+ //
+ // WARNING: Valid doesn't check if encoded CBOR data item is valid (i.e. validity)
+ // and RFC 8949 distinctly defines what is "Valid" and what is "Well-formed".
+ //
+ // Deprecated: Valid is kept for compatibility and should not be used.
+ // Use Wellformed instead because it has a more appropriate name.
+ Valid(data []byte) error
+
+ // Wellformed checks whether data is a well-formed encoded CBOR data item and
+ // that it complies with configurable restrictions such as MaxNestedLevels,
+ // MaxArrayElements, MaxMapPairs, etc.
+ //
+ // If there are any remaining bytes after the CBOR data item,
+ // an ExtraneousDataError is returned.
+ Wellformed(data []byte) error
+
+ // NewDecoder returns a new decoder that reads from r using dm DecMode.
+ NewDecoder(r io.Reader) *Decoder
+
+ // DecOptions returns user specified options used to create this DecMode.
+ DecOptions() DecOptions
+}
+
+type decMode struct {
+ tags tagProvider
+ dupMapKey DupMapKeyMode
+ timeTag DecTagMode
+ maxNestedLevels int
+ maxArrayElements int
+ maxMapPairs int
+ indefLength IndefLengthMode
+ tagsMd TagsMode
+ intDec IntDecMode
+ mapKeyByteString MapKeyByteStringMode
+ extraReturnErrors ExtraDecErrorCond
+ defaultMapType reflect.Type
+ utf8 UTF8Mode
+ fieldNameMatching FieldNameMatchingMode
+ bigIntDec BigIntDecMode
+ defaultByteStringType reflect.Type
+ byteStringToString ByteStringToStringMode
+ fieldNameByteString FieldNameByteStringMode
+ unrecognizedTagToAny UnrecognizedTagToAnyMode
+ timeTagToAny TimeTagToAnyMode
+ simpleValues *SimpleValueRegistry
+ nanDec NaNMode
+ infDec InfMode
+ byteStringToTime ByteStringToTimeMode
+ byteStringExpectedFormat ByteStringExpectedFormatMode
+ bignumTag BignumTagMode
+ binaryUnmarshaler BinaryUnmarshalerMode
+}
+
+var defaultDecMode, _ = DecOptions{}.decMode()
+
+// DecOptions returns user specified options used to create this DecMode.
+func (dm *decMode) DecOptions() DecOptions {
+ simpleValues := dm.simpleValues
+ if simpleValues == defaultSimpleValues {
+ // Users can't explicitly set this to defaultSimpleValues. It must have been nil in
+ // the original DecOptions.
+ simpleValues = nil
+ }
+
+ return DecOptions{
+ DupMapKey: dm.dupMapKey,
+ TimeTag: dm.timeTag,
+ MaxNestedLevels: dm.maxNestedLevels,
+ MaxArrayElements: dm.maxArrayElements,
+ MaxMapPairs: dm.maxMapPairs,
+ IndefLength: dm.indefLength,
+ TagsMd: dm.tagsMd,
+ IntDec: dm.intDec,
+ MapKeyByteString: dm.mapKeyByteString,
+ ExtraReturnErrors: dm.extraReturnErrors,
+ DefaultMapType: dm.defaultMapType,
+ UTF8: dm.utf8,
+ FieldNameMatching: dm.fieldNameMatching,
+ BigIntDec: dm.bigIntDec,
+ DefaultByteStringType: dm.defaultByteStringType,
+ ByteStringToString: dm.byteStringToString,
+ FieldNameByteString: dm.fieldNameByteString,
+ UnrecognizedTagToAny: dm.unrecognizedTagToAny,
+ TimeTagToAny: dm.timeTagToAny,
+ SimpleValues: simpleValues,
+ NaN: dm.nanDec,
+ Inf: dm.infDec,
+ ByteStringToTime: dm.byteStringToTime,
+ ByteStringExpectedFormat: dm.byteStringExpectedFormat,
+ BignumTag: dm.bignumTag,
+ BinaryUnmarshaler: dm.binaryUnmarshaler,
+ }
+}
+
+// Unmarshal parses the CBOR-encoded data into the value pointed to by v
+// using dm decoding mode. If v is nil, not a pointer, or a nil pointer,
+// Unmarshal returns an error.
+//
+// See the documentation for Unmarshal for details.
+func (dm *decMode) Unmarshal(data []byte, v interface{}) error {
+ d := decoder{data: data, dm: dm}
+
+ // Check well-formedness.
+ off := d.off // Save offset before data validation
+ err := d.wellformed(false, false) // don't allow any extra data after valid data item.
+ d.off = off // Restore offset
+ if err != nil {
+ return err
+ }
+
+ return d.value(v)
+}
+
+// UnmarshalFirst parses the first CBOR data item into the value pointed to by v
+// using dm decoding mode. Any remaining bytes are returned in rest.
+//
+// If v is nil, not a pointer, or a nil pointer, UnmarshalFirst returns an error.
+//
+// See the documentation for Unmarshal for details.
+func (dm *decMode) UnmarshalFirst(data []byte, v interface{}) (rest []byte, err error) {
+ d := decoder{data: data, dm: dm}
+
+ // check well-formedness.
+ off := d.off // Save offset before data validation
+ err = d.wellformed(true, false) // allow extra data after well-formed data item
+ d.off = off // Restore offset
+
+ // If it is well-formed, parse the value. This is structured like this to allow
+ // better test coverage
+ if err == nil {
+ err = d.value(v)
+ }
+
+ // If either wellformed or value returned an error, do not return rest bytes
+ if err != nil {
+ return nil, err
+ }
+
+ // Return the rest of the data slice (which might be len 0)
+ return d.data[d.off:], nil
+}
+
+// Valid checks whether data is a well-formed encoded CBOR data item and
+// that it complies with configurable restrictions such as MaxNestedLevels,
+// MaxArrayElements, MaxMapPairs, etc.
+//
+// If there are any remaining bytes after the CBOR data item,
+// an ExtraneousDataError is returned.
+//
+// WARNING: Valid doesn't check if encoded CBOR data item is valid (i.e. validity)
+// and RFC 8949 distinctly defines what is "Valid" and what is "Well-formed".
+//
+// Deprecated: Valid is kept for compatibility and should not be used.
+// Use Wellformed instead because it has a more appropriate name.
+func (dm *decMode) Valid(data []byte) error {
+ return dm.Wellformed(data)
+}
+
+// Wellformed checks whether data is a well-formed encoded CBOR data item and
+// that it complies with configurable restrictions such as MaxNestedLevels,
+// MaxArrayElements, MaxMapPairs, etc.
+//
+// If there are any remaining bytes after the CBOR data item,
+// an ExtraneousDataError is returned.
+func (dm *decMode) Wellformed(data []byte) error {
+ d := decoder{data: data, dm: dm}
+ return d.wellformed(false, false)
+}
+
+// NewDecoder returns a new decoder that reads from r using dm DecMode.
+func (dm *decMode) NewDecoder(r io.Reader) *Decoder {
+ return &Decoder{r: r, d: decoder{dm: dm}}
+}
+
+type decoder struct {
+ data []byte
+ off int // next read offset in data
+ dm *decMode
+
+ // expectedLaterEncodingTags stores a stack of encountered "Expected Later Encoding" tags,
+ // if any.
+ //
+ // The "Expected Later Encoding" tags (21 to 23) are valid for any data item. When decoding
+ // byte strings, the effective encoding comes from the tag nearest to the byte string being
+ // decoded. For example, the effective encoding of the byte string 21(22(h'41')) would be
+ // controlled by tag 22,and in the data item 23(h'42', 22([21(h'43')])]) the effective
+ // encoding of the byte strings h'42' and h'43' would be controlled by tag 23 and 21,
+ // respectively.
+ expectedLaterEncodingTags []uint64
+}
+
+// value decodes CBOR data item into the value pointed to by v.
+// If CBOR data item fails to be decoded into v,
+// error is returned and offset is moved to the next CBOR data item.
+// Precondition: d.data contains at least one well-formed CBOR data item.
+func (d *decoder) value(v interface{}) error {
+ // v can't be nil, non-pointer, or nil pointer value.
+ if v == nil {
+ return &InvalidUnmarshalError{"cbor: Unmarshal(nil)"}
+ }
+ rv := reflect.ValueOf(v)
+ if rv.Kind() != reflect.Ptr {
+ return &InvalidUnmarshalError{"cbor: Unmarshal(non-pointer " + rv.Type().String() + ")"}
+ } else if rv.IsNil() {
+ return &InvalidUnmarshalError{"cbor: Unmarshal(nil " + rv.Type().String() + ")"}
+ }
+ rv = rv.Elem()
+ return d.parseToValue(rv, getTypeInfo(rv.Type()))
+}
+
+// parseToValue decodes CBOR data to value. It assumes data is well-formed,
+// and does not perform bounds checking.
+func (d *decoder) parseToValue(v reflect.Value, tInfo *typeInfo) error { //nolint:gocyclo
+
+ // Decode CBOR nil or CBOR undefined to pointer value by setting pointer value to nil.
+ if d.nextCBORNil() && v.Kind() == reflect.Ptr {
+ d.skip()
+ v.Set(reflect.Zero(v.Type()))
+ return nil
+ }
+
+ if tInfo.spclType == specialTypeIface {
+ if !v.IsNil() {
+ // Use value type
+ v = v.Elem()
+ tInfo = getTypeInfo(v.Type())
+ } else { //nolint:gocritic
+ // Create and use registered type if CBOR data is registered tag
+ if d.dm.tags != nil && d.nextCBORType() == cborTypeTag {
+
+ off := d.off
+ var tagNums []uint64
+ for d.nextCBORType() == cborTypeTag {
+ _, _, tagNum := d.getHead()
+ tagNums = append(tagNums, tagNum)
+ }
+ d.off = off
+
+ registeredType := d.dm.tags.getTypeFromTagNum(tagNums)
+ if registeredType != nil {
+ if registeredType.Implements(tInfo.nonPtrType) ||
+ reflect.PtrTo(registeredType).Implements(tInfo.nonPtrType) {
+ v.Set(reflect.New(registeredType))
+ v = v.Elem()
+ tInfo = getTypeInfo(registeredType)
+ }
+ }
+ }
+ }
+ }
+
+ // Create new value for the pointer v to point to.
+ // At this point, CBOR value is not nil/undefined if v is a pointer.
+ for v.Kind() == reflect.Ptr {
+ if v.IsNil() {
+ if !v.CanSet() {
+ d.skip()
+ return errors.New("cbor: cannot set new value for " + v.Type().String())
+ }
+ v.Set(reflect.New(v.Type().Elem()))
+ }
+ v = v.Elem()
+ }
+
+ // Strip self-described CBOR tag number.
+ for d.nextCBORType() == cborTypeTag {
+ off := d.off
+ _, _, tagNum := d.getHead()
+ if tagNum != tagNumSelfDescribedCBOR {
+ d.off = off
+ break
+ }
+ }
+
+ // Check validity of supported built-in tags.
+ off := d.off
+ for d.nextCBORType() == cborTypeTag {
+ _, _, tagNum := d.getHead()
+ if err := validBuiltinTag(tagNum, d.data[d.off]); err != nil {
+ d.skip()
+ return err
+ }
+ }
+ d.off = off
+
+ if tInfo.spclType != specialTypeNone {
+ switch tInfo.spclType {
+ case specialTypeEmptyIface:
+ iv, err := d.parse(false) // Skipped self-described CBOR tag number already.
+ if iv != nil {
+ v.Set(reflect.ValueOf(iv))
+ }
+ return err
+
+ case specialTypeTag:
+ return d.parseToTag(v)
+
+ case specialTypeTime:
+ if d.nextCBORNil() {
+ // Decoding CBOR null and undefined to time.Time is no-op.
+ d.skip()
+ return nil
+ }
+ tm, ok, err := d.parseToTime()
+ if err != nil {
+ return err
+ }
+ if ok {
+ v.Set(reflect.ValueOf(tm))
+ }
+ return nil
+
+ case specialTypeUnmarshalerIface:
+ return d.parseToUnmarshaler(v)
+ }
+ }
+
+ // Check registered tag number
+ if tagItem := d.getRegisteredTagItem(tInfo.nonPtrType); tagItem != nil {
+ t := d.nextCBORType()
+ if t != cborTypeTag {
+ if tagItem.opts.DecTag == DecTagRequired {
+ d.skip() // Required tag number is absent, skip entire tag
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.typ.String(),
+ errorMsg: "expect CBOR tag value"}
+ }
+ } else if err := d.validRegisteredTagNums(tagItem); err != nil {
+ d.skip() // Skip tag content
+ return err
+ }
+ }
+
+ t := d.nextCBORType()
+
+ switch t {
+ case cborTypePositiveInt:
+ _, _, val := d.getHead()
+ return fillPositiveInt(t, val, v)
+
+ case cborTypeNegativeInt:
+ _, _, val := d.getHead()
+ if val > math.MaxInt64 {
+ // CBOR negative integer overflows int64, use big.Int to store value.
+ bi := new(big.Int)
+ bi.SetUint64(val)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+
+ if tInfo.nonPtrType == typeBigInt {
+ v.Set(reflect.ValueOf(*bi))
+ return nil
+ }
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: bi.String() + " overflows Go's int64",
+ }
+ }
+ nValue := int64(-1) ^ int64(val)
+ return fillNegativeInt(t, nValue, v)
+
+ case cborTypeByteString:
+ b, copied := d.parseByteString()
+ b, converted, err := d.applyByteStringTextConversion(b, v.Type())
+ if err != nil {
+ return err
+ }
+ copied = copied || converted
+ return fillByteString(t, b, !copied, v, d.dm.byteStringToString, d.dm.binaryUnmarshaler)
+
+ case cborTypeTextString:
+ b, err := d.parseTextString()
+ if err != nil {
+ return err
+ }
+ return fillTextString(t, b, v)
+
+ case cborTypePrimitives:
+ _, ai, val := d.getHead()
+ switch ai {
+ case additionalInformationAsFloat16:
+ f := float64(float16.Frombits(uint16(val)).Float32())
+ return fillFloat(t, f, v)
+
+ case additionalInformationAsFloat32:
+ f := float64(math.Float32frombits(uint32(val)))
+ return fillFloat(t, f, v)
+
+ case additionalInformationAsFloat64:
+ f := math.Float64frombits(val)
+ return fillFloat(t, f, v)
+
+ default: // ai <= 24
+ if d.dm.simpleValues.rejected[SimpleValue(val)] {
+ return &UnacceptableDataItemError{
+ CBORType: t.String(),
+ Message: "simple value " + strconv.FormatInt(int64(val), 10) + " is not recognized",
+ }
+ }
+
+ switch ai {
+ case additionalInformationAsFalse,
+ additionalInformationAsTrue:
+ return fillBool(t, ai == additionalInformationAsTrue, v)
+
+ case additionalInformationAsNull,
+ additionalInformationAsUndefined:
+ return fillNil(t, v)
+
+ default:
+ return fillPositiveInt(t, val, v)
+ }
+ }
+
+ case cborTypeTag:
+ _, _, tagNum := d.getHead()
+ switch tagNum {
+ case tagNumUnsignedBignum:
+ // Bignum (tag 2) can be decoded to uint, int, float, slice, array, or big.Int.
+ b, copied := d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+
+ if tInfo.nonPtrType == typeBigInt {
+ v.Set(reflect.ValueOf(*bi))
+ return nil
+ }
+ if tInfo.nonPtrKind == reflect.Slice || tInfo.nonPtrKind == reflect.Array {
+ return fillByteString(t, b, !copied, v, ByteStringToStringForbidden, d.dm.binaryUnmarshaler)
+ }
+ if bi.IsUint64() {
+ return fillPositiveInt(t, bi.Uint64(), v)
+ }
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: bi.String() + " overflows " + v.Type().String(),
+ }
+
+ case tagNumNegativeBignum:
+ // Bignum (tag 3) can be decoded to int, float, slice, array, or big.Int.
+ b, copied := d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+
+ if tInfo.nonPtrType == typeBigInt {
+ v.Set(reflect.ValueOf(*bi))
+ return nil
+ }
+ if tInfo.nonPtrKind == reflect.Slice || tInfo.nonPtrKind == reflect.Array {
+ return fillByteString(t, b, !copied, v, ByteStringToStringForbidden, d.dm.binaryUnmarshaler)
+ }
+ if bi.IsInt64() {
+ return fillNegativeInt(t, bi.Int64(), v)
+ }
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: bi.String() + " overflows " + v.Type().String(),
+ }
+
+ case tagNumExpectedLaterEncodingBase64URL, tagNumExpectedLaterEncodingBase64, tagNumExpectedLaterEncodingBase16:
+ // If conversion for interoperability with text encodings is not configured,
+ // treat tags 21-23 as unregistered tags.
+ if d.dm.byteStringToString == ByteStringToStringAllowedWithExpectedLaterEncoding || d.dm.byteStringExpectedFormat != ByteStringExpectedFormatNone {
+ d.expectedLaterEncodingTags = append(d.expectedLaterEncodingTags, tagNum)
+ defer func() {
+ d.expectedLaterEncodingTags = d.expectedLaterEncodingTags[:len(d.expectedLaterEncodingTags)-1]
+ }()
+ }
+ }
+
+ return d.parseToValue(v, tInfo)
+
+ case cborTypeArray:
+ if tInfo.nonPtrKind == reflect.Slice {
+ return d.parseArrayToSlice(v, tInfo)
+ } else if tInfo.nonPtrKind == reflect.Array {
+ return d.parseArrayToArray(v, tInfo)
+ } else if tInfo.nonPtrKind == reflect.Struct {
+ return d.parseArrayToStruct(v, tInfo)
+ }
+ d.skip()
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: tInfo.nonPtrType.String()}
+
+ case cborTypeMap:
+ if tInfo.nonPtrKind == reflect.Struct {
+ return d.parseMapToStruct(v, tInfo)
+ } else if tInfo.nonPtrKind == reflect.Map {
+ return d.parseMapToMap(v, tInfo)
+ }
+ d.skip()
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: tInfo.nonPtrType.String()}
+ }
+
+ return nil
+}
+
+func (d *decoder) parseToTag(v reflect.Value) error {
+ if d.nextCBORNil() {
+ // Decoding CBOR null and undefined to cbor.Tag is no-op.
+ d.skip()
+ return nil
+ }
+
+ t := d.nextCBORType()
+ if t != cborTypeTag {
+ d.skip()
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: typeTag.String()}
+ }
+
+ // Unmarshal tag number
+ _, _, num := d.getHead()
+
+ // Unmarshal tag content
+ content, err := d.parse(false)
+ if err != nil {
+ return err
+ }
+
+ v.Set(reflect.ValueOf(Tag{num, content}))
+ return nil
+}
+
+// parseToTime decodes the current data item as a time.Time. The bool return value is false if and
+// only if the destination value should remain unmodified.
+func (d *decoder) parseToTime() (time.Time, bool, error) {
+ // Verify that tag number or absence of tag number is acceptable to specified timeTag.
+ if t := d.nextCBORType(); t == cborTypeTag {
+ if d.dm.timeTag == DecTagIgnored {
+ // Skip all enclosing tags
+ for t == cborTypeTag {
+ d.getHead()
+ t = d.nextCBORType()
+ }
+ if d.nextCBORNil() {
+ d.skip()
+ return time.Time{}, false, nil
+ }
+ } else {
+ // Read tag number
+ _, _, tagNum := d.getHead()
+ if tagNum != 0 && tagNum != 1 {
+ d.skip() // skip tag content
+ return time.Time{}, false, errors.New("cbor: wrong tag number for time.Time, got " + strconv.Itoa(int(tagNum)) + ", expect 0 or 1")
+ }
+ }
+ } else {
+ if d.dm.timeTag == DecTagRequired {
+ d.skip()
+ return time.Time{}, false, &UnmarshalTypeError{CBORType: t.String(), GoType: typeTime.String(), errorMsg: "expect CBOR tag value"}
+ }
+ }
+
+ switch t := d.nextCBORType(); t {
+ case cborTypeByteString:
+ if d.dm.byteStringToTime == ByteStringToTimeAllowed {
+ b, _ := d.parseByteString()
+ t, err := time.Parse(time.RFC3339, string(b))
+ if err != nil {
+ return time.Time{}, false, fmt.Errorf("cbor: cannot set %q for time.Time: %w", string(b), err)
+ }
+ return t, true, nil
+ }
+ return time.Time{}, false, &UnmarshalTypeError{CBORType: t.String(), GoType: typeTime.String()}
+
+ case cborTypeTextString:
+ s, err := d.parseTextString()
+ if err != nil {
+ return time.Time{}, false, err
+ }
+ t, err := time.Parse(time.RFC3339, string(s))
+ if err != nil {
+ return time.Time{}, false, errors.New("cbor: cannot set " + string(s) + " for time.Time: " + err.Error())
+ }
+ return t, true, nil
+
+ case cborTypePositiveInt:
+ _, _, val := d.getHead()
+ if val > math.MaxInt64 {
+ return time.Time{}, false, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: typeTime.String(),
+ errorMsg: fmt.Sprintf("%d overflows Go's int64", val),
+ }
+ }
+ return time.Unix(int64(val), 0), true, nil
+
+ case cborTypeNegativeInt:
+ _, _, val := d.getHead()
+ if val > math.MaxInt64 {
+ if val == math.MaxUint64 {
+ // Maximum absolute value representable by negative integer is 2^64,
+ // not 2^64-1, so it overflows uint64.
+ return time.Time{}, false, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: typeTime.String(),
+ errorMsg: "-18446744073709551616 overflows Go's int64",
+ }
+ }
+ return time.Time{}, false, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: typeTime.String(),
+ errorMsg: fmt.Sprintf("-%d overflows Go's int64", val+1),
+ }
+ }
+ return time.Unix(int64(-1)^int64(val), 0), true, nil
+
+ case cborTypePrimitives:
+ _, ai, val := d.getHead()
+ var f float64
+ switch ai {
+ case additionalInformationAsFloat16:
+ f = float64(float16.Frombits(uint16(val)).Float32())
+
+ case additionalInformationAsFloat32:
+ f = float64(math.Float32frombits(uint32(val)))
+
+ case additionalInformationAsFloat64:
+ f = math.Float64frombits(val)
+
+ default:
+ return time.Time{}, false, &UnmarshalTypeError{CBORType: t.String(), GoType: typeTime.String()}
+ }
+
+ if math.IsNaN(f) || math.IsInf(f, 0) {
+ // https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.2-6
+ return time.Time{}, true, nil
+ }
+ seconds, fractional := math.Modf(f)
+ return time.Unix(int64(seconds), int64(fractional*1e9)), true, nil
+
+ default:
+ return time.Time{}, false, &UnmarshalTypeError{CBORType: t.String(), GoType: typeTime.String()}
+ }
+}
+
+// parseToUnmarshaler parses CBOR data to value implementing Unmarshaler interface.
+// It assumes data is well-formed, and does not perform bounds checking.
+func (d *decoder) parseToUnmarshaler(v reflect.Value) error {
+ if d.nextCBORNil() && v.Kind() == reflect.Ptr && v.IsNil() {
+ d.skip()
+ return nil
+ }
+
+ if v.Kind() != reflect.Ptr && v.CanAddr() {
+ v = v.Addr()
+ }
+ if u, ok := v.Interface().(Unmarshaler); ok {
+ start := d.off
+ d.skip()
+ return u.UnmarshalCBOR(d.data[start:d.off])
+ }
+ d.skip()
+ return errors.New("cbor: failed to assert " + v.Type().String() + " as cbor.Unmarshaler")
+}
+
+// parse parses CBOR data and returns value in default Go type.
+// It assumes data is well-formed, and does not perform bounds checking.
+func (d *decoder) parse(skipSelfDescribedTag bool) (interface{}, error) { //nolint:gocyclo
+ // Strip self-described CBOR tag number.
+ if skipSelfDescribedTag {
+ for d.nextCBORType() == cborTypeTag {
+ off := d.off
+ _, _, tagNum := d.getHead()
+ if tagNum != tagNumSelfDescribedCBOR {
+ d.off = off
+ break
+ }
+ }
+ }
+
+ // Check validity of supported built-in tags.
+ off := d.off
+ for d.nextCBORType() == cborTypeTag {
+ _, _, tagNum := d.getHead()
+ if err := validBuiltinTag(tagNum, d.data[d.off]); err != nil {
+ d.skip()
+ return nil, err
+ }
+ }
+ d.off = off
+
+ t := d.nextCBORType()
+ switch t {
+ case cborTypePositiveInt:
+ _, _, val := d.getHead()
+
+ switch d.dm.intDec {
+ case IntDecConvertNone:
+ return val, nil
+
+ case IntDecConvertSigned, IntDecConvertSignedOrFail:
+ if val > math.MaxInt64 {
+ return nil, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: reflect.TypeOf(int64(0)).String(),
+ errorMsg: strconv.FormatUint(val, 10) + " overflows Go's int64",
+ }
+ }
+
+ return int64(val), nil
+
+ case IntDecConvertSignedOrBigInt:
+ if val > math.MaxInt64 {
+ bi := new(big.Int).SetUint64(val)
+ if d.dm.bigIntDec == BigIntDecodePointer {
+ return bi, nil
+ }
+ return *bi, nil
+ }
+
+ return int64(val), nil
+
+ default:
+ // not reachable
+ }
+
+ case cborTypeNegativeInt:
+ _, _, val := d.getHead()
+
+ if val > math.MaxInt64 {
+ // CBOR negative integer value overflows Go int64, use big.Int instead.
+ bi := new(big.Int).SetUint64(val)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+
+ if d.dm.intDec == IntDecConvertSignedOrFail {
+ return nil, &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: reflect.TypeOf(int64(0)).String(),
+ errorMsg: bi.String() + " overflows Go's int64",
+ }
+ }
+
+ if d.dm.bigIntDec == BigIntDecodePointer {
+ return bi, nil
+ }
+ return *bi, nil
+ }
+
+ nValue := int64(-1) ^ int64(val)
+ return nValue, nil
+
+ case cborTypeByteString:
+ b, copied := d.parseByteString()
+ var effectiveByteStringType = d.dm.defaultByteStringType
+ if effectiveByteStringType == nil {
+ effectiveByteStringType = typeByteSlice
+ }
+ b, converted, err := d.applyByteStringTextConversion(b, effectiveByteStringType)
+ if err != nil {
+ return nil, err
+ }
+ copied = copied || converted
+
+ switch effectiveByteStringType {
+ case typeByteSlice:
+ if copied {
+ return b, nil
+ }
+ clone := make([]byte, len(b))
+ copy(clone, b)
+ return clone, nil
+
+ case typeString:
+ return string(b), nil
+
+ default:
+ if copied || d.dm.defaultByteStringType.Kind() == reflect.String {
+ // Avoid an unnecessary copy since the conversion to string must
+ // copy the underlying bytes.
+ return reflect.ValueOf(b).Convert(d.dm.defaultByteStringType).Interface(), nil
+ }
+ clone := make([]byte, len(b))
+ copy(clone, b)
+ return reflect.ValueOf(clone).Convert(d.dm.defaultByteStringType).Interface(), nil
+ }
+
+ case cborTypeTextString:
+ b, err := d.parseTextString()
+ if err != nil {
+ return nil, err
+ }
+ return string(b), nil
+
+ case cborTypeTag:
+ tagOff := d.off
+ _, _, tagNum := d.getHead()
+ contentOff := d.off
+
+ switch tagNum {
+ case tagNumRFC3339Time, tagNumEpochTime:
+ d.off = tagOff
+ tm, _, err := d.parseToTime()
+ if err != nil {
+ return nil, err
+ }
+
+ switch d.dm.timeTagToAny {
+ case TimeTagToTime:
+ return tm, nil
+
+ case TimeTagToRFC3339:
+ if tagNum == 1 {
+ tm = tm.UTC()
+ }
+ // Call time.MarshalText() to format decoded time to RFC3339 format,
+ // and return error on time value that cannot be represented in
+ // RFC3339 format. E.g. year cannot exceed 9999, etc.
+ text, err := tm.Truncate(time.Second).MarshalText()
+ if err != nil {
+ return nil, fmt.Errorf("cbor: decoded time cannot be represented in RFC3339 format: %v", err)
+ }
+ return string(text), nil
+
+ case TimeTagToRFC3339Nano:
+ if tagNum == 1 {
+ tm = tm.UTC()
+ }
+ // Call time.MarshalText() to format decoded time to RFC3339 format,
+ // and return error on time value that cannot be represented in
+ // RFC3339 format with sub-second precision.
+ text, err := tm.MarshalText()
+ if err != nil {
+ return nil, fmt.Errorf("cbor: decoded time cannot be represented in RFC3339 format with sub-second precision: %v", err)
+ }
+ return string(text), nil
+
+ default:
+ // not reachable
+ }
+
+ case tagNumUnsignedBignum:
+ b, _ := d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+
+ if d.dm.bigIntDec == BigIntDecodePointer {
+ return bi, nil
+ }
+ return *bi, nil
+
+ case tagNumNegativeBignum:
+ b, _ := d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+
+ if d.dm.bigIntDec == BigIntDecodePointer {
+ return bi, nil
+ }
+ return *bi, nil
+
+ case tagNumExpectedLaterEncodingBase64URL, tagNumExpectedLaterEncodingBase64, tagNumExpectedLaterEncodingBase16:
+ // If conversion for interoperability with text encodings is not configured,
+ // treat tags 21-23 as unregistered tags.
+ if d.dm.byteStringToString == ByteStringToStringAllowedWithExpectedLaterEncoding ||
+ d.dm.byteStringExpectedFormat != ByteStringExpectedFormatNone {
+ d.expectedLaterEncodingTags = append(d.expectedLaterEncodingTags, tagNum)
+ defer func() {
+ d.expectedLaterEncodingTags = d.expectedLaterEncodingTags[:len(d.expectedLaterEncodingTags)-1]
+ }()
+ return d.parse(false)
+ }
+ }
+
+ if d.dm.tags != nil {
+ // Parse to specified type if tag number is registered.
+ tagNums := []uint64{tagNum}
+ for d.nextCBORType() == cborTypeTag {
+ _, _, num := d.getHead()
+ tagNums = append(tagNums, num)
+ }
+ registeredType := d.dm.tags.getTypeFromTagNum(tagNums)
+ if registeredType != nil {
+ d.off = tagOff
+ rv := reflect.New(registeredType)
+ if err := d.parseToValue(rv.Elem(), getTypeInfo(registeredType)); err != nil {
+ return nil, err
+ }
+ return rv.Elem().Interface(), nil
+ }
+ }
+
+ // Parse tag content
+ d.off = contentOff
+ content, err := d.parse(false)
+ if err != nil {
+ return nil, err
+ }
+ if d.dm.unrecognizedTagToAny == UnrecognizedTagContentToAny {
+ return content, nil
+ }
+ return Tag{tagNum, content}, nil
+
+ case cborTypePrimitives:
+ _, ai, val := d.getHead()
+ if ai <= 24 && d.dm.simpleValues.rejected[SimpleValue(val)] {
+ return nil, &UnacceptableDataItemError{
+ CBORType: t.String(),
+ Message: "simple value " + strconv.FormatInt(int64(val), 10) + " is not recognized",
+ }
+ }
+ if ai < 20 || ai == 24 {
+ return SimpleValue(val), nil
+ }
+
+ switch ai {
+ case additionalInformationAsFalse,
+ additionalInformationAsTrue:
+ return (ai == additionalInformationAsTrue), nil
+
+ case additionalInformationAsNull,
+ additionalInformationAsUndefined:
+ return nil, nil
+
+ case additionalInformationAsFloat16:
+ f := float64(float16.Frombits(uint16(val)).Float32())
+ return f, nil
+
+ case additionalInformationAsFloat32:
+ f := float64(math.Float32frombits(uint32(val)))
+ return f, nil
+
+ case additionalInformationAsFloat64:
+ f := math.Float64frombits(val)
+ return f, nil
+ }
+
+ case cborTypeArray:
+ return d.parseArray()
+
+ case cborTypeMap:
+ if d.dm.defaultMapType != nil {
+ m := reflect.New(d.dm.defaultMapType)
+ err := d.parseToValue(m, getTypeInfo(m.Elem().Type()))
+ if err != nil {
+ return nil, err
+ }
+ return m.Elem().Interface(), nil
+ }
+ return d.parseMap()
+ }
+
+ return nil, nil
+}
+
+// parseByteString parses a CBOR encoded byte string. The returned byte slice
+// may be backed directly by the input. The second return value will be true if
+// and only if the slice is backed by a copy of the input. Callers are
+// responsible for making a copy if necessary.
+func (d *decoder) parseByteString() ([]byte, bool) {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ if !indefiniteLength {
+ b := d.data[d.off : d.off+int(val)]
+ d.off += int(val)
+ return b, false
+ }
+ // Process indefinite length string chunks.
+ b := []byte{}
+ for !d.foundBreak() {
+ _, _, val = d.getHead()
+ b = append(b, d.data[d.off:d.off+int(val)]...)
+ d.off += int(val)
+ }
+ return b, true
+}
+
+// applyByteStringTextConversion converts bytes read from a byte string to or from a configured text
+// encoding. If no transformation was performed (because it was not required), the original byte
+// slice is returned and the bool return value is false. Otherwise, a new slice containing the
+// converted bytes is returned along with the bool value true.
+func (d *decoder) applyByteStringTextConversion(
+ src []byte,
+ dstType reflect.Type,
+) (
+ dst []byte,
+ transformed bool,
+ err error,
+) {
+ switch dstType.Kind() {
+ case reflect.String:
+ if d.dm.byteStringToString != ByteStringToStringAllowedWithExpectedLaterEncoding || len(d.expectedLaterEncodingTags) == 0 {
+ return src, false, nil
+ }
+
+ switch d.expectedLaterEncodingTags[len(d.expectedLaterEncodingTags)-1] {
+ case tagNumExpectedLaterEncodingBase64URL:
+ encoded := make([]byte, base64.RawURLEncoding.EncodedLen(len(src)))
+ base64.RawURLEncoding.Encode(encoded, src)
+ return encoded, true, nil
+
+ case tagNumExpectedLaterEncodingBase64:
+ encoded := make([]byte, base64.StdEncoding.EncodedLen(len(src)))
+ base64.StdEncoding.Encode(encoded, src)
+ return encoded, true, nil
+
+ case tagNumExpectedLaterEncodingBase16:
+ encoded := make([]byte, hex.EncodedLen(len(src)))
+ hex.Encode(encoded, src)
+ return encoded, true, nil
+
+ default:
+ // If this happens, there is a bug: the decoder has pushed an invalid
+ // "expected later encoding" tag to the stack.
+ panic(fmt.Sprintf("unrecognized expected later encoding tag: %d", d.expectedLaterEncodingTags))
+ }
+
+ case reflect.Slice:
+ if dstType.Elem().Kind() != reflect.Uint8 || len(d.expectedLaterEncodingTags) > 0 {
+ // Either the destination is not a slice of bytes, or the encoder that
+ // produced the input indicated an expected text encoding tag and therefore
+ // the content of the byte string has NOT been text encoded.
+ return src, false, nil
+ }
+
+ switch d.dm.byteStringExpectedFormat {
+ case ByteStringExpectedBase64URL:
+ decoded := make([]byte, base64.RawURLEncoding.DecodedLen(len(src)))
+ n, err := base64.RawURLEncoding.Decode(decoded, src)
+ if err != nil {
+ return nil, false, newByteStringExpectedFormatError(ByteStringExpectedBase64URL, err)
+ }
+ return decoded[:n], true, nil
+
+ case ByteStringExpectedBase64:
+ decoded := make([]byte, base64.StdEncoding.DecodedLen(len(src)))
+ n, err := base64.StdEncoding.Decode(decoded, src)
+ if err != nil {
+ return nil, false, newByteStringExpectedFormatError(ByteStringExpectedBase64, err)
+ }
+ return decoded[:n], true, nil
+
+ case ByteStringExpectedBase16:
+ decoded := make([]byte, hex.DecodedLen(len(src)))
+ n, err := hex.Decode(decoded, src)
+ if err != nil {
+ return nil, false, newByteStringExpectedFormatError(ByteStringExpectedBase16, err)
+ }
+ return decoded[:n], true, nil
+ }
+ }
+
+ return src, false, nil
+}
+
+// parseTextString parses CBOR encoded text string. It returns a byte slice
+// to prevent creating an extra copy of string. Caller should wrap returned
+// byte slice as string when needed.
+func (d *decoder) parseTextString() ([]byte, error) {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ if !indefiniteLength {
+ b := d.data[d.off : d.off+int(val)]
+ d.off += int(val)
+ if d.dm.utf8 == UTF8RejectInvalid && !utf8.Valid(b) {
+ return nil, &SemanticError{"cbor: invalid UTF-8 string"}
+ }
+ return b, nil
+ }
+ // Process indefinite length string chunks.
+ b := []byte{}
+ for !d.foundBreak() {
+ _, _, val = d.getHead()
+ x := d.data[d.off : d.off+int(val)]
+ d.off += int(val)
+ if d.dm.utf8 == UTF8RejectInvalid && !utf8.Valid(x) {
+ for !d.foundBreak() {
+ d.skip() // Skip remaining chunk on error
+ }
+ return nil, &SemanticError{"cbor: invalid UTF-8 string"}
+ }
+ b = append(b, x...)
+ }
+ return b, nil
+}
+
+func (d *decoder) parseArray() ([]interface{}, error) {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ if !hasSize {
+ count = d.numOfItemsUntilBreak() // peek ahead to get array size to preallocate slice for better performance
+ }
+ v := make([]interface{}, count)
+ var e interface{}
+ var err, lastErr error
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ if e, lastErr = d.parse(true); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ continue
+ }
+ v[i] = e
+ }
+ return v, err
+}
+
+func (d *decoder) parseArrayToSlice(v reflect.Value, tInfo *typeInfo) error {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ if !hasSize {
+ count = d.numOfItemsUntilBreak() // peek ahead to get array size to preallocate slice for better performance
+ }
+ if v.IsNil() || v.Cap() < count || count == 0 {
+ v.Set(reflect.MakeSlice(tInfo.nonPtrType, count, count))
+ }
+ v.SetLen(count)
+ var err error
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ if lastErr := d.parseToValue(v.Index(i), tInfo.elemTypeInfo); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ }
+ }
+ return err
+}
+
+func (d *decoder) parseArrayToArray(v reflect.Value, tInfo *typeInfo) error {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ gi := 0
+ vLen := v.Len()
+ var err error
+ for ci := 0; (hasSize && ci < count) || (!hasSize && !d.foundBreak()); ci++ {
+ if gi < vLen {
+ // Read CBOR array element and set array element
+ if lastErr := d.parseToValue(v.Index(gi), tInfo.elemTypeInfo); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ }
+ gi++
+ } else {
+ d.skip() // Skip remaining CBOR array element
+ }
+ }
+ // Set remaining Go array elements to zero values.
+ if gi < vLen {
+ zeroV := reflect.Zero(tInfo.elemTypeInfo.typ)
+ for ; gi < vLen; gi++ {
+ v.Index(gi).Set(zeroV)
+ }
+ }
+ return err
+}
+
+func (d *decoder) parseMap() (interface{}, error) {
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ m := make(map[interface{}]interface{})
+ var k, e interface{}
+ var err, lastErr error
+ keyCount := 0
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ // Parse CBOR map key.
+ if k, lastErr = d.parse(true); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ d.skip()
+ continue
+ }
+
+ // Detect if CBOR map key can be used as Go map key.
+ rv := reflect.ValueOf(k)
+ if !isHashableValue(rv) {
+ var converted bool
+ if d.dm.mapKeyByteString == MapKeyByteStringAllowed {
+ k, converted = convertByteSliceToByteString(k)
+ }
+ if !converted {
+ if err == nil {
+ err = &InvalidMapKeyTypeError{rv.Type().String()}
+ }
+ d.skip()
+ continue
+ }
+ }
+
+ // Parse CBOR map value.
+ if e, lastErr = d.parse(true); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ continue
+ }
+
+ // Add key-value pair to Go map.
+ m[k] = e
+
+ // Detect duplicate map key.
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ newKeyCount := len(m)
+ if newKeyCount == keyCount {
+ m[k] = nil
+ err = &DupMapKeyError{k, i}
+ i++
+ // skip the rest of the map
+ for ; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ d.skip() // Skip map key
+ d.skip() // Skip map value
+ }
+ return m, err
+ }
+ keyCount = newKeyCount
+ }
+ }
+ return m, err
+}
+
+func (d *decoder) parseMapToMap(v reflect.Value, tInfo *typeInfo) error { //nolint:gocyclo
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ if v.IsNil() {
+ mapsize := count
+ if !hasSize {
+ mapsize = 0
+ }
+ v.Set(reflect.MakeMapWithSize(tInfo.nonPtrType, mapsize))
+ }
+ keyType, eleType := tInfo.keyTypeInfo.typ, tInfo.elemTypeInfo.typ
+ reuseKey, reuseEle := isImmutableKind(tInfo.keyTypeInfo.kind), isImmutableKind(tInfo.elemTypeInfo.kind)
+ var keyValue, eleValue, zeroKeyValue, zeroEleValue reflect.Value
+ keyIsInterfaceType := keyType == typeIntf // If key type is interface{}, need to check if key value is hashable.
+ var err, lastErr error
+ keyCount := v.Len()
+ var existingKeys map[interface{}]bool // Store existing map keys, used for detecting duplicate map key.
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ existingKeys = make(map[interface{}]bool, keyCount)
+ if keyCount > 0 {
+ vKeys := v.MapKeys()
+ for i := 0; i < len(vKeys); i++ {
+ existingKeys[vKeys[i].Interface()] = true
+ }
+ }
+ }
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ // Parse CBOR map key.
+ if !keyValue.IsValid() {
+ keyValue = reflect.New(keyType).Elem()
+ } else if !reuseKey {
+ if !zeroKeyValue.IsValid() {
+ zeroKeyValue = reflect.Zero(keyType)
+ }
+ keyValue.Set(zeroKeyValue)
+ }
+ if lastErr = d.parseToValue(keyValue, tInfo.keyTypeInfo); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ d.skip()
+ continue
+ }
+
+ // Detect if CBOR map key can be used as Go map key.
+ if keyIsInterfaceType && keyValue.Elem().IsValid() {
+ if !isHashableValue(keyValue.Elem()) {
+ var converted bool
+ if d.dm.mapKeyByteString == MapKeyByteStringAllowed {
+ var k interface{}
+ k, converted = convertByteSliceToByteString(keyValue.Elem().Interface())
+ if converted {
+ keyValue.Set(reflect.ValueOf(k))
+ }
+ }
+ if !converted {
+ if err == nil {
+ err = &InvalidMapKeyTypeError{keyValue.Elem().Type().String()}
+ }
+ d.skip()
+ continue
+ }
+ }
+ }
+
+ // Parse CBOR map value.
+ if !eleValue.IsValid() {
+ eleValue = reflect.New(eleType).Elem()
+ } else if !reuseEle {
+ if !zeroEleValue.IsValid() {
+ zeroEleValue = reflect.Zero(eleType)
+ }
+ eleValue.Set(zeroEleValue)
+ }
+ if lastErr := d.parseToValue(eleValue, tInfo.elemTypeInfo); lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ continue
+ }
+
+ // Add key-value pair to Go map.
+ v.SetMapIndex(keyValue, eleValue)
+
+ // Detect duplicate map key.
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ newKeyCount := v.Len()
+ if newKeyCount == keyCount {
+ kvi := keyValue.Interface()
+ if !existingKeys[kvi] {
+ v.SetMapIndex(keyValue, reflect.New(eleType).Elem())
+ err = &DupMapKeyError{kvi, i}
+ i++
+ // skip the rest of the map
+ for ; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ d.skip() // skip map key
+ d.skip() // skip map value
+ }
+ return err
+ }
+ delete(existingKeys, kvi)
+ }
+ keyCount = newKeyCount
+ }
+ }
+ return err
+}
+
+func (d *decoder) parseArrayToStruct(v reflect.Value, tInfo *typeInfo) error {
+ structType := getDecodingStructType(tInfo.nonPtrType)
+ if structType.err != nil {
+ return structType.err
+ }
+
+ if !structType.toArray {
+ t := d.nextCBORType()
+ d.skip()
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: "cannot decode CBOR array to struct without toarray option",
+ }
+ }
+
+ start := d.off
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+ if !hasSize {
+ count = d.numOfItemsUntilBreak() // peek ahead to get array size
+ }
+ if count != len(structType.fields) {
+ d.off = start
+ d.skip()
+ return &UnmarshalTypeError{
+ CBORType: cborTypeArray.String(),
+ GoType: tInfo.typ.String(),
+ errorMsg: "cannot decode CBOR array to struct with different number of elements",
+ }
+ }
+ var err, lastErr error
+ for i := 0; (hasSize && i < count) || (!hasSize && !d.foundBreak()); i++ {
+ f := structType.fields[i]
+
+ // Get field value by index
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ fv, lastErr = getFieldValue(v, f.idx, func(v reflect.Value) (reflect.Value, error) {
+ // Return a new value for embedded field null pointer to point to, or return error.
+ if !v.CanSet() {
+ return reflect.Value{}, errors.New("cbor: cannot set embedded pointer to unexported struct: " + v.Type().String())
+ }
+ v.Set(reflect.New(v.Type().Elem()))
+ return v, nil
+ })
+ if lastErr != nil && err == nil {
+ err = lastErr
+ }
+ if !fv.IsValid() {
+ d.skip()
+ continue
+ }
+ }
+
+ if lastErr = d.parseToValue(fv, f.typInfo); lastErr != nil {
+ if err == nil {
+ if typeError, ok := lastErr.(*UnmarshalTypeError); ok {
+ typeError.StructFieldName = tInfo.typ.String() + "." + f.name
+ err = typeError
+ } else {
+ err = lastErr
+ }
+ }
+ }
+ }
+ return err
+}
+
+// parseMapToStruct needs to be fast so gocyclo can be ignored for now.
+func (d *decoder) parseMapToStruct(v reflect.Value, tInfo *typeInfo) error { //nolint:gocyclo
+ structType := getDecodingStructType(tInfo.nonPtrType)
+ if structType.err != nil {
+ return structType.err
+ }
+
+ if structType.toArray {
+ t := d.nextCBORType()
+ d.skip()
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: tInfo.nonPtrType.String(),
+ errorMsg: "cannot decode CBOR map to struct with toarray option",
+ }
+ }
+
+ var err, lastErr error
+
+ // Get CBOR map size
+ _, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+ hasSize := !indefiniteLength
+ count := int(val)
+
+ // Keeps track of matched struct fields
+ var foundFldIdx []bool
+ {
+ const maxStackFields = 128
+ if nfields := len(structType.fields); nfields <= maxStackFields {
+ // For structs with typical field counts, expect that this can be
+ // stack-allocated.
+ var a [maxStackFields]bool
+ foundFldIdx = a[:nfields]
+ } else {
+ foundFldIdx = make([]bool, len(structType.fields))
+ }
+ }
+
+ // Keeps track of CBOR map keys to detect duplicate map key
+ keyCount := 0
+ var mapKeys map[interface{}]struct{}
+
+ errOnUnknownField := (d.dm.extraReturnErrors & ExtraDecErrorUnknownField) > 0
+
+MapEntryLoop:
+ for j := 0; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ var f *field
+
+ // If duplicate field detection is enabled and the key at index j did not match any
+ // field, k will hold the map key.
+ var k interface{}
+
+ t := d.nextCBORType()
+ if t == cborTypeTextString || (t == cborTypeByteString && d.dm.fieldNameByteString == FieldNameByteStringAllowed) {
+ var keyBytes []byte
+ if t == cborTypeTextString {
+ keyBytes, lastErr = d.parseTextString()
+ if lastErr != nil {
+ if err == nil {
+ err = lastErr
+ }
+ d.skip() // skip value
+ continue
+ }
+ } else { // cborTypeByteString
+ keyBytes, _ = d.parseByteString()
+ }
+
+ // Check for exact match on field name.
+ if i, ok := structType.fieldIndicesByName[string(keyBytes)]; ok {
+ fld := structType.fields[i]
+
+ if !foundFldIdx[i] {
+ f = fld
+ foundFldIdx[i] = true
+ } else if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ err = &DupMapKeyError{fld.name, j}
+ d.skip() // skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ } else {
+ // discard repeated match
+ d.skip()
+ continue MapEntryLoop
+ }
+ }
+
+ // Find field with case-insensitive match
+ if f == nil && d.dm.fieldNameMatching == FieldNameMatchingPreferCaseSensitive {
+ keyLen := len(keyBytes)
+ keyString := string(keyBytes)
+ for i := 0; i < len(structType.fields); i++ {
+ fld := structType.fields[i]
+ if len(fld.name) == keyLen && strings.EqualFold(fld.name, keyString) {
+ if !foundFldIdx[i] {
+ f = fld
+ foundFldIdx[i] = true
+ } else if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ err = &DupMapKeyError{keyString, j}
+ d.skip() // skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ } else {
+ // discard repeated match
+ d.skip()
+ continue MapEntryLoop
+ }
+ break
+ }
+ }
+ }
+
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF && f == nil {
+ k = string(keyBytes)
+ }
+ } else if t <= cborTypeNegativeInt { // uint/int
+ var nameAsInt int64
+
+ if t == cborTypePositiveInt {
+ _, _, val := d.getHead()
+ nameAsInt = int64(val)
+ } else {
+ _, _, val := d.getHead()
+ if val > math.MaxInt64 {
+ if err == nil {
+ err = &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: reflect.TypeOf(int64(0)).String(),
+ errorMsg: "-1-" + strconv.FormatUint(val, 10) + " overflows Go's int64",
+ }
+ }
+ d.skip() // skip value
+ continue
+ }
+ nameAsInt = int64(-1) ^ int64(val)
+ }
+
+ // Find field
+ for i := 0; i < len(structType.fields); i++ {
+ fld := structType.fields[i]
+ if fld.keyAsInt && fld.nameAsInt == nameAsInt {
+ if !foundFldIdx[i] {
+ f = fld
+ foundFldIdx[i] = true
+ } else if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ err = &DupMapKeyError{nameAsInt, j}
+ d.skip() // skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ } else {
+ // discard repeated match
+ d.skip()
+ continue MapEntryLoop
+ }
+ break
+ }
+ }
+
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF && f == nil {
+ k = nameAsInt
+ }
+ } else {
+ if err == nil {
+ err = &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: reflect.TypeOf("").String(),
+ errorMsg: "map key is of type " + t.String() + " and cannot be used to match struct field name",
+ }
+ }
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ // parse key
+ k, lastErr = d.parse(true)
+ if lastErr != nil {
+ d.skip() // skip value
+ continue
+ }
+ // Detect if CBOR map key can be used as Go map key.
+ if !isHashableValue(reflect.ValueOf(k)) {
+ d.skip() // skip value
+ continue
+ }
+ } else {
+ d.skip() // skip key
+ }
+ }
+
+ if f == nil {
+ if errOnUnknownField {
+ err = &UnknownFieldError{j}
+ d.skip() // Skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ }
+
+ // Two map keys that match the same struct field are immediately considered
+ // duplicates. This check detects duplicates between two map keys that do
+ // not match a struct field. If unknown field errors are enabled, then this
+ // check is never reached.
+ if d.dm.dupMapKey == DupMapKeyEnforcedAPF {
+ if mapKeys == nil {
+ mapKeys = make(map[interface{}]struct{}, 1)
+ }
+ mapKeys[k] = struct{}{}
+ newKeyCount := len(mapKeys)
+ if newKeyCount == keyCount {
+ err = &DupMapKeyError{k, j}
+ d.skip() // skip value
+ j++
+ // skip the rest of the map
+ for ; (hasSize && j < count) || (!hasSize && !d.foundBreak()); j++ {
+ d.skip()
+ d.skip()
+ }
+ return err
+ }
+ keyCount = newKeyCount
+ }
+
+ d.skip() // Skip value
+ continue
+ }
+
+ // Get field value by index
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ fv, lastErr = getFieldValue(v, f.idx, func(v reflect.Value) (reflect.Value, error) {
+ // Return a new value for embedded field null pointer to point to, or return error.
+ if !v.CanSet() {
+ return reflect.Value{}, errors.New("cbor: cannot set embedded pointer to unexported struct: " + v.Type().String())
+ }
+ v.Set(reflect.New(v.Type().Elem()))
+ return v, nil
+ })
+ if lastErr != nil && err == nil {
+ err = lastErr
+ }
+ if !fv.IsValid() {
+ d.skip()
+ continue
+ }
+ }
+
+ if lastErr = d.parseToValue(fv, f.typInfo); lastErr != nil {
+ if err == nil {
+ if typeError, ok := lastErr.(*UnmarshalTypeError); ok {
+ typeError.StructFieldName = tInfo.nonPtrType.String() + "." + f.name
+ err = typeError
+ } else {
+ err = lastErr
+ }
+ }
+ }
+ }
+ return err
+}
+
+// validRegisteredTagNums verifies that tag numbers match registered tag numbers of type t.
+// validRegisteredTagNums assumes next CBOR data type is tag. It scans all tag numbers, and stops at tag content.
+func (d *decoder) validRegisteredTagNums(registeredTag *tagItem) error {
+ // Scan until next cbor data is tag content.
+ tagNums := make([]uint64, 0, 1)
+ for d.nextCBORType() == cborTypeTag {
+ _, _, val := d.getHead()
+ tagNums = append(tagNums, val)
+ }
+
+ if !registeredTag.equalTagNum(tagNums) {
+ return &WrongTagError{registeredTag.contentType, registeredTag.num, tagNums}
+ }
+ return nil
+}
+
+func (d *decoder) getRegisteredTagItem(vt reflect.Type) *tagItem {
+ if d.dm.tags != nil {
+ return d.dm.tags.getTagItemFromType(vt)
+ }
+ return nil
+}
+
+// skip moves data offset to the next item. skip assumes data is well-formed,
+// and does not perform bounds checking.
+func (d *decoder) skip() {
+ t, _, val, indefiniteLength := d.getHeadWithIndefiniteLengthFlag()
+
+ if indefiniteLength {
+ switch t {
+ case cborTypeByteString, cborTypeTextString, cborTypeArray, cborTypeMap:
+ for {
+ if isBreakFlag(d.data[d.off]) {
+ d.off++
+ return
+ }
+ d.skip()
+ }
+ }
+ }
+
+ switch t {
+ case cborTypeByteString, cborTypeTextString:
+ d.off += int(val)
+
+ case cborTypeArray:
+ for i := 0; i < int(val); i++ {
+ d.skip()
+ }
+
+ case cborTypeMap:
+ for i := 0; i < int(val)*2; i++ {
+ d.skip()
+ }
+
+ case cborTypeTag:
+ d.skip()
+ }
+}
+
+func (d *decoder) getHeadWithIndefiniteLengthFlag() (
+ t cborType,
+ ai byte,
+ val uint64,
+ indefiniteLength bool,
+) {
+ t, ai, val = d.getHead()
+ indefiniteLength = additionalInformation(ai).isIndefiniteLength()
+ return
+}
+
+// getHead assumes data is well-formed, and does not perform bounds checking.
+func (d *decoder) getHead() (t cborType, ai byte, val uint64) {
+ t, ai = parseInitialByte(d.data[d.off])
+ val = uint64(ai)
+ d.off++
+
+ if ai <= maxAdditionalInformationWithoutArgument {
+ return
+ }
+
+ if ai == additionalInformationWith1ByteArgument {
+ val = uint64(d.data[d.off])
+ d.off++
+ return
+ }
+
+ if ai == additionalInformationWith2ByteArgument {
+ const argumentSize = 2
+ val = uint64(binary.BigEndian.Uint16(d.data[d.off : d.off+argumentSize]))
+ d.off += argumentSize
+ return
+ }
+
+ if ai == additionalInformationWith4ByteArgument {
+ const argumentSize = 4
+ val = uint64(binary.BigEndian.Uint32(d.data[d.off : d.off+argumentSize]))
+ d.off += argumentSize
+ return
+ }
+
+ if ai == additionalInformationWith8ByteArgument {
+ const argumentSize = 8
+ val = binary.BigEndian.Uint64(d.data[d.off : d.off+argumentSize])
+ d.off += argumentSize
+ return
+ }
+ return
+}
+
+func (d *decoder) numOfItemsUntilBreak() int {
+ savedOff := d.off
+ i := 0
+ for !d.foundBreak() {
+ d.skip()
+ i++
+ }
+ d.off = savedOff
+ return i
+}
+
+// foundBreak returns true if next byte is CBOR break code and moves cursor by 1,
+// otherwise it returns false.
+// foundBreak assumes data is well-formed, and does not perform bounds checking.
+func (d *decoder) foundBreak() bool {
+ if isBreakFlag(d.data[d.off]) {
+ d.off++
+ return true
+ }
+ return false
+}
+
+func (d *decoder) reset(data []byte) {
+ d.data = data
+ d.off = 0
+ d.expectedLaterEncodingTags = d.expectedLaterEncodingTags[:0]
+}
+
+func (d *decoder) nextCBORType() cborType {
+ return getType(d.data[d.off])
+}
+
+func (d *decoder) nextCBORNil() bool {
+ return d.data[d.off] == 0xf6 || d.data[d.off] == 0xf7
+}
+
+var (
+ typeIntf = reflect.TypeOf([]interface{}(nil)).Elem()
+ typeTime = reflect.TypeOf(time.Time{})
+ typeBigInt = reflect.TypeOf(big.Int{})
+ typeUnmarshaler = reflect.TypeOf((*Unmarshaler)(nil)).Elem()
+ typeBinaryUnmarshaler = reflect.TypeOf((*encoding.BinaryUnmarshaler)(nil)).Elem()
+ typeString = reflect.TypeOf("")
+ typeByteSlice = reflect.TypeOf([]byte(nil))
+)
+
+func fillNil(_ cborType, v reflect.Value) error {
+ switch v.Kind() {
+ case reflect.Slice, reflect.Map, reflect.Interface, reflect.Ptr:
+ v.Set(reflect.Zero(v.Type()))
+ return nil
+ }
+ return nil
+}
+
+func fillPositiveInt(t cborType, val uint64, v reflect.Value) error {
+ switch v.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ if val > math.MaxInt64 {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatUint(val, 10) + " overflows " + v.Type().String(),
+ }
+ }
+ if v.OverflowInt(int64(val)) {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatUint(val, 10) + " overflows " + v.Type().String(),
+ }
+ }
+ v.SetInt(int64(val))
+ return nil
+
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ if v.OverflowUint(val) {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatUint(val, 10) + " overflows " + v.Type().String(),
+ }
+ }
+ v.SetUint(val)
+ return nil
+
+ case reflect.Float32, reflect.Float64:
+ f := float64(val)
+ v.SetFloat(f)
+ return nil
+ }
+
+ if v.Type() == typeBigInt {
+ i := new(big.Int).SetUint64(val)
+ v.Set(reflect.ValueOf(*i))
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillNegativeInt(t cborType, val int64, v reflect.Value) error {
+ switch v.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ if v.OverflowInt(val) {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatInt(val, 10) + " overflows " + v.Type().String(),
+ }
+ }
+ v.SetInt(val)
+ return nil
+
+ case reflect.Float32, reflect.Float64:
+ f := float64(val)
+ v.SetFloat(f)
+ return nil
+ }
+ if v.Type() == typeBigInt {
+ i := new(big.Int).SetInt64(val)
+ v.Set(reflect.ValueOf(*i))
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillBool(t cborType, val bool, v reflect.Value) error {
+ if v.Kind() == reflect.Bool {
+ v.SetBool(val)
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillFloat(t cborType, val float64, v reflect.Value) error {
+ switch v.Kind() {
+ case reflect.Float32, reflect.Float64:
+ if v.OverflowFloat(val) {
+ return &UnmarshalTypeError{
+ CBORType: t.String(),
+ GoType: v.Type().String(),
+ errorMsg: strconv.FormatFloat(val, 'E', -1, 64) + " overflows " + v.Type().String(),
+ }
+ }
+ v.SetFloat(val)
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillByteString(t cborType, val []byte, shared bool, v reflect.Value, bsts ByteStringToStringMode, bum BinaryUnmarshalerMode) error {
+ if bum == BinaryUnmarshalerByteString && reflect.PtrTo(v.Type()).Implements(typeBinaryUnmarshaler) {
+ if v.CanAddr() {
+ v = v.Addr()
+ if u, ok := v.Interface().(encoding.BinaryUnmarshaler); ok {
+ // The contract of BinaryUnmarshaler forbids
+ // retaining the input bytes, so no copying is
+ // required even if val is shared.
+ return u.UnmarshalBinary(val)
+ }
+ }
+ return errors.New("cbor: cannot set new value for " + v.Type().String())
+ }
+ if bsts != ByteStringToStringForbidden && v.Kind() == reflect.String {
+ v.SetString(string(val))
+ return nil
+ }
+ if v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 {
+ src := val
+ if shared {
+ // SetBytes shares the underlying bytes of the source slice.
+ src = make([]byte, len(val))
+ copy(src, val)
+ }
+ v.SetBytes(src)
+ return nil
+ }
+ if v.Kind() == reflect.Array && v.Type().Elem().Kind() == reflect.Uint8 {
+ vLen := v.Len()
+ i := 0
+ for ; i < vLen && i < len(val); i++ {
+ v.Index(i).SetUint(uint64(val[i]))
+ }
+ // Set remaining Go array elements to zero values.
+ if i < vLen {
+ zeroV := reflect.Zero(reflect.TypeOf(byte(0)))
+ for ; i < vLen; i++ {
+ v.Index(i).Set(zeroV)
+ }
+ }
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func fillTextString(t cborType, val []byte, v reflect.Value) error {
+ if v.Kind() == reflect.String {
+ v.SetString(string(val))
+ return nil
+ }
+ return &UnmarshalTypeError{CBORType: t.String(), GoType: v.Type().String()}
+}
+
+func isImmutableKind(k reflect.Kind) bool {
+ switch k {
+ case reflect.Bool,
+ reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
+ reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
+ reflect.Float32, reflect.Float64,
+ reflect.String:
+ return true
+
+ default:
+ return false
+ }
+}
+
+func isHashableValue(rv reflect.Value) bool {
+ switch rv.Kind() {
+ case reflect.Slice, reflect.Map, reflect.Func:
+ return false
+
+ case reflect.Struct:
+ switch rv.Type() {
+ case typeTag:
+ tag := rv.Interface().(Tag)
+ return isHashableValue(reflect.ValueOf(tag.Content))
+ case typeBigInt:
+ return false
+ }
+ }
+ return true
+}
+
+// convertByteSliceToByteString converts []byte to ByteString if
+// - v is []byte type, or
+// - v is Tag type and tag content type is []byte
+// This function also handles nested tags.
+// CBOR data is already verified to be well-formed before this function is used,
+// so the recursion won't exceed max nested levels.
+func convertByteSliceToByteString(v interface{}) (interface{}, bool) {
+ switch v := v.(type) {
+ case []byte:
+ return ByteString(v), true
+
+ case Tag:
+ content, converted := convertByteSliceToByteString(v.Content)
+ if converted {
+ return Tag{Number: v.Number, Content: content}, true
+ }
+ }
+ return v, false
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/diagnose.go b/vendor/github.com/fxamacker/cbor/v2/diagnose.go
new file mode 100644
index 000000000..44afb8660
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/diagnose.go
@@ -0,0 +1,724 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "bytes"
+ "encoding/base32"
+ "encoding/base64"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "math/big"
+ "strconv"
+ "unicode/utf16"
+ "unicode/utf8"
+
+ "github.com/x448/float16"
+)
+
+// DiagMode is the main interface for CBOR diagnostic notation.
+type DiagMode interface {
+ // Diagnose returns extended diagnostic notation (EDN) of CBOR data items using this DiagMode.
+ Diagnose([]byte) (string, error)
+
+ // DiagnoseFirst returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
+ DiagnoseFirst([]byte) (string, []byte, error)
+
+ // DiagOptions returns user specified options used to create this DiagMode.
+ DiagOptions() DiagOptions
+}
+
+// ByteStringEncoding specifies the base encoding that byte strings are notated.
+type ByteStringEncoding uint8
+
+const (
+ // ByteStringBase16Encoding encodes byte strings in base16, without padding.
+ ByteStringBase16Encoding ByteStringEncoding = iota
+
+ // ByteStringBase32Encoding encodes byte strings in base32, without padding.
+ ByteStringBase32Encoding
+
+ // ByteStringBase32HexEncoding encodes byte strings in base32hex, without padding.
+ ByteStringBase32HexEncoding
+
+ // ByteStringBase64Encoding encodes byte strings in base64url, without padding.
+ ByteStringBase64Encoding
+
+ maxByteStringEncoding
+)
+
+func (bse ByteStringEncoding) valid() error {
+ if bse >= maxByteStringEncoding {
+ return errors.New("cbor: invalid ByteStringEncoding " + strconv.Itoa(int(bse)))
+ }
+ return nil
+}
+
+// DiagOptions specifies Diag options.
+type DiagOptions struct {
+ // ByteStringEncoding specifies the base encoding that byte strings are notated.
+ // Default is ByteStringBase16Encoding.
+ ByteStringEncoding ByteStringEncoding
+
+ // ByteStringHexWhitespace specifies notating with whitespace in byte string
+ // when ByteStringEncoding is ByteStringBase16Encoding.
+ ByteStringHexWhitespace bool
+
+ // ByteStringText specifies notating with text in byte string
+ // if it is a valid UTF-8 text.
+ ByteStringText bool
+
+ // ByteStringEmbeddedCBOR specifies notating embedded CBOR in byte string
+ // if it is a valid CBOR bytes.
+ ByteStringEmbeddedCBOR bool
+
+ // CBORSequence specifies notating CBOR sequences.
+ // otherwise, it returns an error if there are more bytes after the first CBOR.
+ CBORSequence bool
+
+ // FloatPrecisionIndicator specifies appending a suffix to indicate float precision.
+ // Refer to https://www.rfc-editor.org/rfc/rfc8949.html#name-encoding-indicators.
+ FloatPrecisionIndicator bool
+
+ // MaxNestedLevels specifies the max nested levels allowed for any combination of CBOR array, maps, and tags.
+ // Default is 32 levels and it can be set to [4, 65535]. Note that higher maximum levels of nesting can
+ // require larger amounts of stack to deserialize. Don't increase this higher than you require.
+ MaxNestedLevels int
+
+ // MaxArrayElements specifies the max number of elements for CBOR arrays.
+ // Default is 128*1024=131072 and it can be set to [16, 2147483647]
+ MaxArrayElements int
+
+ // MaxMapPairs specifies the max number of key-value pairs for CBOR maps.
+ // Default is 128*1024=131072 and it can be set to [16, 2147483647]
+ MaxMapPairs int
+}
+
+// DiagMode returns a DiagMode with immutable options.
+func (opts DiagOptions) DiagMode() (DiagMode, error) {
+ return opts.diagMode()
+}
+
+func (opts DiagOptions) diagMode() (*diagMode, error) {
+ if err := opts.ByteStringEncoding.valid(); err != nil {
+ return nil, err
+ }
+
+ decMode, err := DecOptions{
+ MaxNestedLevels: opts.MaxNestedLevels,
+ MaxArrayElements: opts.MaxArrayElements,
+ MaxMapPairs: opts.MaxMapPairs,
+ }.decMode()
+ if err != nil {
+ return nil, err
+ }
+
+ return &diagMode{
+ byteStringEncoding: opts.ByteStringEncoding,
+ byteStringHexWhitespace: opts.ByteStringHexWhitespace,
+ byteStringText: opts.ByteStringText,
+ byteStringEmbeddedCBOR: opts.ByteStringEmbeddedCBOR,
+ cborSequence: opts.CBORSequence,
+ floatPrecisionIndicator: opts.FloatPrecisionIndicator,
+ decMode: decMode,
+ }, nil
+}
+
+type diagMode struct {
+ byteStringEncoding ByteStringEncoding
+ byteStringHexWhitespace bool
+ byteStringText bool
+ byteStringEmbeddedCBOR bool
+ cborSequence bool
+ floatPrecisionIndicator bool
+ decMode *decMode
+}
+
+// DiagOptions returns user specified options used to create this DiagMode.
+func (dm *diagMode) DiagOptions() DiagOptions {
+ return DiagOptions{
+ ByteStringEncoding: dm.byteStringEncoding,
+ ByteStringHexWhitespace: dm.byteStringHexWhitespace,
+ ByteStringText: dm.byteStringText,
+ ByteStringEmbeddedCBOR: dm.byteStringEmbeddedCBOR,
+ CBORSequence: dm.cborSequence,
+ FloatPrecisionIndicator: dm.floatPrecisionIndicator,
+ MaxNestedLevels: dm.decMode.maxNestedLevels,
+ MaxArrayElements: dm.decMode.maxArrayElements,
+ MaxMapPairs: dm.decMode.maxMapPairs,
+ }
+}
+
+// Diagnose returns extended diagnostic notation (EDN) of CBOR data items using the DiagMode.
+func (dm *diagMode) Diagnose(data []byte) (string, error) {
+ return newDiagnose(data, dm.decMode, dm).diag(dm.cborSequence)
+}
+
+// DiagnoseFirst returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
+func (dm *diagMode) DiagnoseFirst(data []byte) (diagNotation string, rest []byte, err error) {
+ return newDiagnose(data, dm.decMode, dm).diagFirst()
+}
+
+var defaultDiagMode, _ = DiagOptions{}.diagMode()
+
+// Diagnose returns extended diagnostic notation (EDN) of CBOR data items
+// using the default diagnostic mode.
+//
+// Refer to https://www.rfc-editor.org/rfc/rfc8949.html#name-diagnostic-notation.
+func Diagnose(data []byte) (string, error) {
+ return defaultDiagMode.Diagnose(data)
+}
+
+// Diagnose returns extended diagnostic notation (EDN) of the first CBOR data item using the DiagMode. Any remaining bytes are returned in rest.
+func DiagnoseFirst(data []byte) (diagNotation string, rest []byte, err error) {
+ return defaultDiagMode.DiagnoseFirst(data)
+}
+
+type diagnose struct {
+ dm *diagMode
+ d *decoder
+ w *bytes.Buffer
+}
+
+func newDiagnose(data []byte, decm *decMode, diagm *diagMode) *diagnose {
+ return &diagnose{
+ dm: diagm,
+ d: &decoder{data: data, dm: decm},
+ w: &bytes.Buffer{},
+ }
+}
+
+func (di *diagnose) diag(cborSequence bool) (string, error) {
+ // CBOR Sequence
+ firstItem := true
+ for {
+ switch err := di.wellformed(cborSequence); err {
+ case nil:
+ if !firstItem {
+ di.w.WriteString(", ")
+ }
+ firstItem = false
+ if itemErr := di.item(); itemErr != nil {
+ return di.w.String(), itemErr
+ }
+
+ case io.EOF:
+ if firstItem {
+ return di.w.String(), err
+ }
+ return di.w.String(), nil
+
+ default:
+ return di.w.String(), err
+ }
+ }
+}
+
+func (di *diagnose) diagFirst() (diagNotation string, rest []byte, err error) {
+ err = di.wellformed(true)
+ if err == nil {
+ err = di.item()
+ }
+
+ if err == nil {
+ // Return EDN and the rest of the data slice (which might be len 0)
+ return di.w.String(), di.d.data[di.d.off:], nil
+ }
+
+ return di.w.String(), nil, err
+}
+
+func (di *diagnose) wellformed(allowExtraData bool) error {
+ off := di.d.off
+ err := di.d.wellformed(allowExtraData, false)
+ di.d.off = off
+ return err
+}
+
+func (di *diagnose) item() error { //nolint:gocyclo
+ initialByte := di.d.data[di.d.off]
+ switch initialByte {
+ case cborByteStringWithIndefiniteLengthHead,
+ cborTextStringWithIndefiniteLengthHead: // indefinite-length byte/text string
+ di.d.off++
+ if isBreakFlag(di.d.data[di.d.off]) {
+ di.d.off++
+ switch initialByte {
+ case cborByteStringWithIndefiniteLengthHead:
+ // indefinite-length bytes with no chunks.
+ di.w.WriteString(`''_`)
+ return nil
+ case cborTextStringWithIndefiniteLengthHead:
+ // indefinite-length text with no chunks.
+ di.w.WriteString(`""_`)
+ return nil
+ }
+ }
+
+ di.w.WriteString("(_ ")
+
+ i := 0
+ for !di.d.foundBreak() {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+
+ i++
+ // wellformedIndefiniteString() already checked that the next item is a byte/text string.
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+
+ di.w.WriteByte(')')
+ return nil
+
+ case cborArrayWithIndefiniteLengthHead: // indefinite-length array
+ di.d.off++
+ di.w.WriteString("[_ ")
+
+ i := 0
+ for !di.d.foundBreak() {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+
+ i++
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+
+ di.w.WriteByte(']')
+ return nil
+
+ case cborMapWithIndefiniteLengthHead: // indefinite-length map
+ di.d.off++
+ di.w.WriteString("{_ ")
+
+ i := 0
+ for !di.d.foundBreak() {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+
+ i++
+ // key
+ if err := di.item(); err != nil {
+ return err
+ }
+
+ di.w.WriteString(": ")
+
+ // value
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+
+ di.w.WriteByte('}')
+ return nil
+ }
+
+ t := di.d.nextCBORType()
+ switch t {
+ case cborTypePositiveInt:
+ _, _, val := di.d.getHead()
+ di.w.WriteString(strconv.FormatUint(val, 10))
+ return nil
+
+ case cborTypeNegativeInt:
+ _, _, val := di.d.getHead()
+ if val > math.MaxInt64 {
+ // CBOR negative integer overflows int64, use big.Int to store value.
+ bi := new(big.Int)
+ bi.SetUint64(val)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+ di.w.WriteString(bi.String())
+ return nil
+ }
+
+ nValue := int64(-1) ^ int64(val)
+ di.w.WriteString(strconv.FormatInt(nValue, 10))
+ return nil
+
+ case cborTypeByteString:
+ b, _ := di.d.parseByteString()
+ return di.encodeByteString(b)
+
+ case cborTypeTextString:
+ b, err := di.d.parseTextString()
+ if err != nil {
+ return err
+ }
+ return di.encodeTextString(string(b), '"')
+
+ case cborTypeArray:
+ _, _, val := di.d.getHead()
+ count := int(val)
+ di.w.WriteByte('[')
+
+ for i := 0; i < count; i++ {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+ di.w.WriteByte(']')
+ return nil
+
+ case cborTypeMap:
+ _, _, val := di.d.getHead()
+ count := int(val)
+ di.w.WriteByte('{')
+
+ for i := 0; i < count; i++ {
+ if i > 0 {
+ di.w.WriteString(", ")
+ }
+ // key
+ if err := di.item(); err != nil {
+ return err
+ }
+ di.w.WriteString(": ")
+ // value
+ if err := di.item(); err != nil {
+ return err
+ }
+ }
+ di.w.WriteByte('}')
+ return nil
+
+ case cborTypeTag:
+ _, _, tagNum := di.d.getHead()
+ switch tagNum {
+ case tagNumUnsignedBignum:
+ if nt := di.d.nextCBORType(); nt != cborTypeByteString {
+ return newInadmissibleTagContentTypeError(
+ tagNumUnsignedBignum,
+ "byte string",
+ nt.String())
+ }
+
+ b, _ := di.d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+ di.w.WriteString(bi.String())
+ return nil
+
+ case tagNumNegativeBignum:
+ if nt := di.d.nextCBORType(); nt != cborTypeByteString {
+ return newInadmissibleTagContentTypeError(
+ tagNumNegativeBignum,
+ "byte string",
+ nt.String(),
+ )
+ }
+
+ b, _ := di.d.parseByteString()
+ bi := new(big.Int).SetBytes(b)
+ bi.Add(bi, big.NewInt(1))
+ bi.Neg(bi)
+ di.w.WriteString(bi.String())
+ return nil
+
+ default:
+ di.w.WriteString(strconv.FormatUint(tagNum, 10))
+ di.w.WriteByte('(')
+ if err := di.item(); err != nil {
+ return err
+ }
+ di.w.WriteByte(')')
+ return nil
+ }
+
+ case cborTypePrimitives:
+ _, ai, val := di.d.getHead()
+ switch ai {
+ case additionalInformationAsFalse:
+ di.w.WriteString("false")
+ return nil
+
+ case additionalInformationAsTrue:
+ di.w.WriteString("true")
+ return nil
+
+ case additionalInformationAsNull:
+ di.w.WriteString("null")
+ return nil
+
+ case additionalInformationAsUndefined:
+ di.w.WriteString("undefined")
+ return nil
+
+ case additionalInformationAsFloat16,
+ additionalInformationAsFloat32,
+ additionalInformationAsFloat64:
+ return di.encodeFloat(ai, val)
+
+ default:
+ di.w.WriteString("simple(")
+ di.w.WriteString(strconv.FormatUint(val, 10))
+ di.w.WriteByte(')')
+ return nil
+ }
+ }
+
+ return nil
+}
+
+// writeU16 format a rune as "\uxxxx"
+func (di *diagnose) writeU16(val rune) {
+ di.w.WriteString("\\u")
+ var in [2]byte
+ in[0] = byte(val >> 8)
+ in[1] = byte(val)
+ sz := hex.EncodedLen(len(in))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ hex.Encode(dst, in[:])
+ di.w.Write(dst)
+}
+
+var rawBase32Encoding = base32.StdEncoding.WithPadding(base32.NoPadding)
+var rawBase32HexEncoding = base32.HexEncoding.WithPadding(base32.NoPadding)
+
+func (di *diagnose) encodeByteString(val []byte) error {
+ if len(val) > 0 {
+ if di.dm.byteStringText && utf8.Valid(val) {
+ return di.encodeTextString(string(val), '\'')
+ }
+
+ if di.dm.byteStringEmbeddedCBOR {
+ di2 := newDiagnose(val, di.dm.decMode, di.dm)
+ // should always notating embedded CBOR sequence.
+ if str, err := di2.diag(true); err == nil {
+ di.w.WriteString("<<")
+ di.w.WriteString(str)
+ di.w.WriteString(">>")
+ return nil
+ }
+ }
+ }
+
+ switch di.dm.byteStringEncoding {
+ case ByteStringBase16Encoding:
+ di.w.WriteString("h'")
+ if di.dm.byteStringHexWhitespace {
+ sz := hex.EncodedLen(len(val))
+ if len(val) > 0 {
+ sz += len(val) - 1
+ }
+ di.w.Grow(sz)
+
+ dst := di.w.Bytes()[di.w.Len():]
+ for i := range val {
+ if i > 0 {
+ dst = append(dst, ' ')
+ }
+ hex.Encode(dst[len(dst):len(dst)+2], val[i:i+1])
+ dst = dst[:len(dst)+2]
+ }
+ di.w.Write(dst)
+ } else {
+ sz := hex.EncodedLen(len(val))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ hex.Encode(dst, val)
+ di.w.Write(dst)
+ }
+ di.w.WriteByte('\'')
+ return nil
+
+ case ByteStringBase32Encoding:
+ di.w.WriteString("b32'")
+ sz := rawBase32Encoding.EncodedLen(len(val))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ rawBase32Encoding.Encode(dst, val)
+ di.w.Write(dst)
+ di.w.WriteByte('\'')
+ return nil
+
+ case ByteStringBase32HexEncoding:
+ di.w.WriteString("h32'")
+ sz := rawBase32HexEncoding.EncodedLen(len(val))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ rawBase32HexEncoding.Encode(dst, val)
+ di.w.Write(dst)
+ di.w.WriteByte('\'')
+ return nil
+
+ case ByteStringBase64Encoding:
+ di.w.WriteString("b64'")
+ sz := base64.RawURLEncoding.EncodedLen(len(val))
+ di.w.Grow(sz)
+ dst := di.w.Bytes()[di.w.Len() : di.w.Len()+sz]
+ base64.RawURLEncoding.Encode(dst, val)
+ di.w.Write(dst)
+ di.w.WriteByte('\'')
+ return nil
+
+ default:
+ // It should not be possible for users to construct a *diagMode with an invalid byte
+ // string encoding.
+ panic(fmt.Sprintf("diagmode has invalid ByteStringEncoding %v", di.dm.byteStringEncoding))
+ }
+}
+
+const utf16SurrSelf = rune(0x10000)
+
+// quote should be either `'` or `"`
+func (di *diagnose) encodeTextString(val string, quote byte) error {
+ di.w.WriteByte(quote)
+
+ for i := 0; i < len(val); {
+ if b := val[i]; b < utf8.RuneSelf {
+ switch {
+ case b == '\t', b == '\n', b == '\r', b == '\\', b == quote:
+ di.w.WriteByte('\\')
+
+ switch b {
+ case '\t':
+ b = 't'
+ case '\n':
+ b = 'n'
+ case '\r':
+ b = 'r'
+ }
+ di.w.WriteByte(b)
+
+ case b >= ' ' && b <= '~':
+ di.w.WriteByte(b)
+
+ default:
+ di.writeU16(rune(b))
+ }
+
+ i++
+ continue
+ }
+
+ c, size := utf8.DecodeRuneInString(val[i:])
+ switch {
+ case c == utf8.RuneError:
+ return &SemanticError{"cbor: invalid UTF-8 string"}
+
+ case c < utf16SurrSelf:
+ di.writeU16(c)
+
+ default:
+ c1, c2 := utf16.EncodeRune(c)
+ di.writeU16(c1)
+ di.writeU16(c2)
+ }
+
+ i += size
+ }
+
+ di.w.WriteByte(quote)
+ return nil
+}
+
+func (di *diagnose) encodeFloat(ai byte, val uint64) error {
+ f64 := float64(0)
+ switch ai {
+ case additionalInformationAsFloat16:
+ f16 := float16.Frombits(uint16(val))
+ switch {
+ case f16.IsNaN():
+ di.w.WriteString("NaN")
+ return nil
+ case f16.IsInf(1):
+ di.w.WriteString("Infinity")
+ return nil
+ case f16.IsInf(-1):
+ di.w.WriteString("-Infinity")
+ return nil
+ default:
+ f64 = float64(f16.Float32())
+ }
+
+ case additionalInformationAsFloat32:
+ f32 := math.Float32frombits(uint32(val))
+ switch {
+ case f32 != f32:
+ di.w.WriteString("NaN")
+ return nil
+ case f32 > math.MaxFloat32:
+ di.w.WriteString("Infinity")
+ return nil
+ case f32 < -math.MaxFloat32:
+ di.w.WriteString("-Infinity")
+ return nil
+ default:
+ f64 = float64(f32)
+ }
+
+ case additionalInformationAsFloat64:
+ f64 = math.Float64frombits(val)
+ switch {
+ case f64 != f64:
+ di.w.WriteString("NaN")
+ return nil
+ case f64 > math.MaxFloat64:
+ di.w.WriteString("Infinity")
+ return nil
+ case f64 < -math.MaxFloat64:
+ di.w.WriteString("-Infinity")
+ return nil
+ }
+ }
+ // Use ES6 number to string conversion which should match most JSON generators.
+ // Inspired by https://github.com/golang/go/blob/4df10fba1687a6d4f51d7238a403f8f2298f6a16/src/encoding/json/encode.go#L585
+ const bitSize = 64
+ b := make([]byte, 0, 32)
+ if abs := math.Abs(f64); abs != 0 && (abs < 1e-6 || abs >= 1e21) {
+ b = strconv.AppendFloat(b, f64, 'e', -1, bitSize)
+ // clean up e-09 to e-9
+ n := len(b)
+ if n >= 4 && string(b[n-4:n-1]) == "e-0" {
+ b = append(b[:n-2], b[n-1])
+ }
+ } else {
+ b = strconv.AppendFloat(b, f64, 'f', -1, bitSize)
+ }
+
+ // add decimal point and trailing zero if needed
+ if bytes.IndexByte(b, '.') < 0 {
+ if i := bytes.IndexByte(b, 'e'); i < 0 {
+ b = append(b, '.', '0')
+ } else {
+ b = append(b[:i+2], b[i:]...)
+ b[i] = '.'
+ b[i+1] = '0'
+ }
+ }
+
+ di.w.WriteString(string(b))
+
+ if di.dm.floatPrecisionIndicator {
+ switch ai {
+ case additionalInformationAsFloat16:
+ di.w.WriteString("_1")
+ return nil
+
+ case additionalInformationAsFloat32:
+ di.w.WriteString("_2")
+ return nil
+
+ case additionalInformationAsFloat64:
+ di.w.WriteString("_3")
+ return nil
+ }
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/doc.go b/vendor/github.com/fxamacker/cbor/v2/doc.go
new file mode 100644
index 000000000..23f68b984
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/doc.go
@@ -0,0 +1,129 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+/*
+Package cbor is a modern CBOR codec (RFC 8949 & RFC 7049) with CBOR tags,
+Go struct tags (toarray/keyasint/omitempty), Core Deterministic Encoding,
+CTAP2, Canonical CBOR, float64->32->16, and duplicate map key detection.
+
+Encoding options allow "preferred serialization" by encoding integers and floats
+to their smallest forms (e.g. float16) when values fit.
+
+Struct tags like "keyasint", "toarray" and "omitempty" make CBOR data smaller
+and easier to use with structs.
+
+For example, "toarray" tag makes struct fields encode to CBOR array elements. And
+"keyasint" makes a field encode to an element of CBOR map with specified int key.
+
+Latest docs can be viewed at https://github.com/fxamacker/cbor#cbor-library-in-go
+
+# Basics
+
+The Quick Start guide is at https://github.com/fxamacker/cbor#quick-start
+
+Function signatures identical to encoding/json include:
+
+ Marshal, Unmarshal, NewEncoder, NewDecoder, (*Encoder).Encode, (*Decoder).Decode.
+
+Standard interfaces include:
+
+ BinaryMarshaler, BinaryUnmarshaler, Marshaler, and Unmarshaler.
+
+Custom encoding and decoding is possible by implementing standard interfaces for
+user-defined Go types.
+
+Codec functions are available at package-level (using defaults options) or by
+creating modes from options at runtime.
+
+"Mode" in this API means definite way of encoding (EncMode) or decoding (DecMode).
+
+EncMode and DecMode interfaces are created from EncOptions or DecOptions structs.
+
+ em, err := cbor.EncOptions{...}.EncMode()
+ em, err := cbor.CanonicalEncOptions().EncMode()
+ em, err := cbor.CTAP2EncOptions().EncMode()
+
+Modes use immutable options to avoid side-effects and simplify concurrency. Behavior of
+modes won't accidentally change at runtime after they're created.
+
+Modes are intended to be reused and are safe for concurrent use.
+
+EncMode and DecMode Interfaces
+
+ // EncMode interface uses immutable options and is safe for concurrent use.
+ type EncMode interface {
+ Marshal(v interface{}) ([]byte, error)
+ NewEncoder(w io.Writer) *Encoder
+ EncOptions() EncOptions // returns copy of options
+ }
+
+ // DecMode interface uses immutable options and is safe for concurrent use.
+ type DecMode interface {
+ Unmarshal(data []byte, v interface{}) error
+ NewDecoder(r io.Reader) *Decoder
+ DecOptions() DecOptions // returns copy of options
+ }
+
+Using Default Encoding Mode
+
+ b, err := cbor.Marshal(v)
+
+ encoder := cbor.NewEncoder(w)
+ err = encoder.Encode(v)
+
+Using Default Decoding Mode
+
+ err := cbor.Unmarshal(b, &v)
+
+ decoder := cbor.NewDecoder(r)
+ err = decoder.Decode(&v)
+
+Creating and Using Encoding Modes
+
+ // Create EncOptions using either struct literal or a function.
+ opts := cbor.CanonicalEncOptions()
+
+ // If needed, modify encoding options
+ opts.Time = cbor.TimeUnix
+
+ // Create reusable EncMode interface with immutable options, safe for concurrent use.
+ em, err := opts.EncMode()
+
+ // Use EncMode like encoding/json, with same function signatures.
+ b, err := em.Marshal(v)
+ // or
+ encoder := em.NewEncoder(w)
+ err := encoder.Encode(v)
+
+ // NOTE: Both em.Marshal(v) and encoder.Encode(v) use encoding options
+ // specified during creation of em (encoding mode).
+
+# CBOR Options
+
+Predefined Encoding Options: https://github.com/fxamacker/cbor#predefined-encoding-options
+
+Encoding Options: https://github.com/fxamacker/cbor#encoding-options
+
+Decoding Options: https://github.com/fxamacker/cbor#decoding-options
+
+# Struct Tags
+
+Struct tags like `cbor:"name,omitempty"` and `json:"name,omitempty"` work as expected.
+If both struct tags are specified then `cbor` is used.
+
+Struct tags like "keyasint", "toarray", and "omitempty" make it easy to use
+very compact formats like COSE and CWT (CBOR Web Tokens) with structs.
+
+For example, "toarray" makes struct fields encode to array elements. And "keyasint"
+makes struct fields encode to elements of CBOR map with int keys.
+
+https://raw.githubusercontent.com/fxamacker/images/master/cbor/v2.0.0/cbor_easy_api.png
+
+Struct tags are listed at https://github.com/fxamacker/cbor#struct-tags-1
+
+# Tests and Fuzzing
+
+Over 375 tests are included in this package. Cover-guided fuzzing is handled by
+a private fuzzer that replaced fxamacker/cbor-fuzz years ago.
+*/
+package cbor
diff --git a/vendor/github.com/fxamacker/cbor/v2/encode.go b/vendor/github.com/fxamacker/cbor/v2/encode.go
new file mode 100644
index 000000000..6508e291d
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/encode.go
@@ -0,0 +1,1989 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "bytes"
+ "encoding"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "math/big"
+ "math/rand"
+ "reflect"
+ "sort"
+ "strconv"
+ "sync"
+ "time"
+
+ "github.com/x448/float16"
+)
+
+// Marshal returns the CBOR encoding of v using default encoding options.
+// See EncOptions for encoding options.
+//
+// Marshal uses the following encoding rules:
+//
+// If value implements the Marshaler interface, Marshal calls its
+// MarshalCBOR method.
+//
+// If value implements encoding.BinaryMarshaler, Marhsal calls its
+// MarshalBinary method and encode it as CBOR byte string.
+//
+// Boolean values encode as CBOR booleans (type 7).
+//
+// Positive integer values encode as CBOR positive integers (type 0).
+//
+// Negative integer values encode as CBOR negative integers (type 1).
+//
+// Floating point values encode as CBOR floating points (type 7).
+//
+// String values encode as CBOR text strings (type 3).
+//
+// []byte values encode as CBOR byte strings (type 2).
+//
+// Array and slice values encode as CBOR arrays (type 4).
+//
+// Map values encode as CBOR maps (type 5).
+//
+// Struct values encode as CBOR maps (type 5). Each exported struct field
+// becomes a pair with field name encoded as CBOR text string (type 3) and
+// field value encoded based on its type. See struct tag option "keyasint"
+// to encode field name as CBOR integer (type 0 and 1). Also see struct
+// tag option "toarray" for special field "_" to encode struct values as
+// CBOR array (type 4).
+//
+// Marshal supports format string stored under the "cbor" key in the struct
+// field's tag. CBOR format string can specify the name of the field,
+// "omitempty" and "keyasint" options, and special case "-" for field omission.
+// If "cbor" key is absent, Marshal uses "json" key.
+//
+// Struct field name is treated as integer if it has "keyasint" option in
+// its format string. The format string must specify an integer as its
+// field name.
+//
+// Special struct field "_" is used to specify struct level options, such as
+// "toarray". "toarray" option enables Go struct to be encoded as CBOR array.
+// "omitempty" is disabled by "toarray" to ensure that the same number
+// of elements are encoded every time.
+//
+// Anonymous struct fields are marshaled as if their exported fields
+// were fields in the outer struct. Marshal follows the same struct fields
+// visibility rules used by JSON encoding package.
+//
+// time.Time values encode as text strings specified in RFC3339 or numerical
+// representation of seconds since January 1, 1970 UTC depending on
+// EncOptions.Time setting. Also See EncOptions.TimeTag to encode
+// time.Time as CBOR tag with tag number 0 or 1.
+//
+// big.Int values encode as CBOR integers (type 0 and 1) if values fit.
+// Otherwise, big.Int values encode as CBOR bignums (tag 2 and 3). See
+// EncOptions.BigIntConvert to always encode big.Int values as CBOR
+// bignums.
+//
+// Pointer values encode as the value pointed to.
+//
+// Interface values encode as the value stored in the interface.
+//
+// Nil slice/map/pointer/interface values encode as CBOR nulls (type 7).
+//
+// Values of other types cannot be encoded in CBOR. Attempting
+// to encode such a value causes Marshal to return an UnsupportedTypeError.
+func Marshal(v interface{}) ([]byte, error) {
+ return defaultEncMode.Marshal(v)
+}
+
+// MarshalToBuffer encodes v into provided buffer (instead of using built-in buffer pool)
+// and uses default encoding options.
+//
+// NOTE: Unlike Marshal, the buffer provided to MarshalToBuffer can contain
+// partially encoded data if error is returned.
+//
+// See Marshal for more details.
+func MarshalToBuffer(v interface{}, buf *bytes.Buffer) error {
+ return defaultEncMode.MarshalToBuffer(v, buf)
+}
+
+// Marshaler is the interface implemented by types that can marshal themselves
+// into valid CBOR.
+type Marshaler interface {
+ MarshalCBOR() ([]byte, error)
+}
+
+// MarshalerError represents error from checking encoded CBOR data item
+// returned from MarshalCBOR for well-formedness and some very limited tag validation.
+type MarshalerError struct {
+ typ reflect.Type
+ err error
+}
+
+func (e *MarshalerError) Error() string {
+ return "cbor: error calling MarshalCBOR for type " +
+ e.typ.String() +
+ ": " + e.err.Error()
+}
+
+func (e *MarshalerError) Unwrap() error {
+ return e.err
+}
+
+// UnsupportedTypeError is returned by Marshal when attempting to encode value
+// of an unsupported type.
+type UnsupportedTypeError struct {
+ Type reflect.Type
+}
+
+func (e *UnsupportedTypeError) Error() string {
+ return "cbor: unsupported type: " + e.Type.String()
+}
+
+// UnsupportedValueError is returned by Marshal when attempting to encode an
+// unsupported value.
+type UnsupportedValueError struct {
+ msg string
+}
+
+func (e *UnsupportedValueError) Error() string {
+ return "cbor: unsupported value: " + e.msg
+}
+
+// SortMode identifies supported sorting order.
+type SortMode int
+
+const (
+ // SortNone encodes map pairs and struct fields in an arbitrary order.
+ SortNone SortMode = 0
+
+ // SortLengthFirst causes map keys or struct fields to be sorted such that:
+ // - If two keys have different lengths, the shorter one sorts earlier;
+ // - If two keys have the same length, the one with the lower value in
+ // (byte-wise) lexical order sorts earlier.
+ // It is used in "Canonical CBOR" encoding in RFC 7049 3.9.
+ SortLengthFirst SortMode = 1
+
+ // SortBytewiseLexical causes map keys or struct fields to be sorted in the
+ // bytewise lexicographic order of their deterministic CBOR encodings.
+ // It is used in "CTAP2 Canonical CBOR" and "Core Deterministic Encoding"
+ // in RFC 7049bis.
+ SortBytewiseLexical SortMode = 2
+
+ // SortShuffle encodes map pairs and struct fields in a shuffled
+ // order. This mode does not guarantee an unbiased permutation, but it
+ // does guarantee that the runtime of the shuffle algorithm used will be
+ // constant.
+ SortFastShuffle SortMode = 3
+
+ // SortCanonical is used in "Canonical CBOR" encoding in RFC 7049 3.9.
+ SortCanonical SortMode = SortLengthFirst
+
+ // SortCTAP2 is used in "CTAP2 Canonical CBOR".
+ SortCTAP2 SortMode = SortBytewiseLexical
+
+ // SortCoreDeterministic is used in "Core Deterministic Encoding" in RFC 7049bis.
+ SortCoreDeterministic SortMode = SortBytewiseLexical
+
+ maxSortMode SortMode = 4
+)
+
+func (sm SortMode) valid() bool {
+ return sm >= 0 && sm < maxSortMode
+}
+
+// StringMode specifies how to encode Go string values.
+type StringMode int
+
+const (
+ // StringToTextString encodes Go string to CBOR text string (major type 3).
+ StringToTextString StringMode = iota
+
+ // StringToByteString encodes Go string to CBOR byte string (major type 2).
+ StringToByteString
+)
+
+func (st StringMode) cborType() (cborType, error) {
+ switch st {
+ case StringToTextString:
+ return cborTypeTextString, nil
+
+ case StringToByteString:
+ return cborTypeByteString, nil
+ }
+ return 0, errors.New("cbor: invalid StringType " + strconv.Itoa(int(st)))
+}
+
+// ShortestFloatMode specifies which floating-point format should
+// be used as the shortest possible format for CBOR encoding.
+// It is not used for encoding Infinity and NaN values.
+type ShortestFloatMode int
+
+const (
+ // ShortestFloatNone makes float values encode without any conversion.
+ // This is the default for ShortestFloatMode in v1.
+ // E.g. a float32 in Go will encode to CBOR float32. And
+ // a float64 in Go will encode to CBOR float64.
+ ShortestFloatNone ShortestFloatMode = iota
+
+ // ShortestFloat16 specifies float16 as the shortest form that preserves value.
+ // E.g. if float64 can convert to float32 while preserving value, then
+ // encoding will also try to convert float32 to float16. So a float64 might
+ // encode as CBOR float64, float32 or float16 depending on the value.
+ ShortestFloat16
+
+ maxShortestFloat
+)
+
+func (sfm ShortestFloatMode) valid() bool {
+ return sfm >= 0 && sfm < maxShortestFloat
+}
+
+// NaNConvertMode specifies how to encode NaN and overrides ShortestFloatMode.
+// ShortestFloatMode is not used for encoding Infinity and NaN values.
+type NaNConvertMode int
+
+const (
+ // NaNConvert7e00 always encodes NaN to 0xf97e00 (CBOR float16 = 0x7e00).
+ NaNConvert7e00 NaNConvertMode = iota
+
+ // NaNConvertNone never modifies or converts NaN to other representations
+ // (float64 NaN stays float64, etc. even if it can use float16 without losing
+ // any bits).
+ NaNConvertNone
+
+ // NaNConvertPreserveSignal converts NaN to the smallest form that preserves
+ // value (quiet bit + payload) as described in RFC 7049bis Draft 12.
+ NaNConvertPreserveSignal
+
+ // NaNConvertQuiet always forces quiet bit = 1 and shortest form that preserves
+ // NaN payload.
+ NaNConvertQuiet
+
+ // NaNConvertReject returns UnsupportedValueError on attempts to encode a NaN value.
+ NaNConvertReject
+
+ maxNaNConvert
+)
+
+func (ncm NaNConvertMode) valid() bool {
+ return ncm >= 0 && ncm < maxNaNConvert
+}
+
+// InfConvertMode specifies how to encode Infinity and overrides ShortestFloatMode.
+// ShortestFloatMode is not used for encoding Infinity and NaN values.
+type InfConvertMode int
+
+const (
+ // InfConvertFloat16 always converts Inf to lossless IEEE binary16 (float16).
+ InfConvertFloat16 InfConvertMode = iota
+
+ // InfConvertNone never converts (used by CTAP2 Canonical CBOR).
+ InfConvertNone
+
+ // InfConvertReject returns UnsupportedValueError on attempts to encode an infinite value.
+ InfConvertReject
+
+ maxInfConvert
+)
+
+func (icm InfConvertMode) valid() bool {
+ return icm >= 0 && icm < maxInfConvert
+}
+
+// TimeMode specifies how to encode time.Time values.
+type TimeMode int
+
+const (
+ // TimeUnix causes time.Time to be encoded as epoch time in integer with second precision.
+ TimeUnix TimeMode = iota
+
+ // TimeUnixMicro causes time.Time to be encoded as epoch time in float-point rounded to microsecond precision.
+ TimeUnixMicro
+
+ // TimeUnixDynamic causes time.Time to be encoded as integer if time.Time doesn't have fractional seconds,
+ // otherwise float-point rounded to microsecond precision.
+ TimeUnixDynamic
+
+ // TimeRFC3339 causes time.Time to be encoded as RFC3339 formatted string with second precision.
+ TimeRFC3339
+
+ // TimeRFC3339Nano causes time.Time to be encoded as RFC3339 formatted string with nanosecond precision.
+ TimeRFC3339Nano
+
+ maxTimeMode
+)
+
+func (tm TimeMode) valid() bool {
+ return tm >= 0 && tm < maxTimeMode
+}
+
+// BigIntConvertMode specifies how to encode big.Int values.
+type BigIntConvertMode int
+
+const (
+ // BigIntConvertShortest makes big.Int encode to CBOR integer if value fits.
+ // E.g. if big.Int value can be converted to CBOR integer while preserving
+ // value, encoder will encode it to CBOR integer (major type 0 or 1).
+ BigIntConvertShortest BigIntConvertMode = iota
+
+ // BigIntConvertNone makes big.Int encode to CBOR bignum (tag 2 or 3) without
+ // converting it to another CBOR type.
+ BigIntConvertNone
+
+ // BigIntConvertReject returns an UnsupportedTypeError instead of marshaling a big.Int.
+ BigIntConvertReject
+
+ maxBigIntConvert
+)
+
+func (bim BigIntConvertMode) valid() bool {
+ return bim >= 0 && bim < maxBigIntConvert
+}
+
+// NilContainersMode specifies how to encode nil slices and maps.
+type NilContainersMode int
+
+const (
+ // NilContainerAsNull encodes nil slices and maps as CBOR null.
+ // This is the default.
+ NilContainerAsNull NilContainersMode = iota
+
+ // NilContainerAsEmpty encodes nil slices and maps as
+ // empty container (CBOR bytestring, array, or map).
+ NilContainerAsEmpty
+
+ maxNilContainersMode
+)
+
+func (m NilContainersMode) valid() bool {
+ return m >= 0 && m < maxNilContainersMode
+}
+
+// OmitEmptyMode specifies how to encode struct fields with omitempty tag.
+// The default behavior omits if field value would encode as empty CBOR value.
+type OmitEmptyMode int
+
+const (
+ // OmitEmptyCBORValue specifies that struct fields tagged with "omitempty"
+ // should be omitted from encoding if the field would be encoded as an empty
+ // CBOR value, such as CBOR false, 0, 0.0, nil, empty byte, empty string,
+ // empty array, or empty map.
+ OmitEmptyCBORValue OmitEmptyMode = iota
+
+ // OmitEmptyGoValue specifies that struct fields tagged with "omitempty"
+ // should be omitted from encoding if the field has an empty Go value,
+ // defined as false, 0, 0.0, a nil pointer, a nil interface value, and
+ // any empty array, slice, map, or string.
+ // This behavior is the same as the current (aka v1) encoding/json package
+ // included in Go.
+ OmitEmptyGoValue
+
+ maxOmitEmptyMode
+)
+
+func (om OmitEmptyMode) valid() bool {
+ return om >= 0 && om < maxOmitEmptyMode
+}
+
+// FieldNameMode specifies the CBOR type to use when encoding struct field names.
+type FieldNameMode int
+
+const (
+ // FieldNameToTextString encodes struct fields to CBOR text string (major type 3).
+ FieldNameToTextString FieldNameMode = iota
+
+ // FieldNameToTextString encodes struct fields to CBOR byte string (major type 2).
+ FieldNameToByteString
+
+ maxFieldNameMode
+)
+
+func (fnm FieldNameMode) valid() bool {
+ return fnm >= 0 && fnm < maxFieldNameMode
+}
+
+// ByteSliceLaterFormatMode specifies which later format conversion hint (CBOR tag 21-23)
+// to include (if any) when encoding Go byte slice to CBOR byte string. The encoder will
+// always encode unmodified bytes from the byte slice and just wrap it within
+// CBOR tag 21, 22, or 23 if specified.
+// See "Expected Later Encoding for CBOR-to-JSON Converters" in RFC 8949 Section 3.4.5.2.
+type ByteSliceLaterFormatMode int
+
+const (
+ // ByteSliceLaterFormatNone encodes unmodified bytes from Go byte slice to CBOR byte string (major type 2)
+ // without adding CBOR tag 21, 22, or 23.
+ ByteSliceLaterFormatNone ByteSliceLaterFormatMode = iota
+
+ // ByteSliceLaterFormatBase64URL encodes unmodified bytes from Go byte slice to CBOR byte string (major type 2)
+ // inside CBOR tag 21 (expected later conversion to base64url encoding, see RFC 8949 Section 3.4.5.2).
+ ByteSliceLaterFormatBase64URL
+
+ // ByteSliceLaterFormatBase64 encodes unmodified bytes from Go byte slice to CBOR byte string (major type 2)
+ // inside CBOR tag 22 (expected later conversion to base64 encoding, see RFC 8949 Section 3.4.5.2).
+ ByteSliceLaterFormatBase64
+
+ // ByteSliceLaterFormatBase16 encodes unmodified bytes from Go byte slice to CBOR byte string (major type 2)
+ // inside CBOR tag 23 (expected later conversion to base16 encoding, see RFC 8949 Section 3.4.5.2).
+ ByteSliceLaterFormatBase16
+)
+
+func (bsefm ByteSliceLaterFormatMode) encodingTag() (uint64, error) {
+ switch bsefm {
+ case ByteSliceLaterFormatNone:
+ return 0, nil
+
+ case ByteSliceLaterFormatBase64URL:
+ return tagNumExpectedLaterEncodingBase64URL, nil
+
+ case ByteSliceLaterFormatBase64:
+ return tagNumExpectedLaterEncodingBase64, nil
+
+ case ByteSliceLaterFormatBase16:
+ return tagNumExpectedLaterEncodingBase16, nil
+ }
+ return 0, errors.New("cbor: invalid ByteSliceLaterFormat " + strconv.Itoa(int(bsefm)))
+}
+
+// ByteArrayMode specifies how to encode byte arrays.
+type ByteArrayMode int
+
+const (
+ // ByteArrayToByteSlice encodes byte arrays the same way that a byte slice with identical
+ // length and contents is encoded.
+ ByteArrayToByteSlice ByteArrayMode = iota
+
+ // ByteArrayToArray encodes byte arrays to the CBOR array type with one unsigned integer
+ // item for each byte in the array.
+ ByteArrayToArray
+
+ maxByteArrayMode
+)
+
+func (bam ByteArrayMode) valid() bool {
+ return bam >= 0 && bam < maxByteArrayMode
+}
+
+// BinaryMarshalerMode specifies how to encode types that implement encoding.BinaryMarshaler.
+type BinaryMarshalerMode int
+
+const (
+ // BinaryMarshalerByteString encodes the output of MarshalBinary to a CBOR byte string.
+ BinaryMarshalerByteString BinaryMarshalerMode = iota
+
+ // BinaryMarshalerNone does not recognize BinaryMarshaler implementations during encode.
+ BinaryMarshalerNone
+
+ maxBinaryMarshalerMode
+)
+
+func (bmm BinaryMarshalerMode) valid() bool {
+ return bmm >= 0 && bmm < maxBinaryMarshalerMode
+}
+
+// EncOptions specifies encoding options.
+type EncOptions struct {
+ // Sort specifies sorting order.
+ Sort SortMode
+
+ // ShortestFloat specifies the shortest floating-point encoding that preserves
+ // the value being encoded.
+ ShortestFloat ShortestFloatMode
+
+ // NaNConvert specifies how to encode NaN and it overrides ShortestFloatMode.
+ NaNConvert NaNConvertMode
+
+ // InfConvert specifies how to encode Inf and it overrides ShortestFloatMode.
+ InfConvert InfConvertMode
+
+ // BigIntConvert specifies how to encode big.Int values.
+ BigIntConvert BigIntConvertMode
+
+ // Time specifies how to encode time.Time.
+ Time TimeMode
+
+ // TimeTag allows time.Time to be encoded with a tag number.
+ // RFC3339 format gets tag number 0, and numeric epoch time tag number 1.
+ TimeTag EncTagMode
+
+ // IndefLength specifies whether to allow indefinite length CBOR items.
+ IndefLength IndefLengthMode
+
+ // NilContainers specifies how to encode nil slices and maps.
+ NilContainers NilContainersMode
+
+ // TagsMd specifies whether to allow CBOR tags (major type 6).
+ TagsMd TagsMode
+
+ // OmitEmptyMode specifies how to encode struct fields with omitempty tag.
+ OmitEmpty OmitEmptyMode
+
+ // String specifies which CBOR type to use when encoding Go strings.
+ // - CBOR text string (major type 3) is default
+ // - CBOR byte string (major type 2)
+ String StringMode
+
+ // FieldName specifies the CBOR type to use when encoding struct field names.
+ FieldName FieldNameMode
+
+ // ByteSliceLaterFormat specifies which later format conversion hint (CBOR tag 21-23)
+ // to include (if any) when encoding Go byte slice to CBOR byte string. The encoder will
+ // always encode unmodified bytes from the byte slice and just wrap it within
+ // CBOR tag 21, 22, or 23 if specified.
+ // See "Expected Later Encoding for CBOR-to-JSON Converters" in RFC 8949 Section 3.4.5.2.
+ ByteSliceLaterFormat ByteSliceLaterFormatMode
+
+ // ByteArray specifies how to encode byte arrays.
+ ByteArray ByteArrayMode
+
+ // BinaryMarshaler specifies how to encode types that implement encoding.BinaryMarshaler.
+ BinaryMarshaler BinaryMarshalerMode
+}
+
+// CanonicalEncOptions returns EncOptions for "Canonical CBOR" encoding,
+// defined in RFC 7049 Section 3.9 with the following rules:
+//
+// 1. "Integers must be as small as possible."
+// 2. "The expression of lengths in major types 2 through 5 must be as short as possible."
+// 3. The keys in every map must be sorted in length-first sorting order.
+// See SortLengthFirst for details.
+// 4. "Indefinite-length items must be made into definite-length items."
+// 5. "If a protocol allows for IEEE floats, then additional canonicalization rules might
+// need to be added. One example rule might be to have all floats start as a 64-bit
+// float, then do a test conversion to a 32-bit float; if the result is the same numeric
+// value, use the shorter value and repeat the process with a test conversion to a
+// 16-bit float. (This rule selects 16-bit float for positive and negative Infinity
+// as well.) Also, there are many representations for NaN. If NaN is an allowed value,
+// it must always be represented as 0xf97e00."
+func CanonicalEncOptions() EncOptions {
+ return EncOptions{
+ Sort: SortCanonical,
+ ShortestFloat: ShortestFloat16,
+ NaNConvert: NaNConvert7e00,
+ InfConvert: InfConvertFloat16,
+ IndefLength: IndefLengthForbidden,
+ }
+}
+
+// CTAP2EncOptions returns EncOptions for "CTAP2 Canonical CBOR" encoding,
+// defined in CTAP specification, with the following rules:
+//
+// 1. "Integers must be encoded as small as possible."
+// 2. "The representations of any floating-point values are not changed."
+// 3. "The expression of lengths in major types 2 through 5 must be as short as possible."
+// 4. "Indefinite-length items must be made into definite-length items.""
+// 5. The keys in every map must be sorted in bytewise lexicographic order.
+// See SortBytewiseLexical for details.
+// 6. "Tags as defined in Section 2.4 in [RFC7049] MUST NOT be present."
+func CTAP2EncOptions() EncOptions {
+ return EncOptions{
+ Sort: SortCTAP2,
+ ShortestFloat: ShortestFloatNone,
+ NaNConvert: NaNConvertNone,
+ InfConvert: InfConvertNone,
+ IndefLength: IndefLengthForbidden,
+ TagsMd: TagsForbidden,
+ }
+}
+
+// CoreDetEncOptions returns EncOptions for "Core Deterministic" encoding,
+// defined in RFC 7049bis with the following rules:
+//
+// 1. "Preferred serialization MUST be used. In particular, this means that arguments
+// (see Section 3) for integers, lengths in major types 2 through 5, and tags MUST
+// be as short as possible"
+// "Floating point values also MUST use the shortest form that preserves the value"
+// 2. "Indefinite-length items MUST NOT appear."
+// 3. "The keys in every map MUST be sorted in the bytewise lexicographic order of
+// their deterministic encodings."
+func CoreDetEncOptions() EncOptions {
+ return EncOptions{
+ Sort: SortCoreDeterministic,
+ ShortestFloat: ShortestFloat16,
+ NaNConvert: NaNConvert7e00,
+ InfConvert: InfConvertFloat16,
+ IndefLength: IndefLengthForbidden,
+ }
+}
+
+// PreferredUnsortedEncOptions returns EncOptions for "Preferred Serialization" encoding,
+// defined in RFC 7049bis with the following rules:
+//
+// 1. "The preferred serialization always uses the shortest form of representing the argument
+// (Section 3);"
+// 2. "it also uses the shortest floating-point encoding that preserves the value being
+// encoded (see Section 5.5)."
+// "The preferred encoding for a floating-point value is the shortest floating-point encoding
+// that preserves its value, e.g., 0xf94580 for the number 5.5, and 0xfa45ad9c00 for the
+// number 5555.5, unless the CBOR-based protocol specifically excludes the use of the shorter
+// floating-point encodings. For NaN values, a shorter encoding is preferred if zero-padding
+// the shorter significand towards the right reconstitutes the original NaN value (for many
+// applications, the single NaN encoding 0xf97e00 will suffice)."
+// 3. "Definite length encoding is preferred whenever the length is known at the time the
+// serialization of the item starts."
+func PreferredUnsortedEncOptions() EncOptions {
+ return EncOptions{
+ Sort: SortNone,
+ ShortestFloat: ShortestFloat16,
+ NaNConvert: NaNConvert7e00,
+ InfConvert: InfConvertFloat16,
+ }
+}
+
+// EncMode returns EncMode with immutable options and no tags (safe for concurrency).
+func (opts EncOptions) EncMode() (EncMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.encMode()
+}
+
+// UserBufferEncMode returns UserBufferEncMode with immutable options and no tags (safe for concurrency).
+func (opts EncOptions) UserBufferEncMode() (UserBufferEncMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.encMode()
+}
+
+// EncModeWithTags returns EncMode with options and tags that are both immutable (safe for concurrency).
+func (opts EncOptions) EncModeWithTags(tags TagSet) (EncMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.UserBufferEncModeWithTags(tags)
+}
+
+// UserBufferEncModeWithTags returns UserBufferEncMode with options and tags that are both immutable (safe for concurrency).
+func (opts EncOptions) UserBufferEncModeWithTags(tags TagSet) (UserBufferEncMode, error) { //nolint:gocritic // ignore hugeParam
+ if opts.TagsMd == TagsForbidden {
+ return nil, errors.New("cbor: cannot create EncMode with TagSet when TagsMd is TagsForbidden")
+ }
+ if tags == nil {
+ return nil, errors.New("cbor: cannot create EncMode with nil value as TagSet")
+ }
+ em, err := opts.encMode()
+ if err != nil {
+ return nil, err
+ }
+ // Copy tags
+ ts := tagSet(make(map[reflect.Type]*tagItem))
+ syncTags := tags.(*syncTagSet)
+ syncTags.RLock()
+ for contentType, tag := range syncTags.t {
+ if tag.opts.EncTag != EncTagNone {
+ ts[contentType] = tag
+ }
+ }
+ syncTags.RUnlock()
+ if len(ts) > 0 {
+ em.tags = ts
+ }
+ return em, nil
+}
+
+// EncModeWithSharedTags returns EncMode with immutable options and mutable shared tags (safe for concurrency).
+func (opts EncOptions) EncModeWithSharedTags(tags TagSet) (EncMode, error) { //nolint:gocritic // ignore hugeParam
+ return opts.UserBufferEncModeWithSharedTags(tags)
+}
+
+// UserBufferEncModeWithSharedTags returns UserBufferEncMode with immutable options and mutable shared tags (safe for concurrency).
+func (opts EncOptions) UserBufferEncModeWithSharedTags(tags TagSet) (UserBufferEncMode, error) { //nolint:gocritic // ignore hugeParam
+ if opts.TagsMd == TagsForbidden {
+ return nil, errors.New("cbor: cannot create EncMode with TagSet when TagsMd is TagsForbidden")
+ }
+ if tags == nil {
+ return nil, errors.New("cbor: cannot create EncMode with nil value as TagSet")
+ }
+ em, err := opts.encMode()
+ if err != nil {
+ return nil, err
+ }
+ em.tags = tags
+ return em, nil
+}
+
+func (opts EncOptions) encMode() (*encMode, error) { //nolint:gocritic // ignore hugeParam
+ if !opts.Sort.valid() {
+ return nil, errors.New("cbor: invalid SortMode " + strconv.Itoa(int(opts.Sort)))
+ }
+ if !opts.ShortestFloat.valid() {
+ return nil, errors.New("cbor: invalid ShortestFloatMode " + strconv.Itoa(int(opts.ShortestFloat)))
+ }
+ if !opts.NaNConvert.valid() {
+ return nil, errors.New("cbor: invalid NaNConvertMode " + strconv.Itoa(int(opts.NaNConvert)))
+ }
+ if !opts.InfConvert.valid() {
+ return nil, errors.New("cbor: invalid InfConvertMode " + strconv.Itoa(int(opts.InfConvert)))
+ }
+ if !opts.BigIntConvert.valid() {
+ return nil, errors.New("cbor: invalid BigIntConvertMode " + strconv.Itoa(int(opts.BigIntConvert)))
+ }
+ if !opts.Time.valid() {
+ return nil, errors.New("cbor: invalid TimeMode " + strconv.Itoa(int(opts.Time)))
+ }
+ if !opts.TimeTag.valid() {
+ return nil, errors.New("cbor: invalid TimeTag " + strconv.Itoa(int(opts.TimeTag)))
+ }
+ if !opts.IndefLength.valid() {
+ return nil, errors.New("cbor: invalid IndefLength " + strconv.Itoa(int(opts.IndefLength)))
+ }
+ if !opts.NilContainers.valid() {
+ return nil, errors.New("cbor: invalid NilContainers " + strconv.Itoa(int(opts.NilContainers)))
+ }
+ if !opts.TagsMd.valid() {
+ return nil, errors.New("cbor: invalid TagsMd " + strconv.Itoa(int(opts.TagsMd)))
+ }
+ if opts.TagsMd == TagsForbidden && opts.TimeTag == EncTagRequired {
+ return nil, errors.New("cbor: cannot set TagsMd to TagsForbidden when TimeTag is EncTagRequired")
+ }
+ if !opts.OmitEmpty.valid() {
+ return nil, errors.New("cbor: invalid OmitEmpty " + strconv.Itoa(int(opts.OmitEmpty)))
+ }
+ stringMajorType, err := opts.String.cborType()
+ if err != nil {
+ return nil, err
+ }
+ if !opts.FieldName.valid() {
+ return nil, errors.New("cbor: invalid FieldName " + strconv.Itoa(int(opts.FieldName)))
+ }
+ byteSliceLaterEncodingTag, err := opts.ByteSliceLaterFormat.encodingTag()
+ if err != nil {
+ return nil, err
+ }
+ if !opts.ByteArray.valid() {
+ return nil, errors.New("cbor: invalid ByteArray " + strconv.Itoa(int(opts.ByteArray)))
+ }
+ if !opts.BinaryMarshaler.valid() {
+ return nil, errors.New("cbor: invalid BinaryMarshaler " + strconv.Itoa(int(opts.BinaryMarshaler)))
+ }
+ em := encMode{
+ sort: opts.Sort,
+ shortestFloat: opts.ShortestFloat,
+ nanConvert: opts.NaNConvert,
+ infConvert: opts.InfConvert,
+ bigIntConvert: opts.BigIntConvert,
+ time: opts.Time,
+ timeTag: opts.TimeTag,
+ indefLength: opts.IndefLength,
+ nilContainers: opts.NilContainers,
+ tagsMd: opts.TagsMd,
+ omitEmpty: opts.OmitEmpty,
+ stringType: opts.String,
+ stringMajorType: stringMajorType,
+ fieldName: opts.FieldName,
+ byteSliceLaterFormat: opts.ByteSliceLaterFormat,
+ byteSliceLaterEncodingTag: byteSliceLaterEncodingTag,
+ byteArray: opts.ByteArray,
+ binaryMarshaler: opts.BinaryMarshaler,
+ }
+ return &em, nil
+}
+
+// EncMode is the main interface for CBOR encoding.
+type EncMode interface {
+ Marshal(v interface{}) ([]byte, error)
+ NewEncoder(w io.Writer) *Encoder
+ EncOptions() EncOptions
+}
+
+// UserBufferEncMode is an interface for CBOR encoding, which extends EncMode by
+// adding MarshalToBuffer to support user specified buffer rather than encoding
+// into the built-in buffer pool.
+type UserBufferEncMode interface {
+ EncMode
+ MarshalToBuffer(v interface{}, buf *bytes.Buffer) error
+
+ // This private method is to prevent users implementing
+ // this interface and so future additions to it will
+ // not be breaking changes.
+ // See https://go.dev/blog/module-compatibility
+ unexport()
+}
+
+type encMode struct {
+ tags tagProvider
+ sort SortMode
+ shortestFloat ShortestFloatMode
+ nanConvert NaNConvertMode
+ infConvert InfConvertMode
+ bigIntConvert BigIntConvertMode
+ time TimeMode
+ timeTag EncTagMode
+ indefLength IndefLengthMode
+ nilContainers NilContainersMode
+ tagsMd TagsMode
+ omitEmpty OmitEmptyMode
+ stringType StringMode
+ stringMajorType cborType
+ fieldName FieldNameMode
+ byteSliceLaterFormat ByteSliceLaterFormatMode
+ byteSliceLaterEncodingTag uint64
+ byteArray ByteArrayMode
+ binaryMarshaler BinaryMarshalerMode
+}
+
+var defaultEncMode, _ = EncOptions{}.encMode()
+
+// These four decoding modes are used by getMarshalerDecMode.
+// maxNestedLevels, maxArrayElements, and maxMapPairs are
+// set to max allowed limits to avoid rejecting Marshaler
+// output that would have been the allowable output of a
+// non-Marshaler object that exceeds default limits.
+var (
+ marshalerForbidIndefLengthForbidTagsDecMode = decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: IndefLengthForbidden,
+ tagsMd: TagsForbidden,
+ }
+
+ marshalerAllowIndefLengthForbidTagsDecMode = decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: IndefLengthAllowed,
+ tagsMd: TagsForbidden,
+ }
+
+ marshalerForbidIndefLengthAllowTagsDecMode = decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: IndefLengthForbidden,
+ tagsMd: TagsAllowed,
+ }
+
+ marshalerAllowIndefLengthAllowTagsDecMode = decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: IndefLengthAllowed,
+ tagsMd: TagsAllowed,
+ }
+)
+
+// getMarshalerDecMode returns one of four existing decoding modes
+// which can be reused (safe for parallel use) for the purpose of
+// checking if data returned by Marshaler is well-formed.
+func getMarshalerDecMode(indefLength IndefLengthMode, tagsMd TagsMode) *decMode {
+ switch {
+ case indefLength == IndefLengthAllowed && tagsMd == TagsAllowed:
+ return &marshalerAllowIndefLengthAllowTagsDecMode
+
+ case indefLength == IndefLengthAllowed && tagsMd == TagsForbidden:
+ return &marshalerAllowIndefLengthForbidTagsDecMode
+
+ case indefLength == IndefLengthForbidden && tagsMd == TagsAllowed:
+ return &marshalerForbidIndefLengthAllowTagsDecMode
+
+ case indefLength == IndefLengthForbidden && tagsMd == TagsForbidden:
+ return &marshalerForbidIndefLengthForbidTagsDecMode
+
+ default:
+ // This should never happen, unless we add new options to
+ // IndefLengthMode or TagsMode without updating this function.
+ return &decMode{
+ maxNestedLevels: maxMaxNestedLevels,
+ maxArrayElements: maxMaxArrayElements,
+ maxMapPairs: maxMaxMapPairs,
+ indefLength: indefLength,
+ tagsMd: tagsMd,
+ }
+ }
+}
+
+// EncOptions returns user specified options used to create this EncMode.
+func (em *encMode) EncOptions() EncOptions {
+ return EncOptions{
+ Sort: em.sort,
+ ShortestFloat: em.shortestFloat,
+ NaNConvert: em.nanConvert,
+ InfConvert: em.infConvert,
+ BigIntConvert: em.bigIntConvert,
+ Time: em.time,
+ TimeTag: em.timeTag,
+ IndefLength: em.indefLength,
+ NilContainers: em.nilContainers,
+ TagsMd: em.tagsMd,
+ OmitEmpty: em.omitEmpty,
+ String: em.stringType,
+ FieldName: em.fieldName,
+ ByteSliceLaterFormat: em.byteSliceLaterFormat,
+ ByteArray: em.byteArray,
+ BinaryMarshaler: em.binaryMarshaler,
+ }
+}
+
+func (em *encMode) unexport() {}
+
+func (em *encMode) encTagBytes(t reflect.Type) []byte {
+ if em.tags != nil {
+ if tagItem := em.tags.getTagItemFromType(t); tagItem != nil {
+ return tagItem.cborTagNum
+ }
+ }
+ return nil
+}
+
+// Marshal returns the CBOR encoding of v using em encoding mode.
+//
+// See the documentation for Marshal for details.
+func (em *encMode) Marshal(v interface{}) ([]byte, error) {
+ e := getEncodeBuffer()
+
+ if err := encode(e, em, reflect.ValueOf(v)); err != nil {
+ putEncodeBuffer(e)
+ return nil, err
+ }
+
+ buf := make([]byte, e.Len())
+ copy(buf, e.Bytes())
+
+ putEncodeBuffer(e)
+ return buf, nil
+}
+
+// MarshalToBuffer encodes v into provided buffer (instead of using built-in buffer pool)
+// and uses em encoding mode.
+//
+// NOTE: Unlike Marshal, the buffer provided to MarshalToBuffer can contain
+// partially encoded data if error is returned.
+//
+// See Marshal for more details.
+func (em *encMode) MarshalToBuffer(v interface{}, buf *bytes.Buffer) error {
+ if buf == nil {
+ return fmt.Errorf("cbor: encoding buffer provided by user is nil")
+ }
+ return encode(buf, em, reflect.ValueOf(v))
+}
+
+// NewEncoder returns a new encoder that writes to w using em EncMode.
+func (em *encMode) NewEncoder(w io.Writer) *Encoder {
+ return &Encoder{w: w, em: em}
+}
+
+// encodeBufferPool caches unused bytes.Buffer objects for later reuse.
+var encodeBufferPool = sync.Pool{
+ New: func() interface{} {
+ e := new(bytes.Buffer)
+ e.Grow(32) // TODO: make this configurable
+ return e
+ },
+}
+
+func getEncodeBuffer() *bytes.Buffer {
+ return encodeBufferPool.Get().(*bytes.Buffer)
+}
+
+func putEncodeBuffer(e *bytes.Buffer) {
+ e.Reset()
+ encodeBufferPool.Put(e)
+}
+
+type encodeFunc func(e *bytes.Buffer, em *encMode, v reflect.Value) error
+type isEmptyFunc func(em *encMode, v reflect.Value) (empty bool, err error)
+
+func encode(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if !v.IsValid() {
+ // v is zero value
+ e.Write(cborNil)
+ return nil
+ }
+ vt := v.Type()
+ f, _ := getEncodeFunc(vt)
+ if f == nil {
+ return &UnsupportedTypeError{vt}
+ }
+
+ return f(e, em, v)
+}
+
+func encodeBool(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ b := cborFalse
+ if v.Bool() {
+ b = cborTrue
+ }
+ e.Write(b)
+ return nil
+}
+
+func encodeInt(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ i := v.Int()
+ if i >= 0 {
+ encodeHead(e, byte(cborTypePositiveInt), uint64(i))
+ return nil
+ }
+ i = i*(-1) - 1
+ encodeHead(e, byte(cborTypeNegativeInt), uint64(i))
+ return nil
+}
+
+func encodeUint(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ encodeHead(e, byte(cborTypePositiveInt), v.Uint())
+ return nil
+}
+
+func encodeFloat(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ f64 := v.Float()
+ if math.IsNaN(f64) {
+ return encodeNaN(e, em, v)
+ }
+ if math.IsInf(f64, 0) {
+ return encodeInf(e, em, v)
+ }
+ fopt := em.shortestFloat
+ if v.Kind() == reflect.Float64 && (fopt == ShortestFloatNone || cannotFitFloat32(f64)) {
+ // Encode float64
+ // Don't use encodeFloat64() because it cannot be inlined.
+ const argumentSize = 8
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | byte(additionalInformationAsFloat64)
+ binary.BigEndian.PutUint64(scratch[1:], math.Float64bits(f64))
+ e.Write(scratch[:])
+ return nil
+ }
+
+ f32 := float32(f64)
+ if fopt == ShortestFloat16 {
+ var f16 float16.Float16
+ p := float16.PrecisionFromfloat32(f32)
+ if p == float16.PrecisionExact {
+ // Roundtrip float32->float16->float32 test isn't needed.
+ f16 = float16.Fromfloat32(f32)
+ } else if p == float16.PrecisionUnknown {
+ // Try roundtrip float32->float16->float32 to determine if float32 can fit into float16.
+ f16 = float16.Fromfloat32(f32)
+ if f16.Float32() == f32 {
+ p = float16.PrecisionExact
+ }
+ }
+ if p == float16.PrecisionExact {
+ // Encode float16
+ // Don't use encodeFloat16() because it cannot be inlined.
+ const argumentSize = 2
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat16
+ binary.BigEndian.PutUint16(scratch[1:], uint16(f16))
+ e.Write(scratch[:])
+ return nil
+ }
+ }
+
+ // Encode float32
+ // Don't use encodeFloat32() because it cannot be inlined.
+ const argumentSize = 4
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat32
+ binary.BigEndian.PutUint32(scratch[1:], math.Float32bits(f32))
+ e.Write(scratch[:])
+ return nil
+}
+
+func encodeInf(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ f64 := v.Float()
+ switch em.infConvert {
+ case InfConvertReject:
+ return &UnsupportedValueError{msg: "floating-point infinity"}
+
+ case InfConvertFloat16:
+ if f64 > 0 {
+ e.Write(cborPositiveInfinity)
+ } else {
+ e.Write(cborNegativeInfinity)
+ }
+ return nil
+ }
+ if v.Kind() == reflect.Float64 {
+ return encodeFloat64(e, f64)
+ }
+ return encodeFloat32(e, float32(f64))
+}
+
+func encodeNaN(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ switch em.nanConvert {
+ case NaNConvert7e00:
+ e.Write(cborNaN)
+ return nil
+
+ case NaNConvertNone:
+ if v.Kind() == reflect.Float64 {
+ return encodeFloat64(e, v.Float())
+ }
+ f32 := float32NaNFromReflectValue(v)
+ return encodeFloat32(e, f32)
+
+ case NaNConvertReject:
+ return &UnsupportedValueError{msg: "floating-point NaN"}
+
+ default: // NaNConvertPreserveSignal, NaNConvertQuiet
+ if v.Kind() == reflect.Float64 {
+ f64 := v.Float()
+ f64bits := math.Float64bits(f64)
+ if em.nanConvert == NaNConvertQuiet && f64bits&(1<<51) == 0 {
+ f64bits |= 1 << 51 // Set quiet bit = 1
+ f64 = math.Float64frombits(f64bits)
+ }
+ // The lower 29 bits are dropped when converting from float64 to float32.
+ if f64bits&0x1fffffff != 0 {
+ // Encode NaN as float64 because dropped coef bits from float64 to float32 are not all 0s.
+ return encodeFloat64(e, f64)
+ }
+ // Create float32 from float64 manually because float32(f64) always turns on NaN's quiet bits.
+ sign := uint32(f64bits>>32) & (1 << 31)
+ exp := uint32(0x7f800000)
+ coef := uint32((f64bits & 0xfffffffffffff) >> 29)
+ f32bits := sign | exp | coef
+ f32 := math.Float32frombits(f32bits)
+ // The lower 13 bits are dropped when converting from float32 to float16.
+ if f32bits&0x1fff != 0 {
+ // Encode NaN as float32 because dropped coef bits from float32 to float16 are not all 0s.
+ return encodeFloat32(e, f32)
+ }
+ // Encode NaN as float16
+ f16, _ := float16.FromNaN32ps(f32) // Ignore err because it only returns error when f32 is not a NaN.
+ return encodeFloat16(e, f16)
+ }
+
+ f32 := float32NaNFromReflectValue(v)
+ f32bits := math.Float32bits(f32)
+ if em.nanConvert == NaNConvertQuiet && f32bits&(1<<22) == 0 {
+ f32bits |= 1 << 22 // Set quiet bit = 1
+ f32 = math.Float32frombits(f32bits)
+ }
+ // The lower 13 bits are dropped coef bits when converting from float32 to float16.
+ if f32bits&0x1fff != 0 {
+ // Encode NaN as float32 because dropped coef bits from float32 to float16 are not all 0s.
+ return encodeFloat32(e, f32)
+ }
+ f16, _ := float16.FromNaN32ps(f32) // Ignore err because it only returns error when f32 is not a NaN.
+ return encodeFloat16(e, f16)
+ }
+}
+
+func encodeFloat16(e *bytes.Buffer, f16 float16.Float16) error {
+ const argumentSize = 2
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat16
+ binary.BigEndian.PutUint16(scratch[1:], uint16(f16))
+ e.Write(scratch[:])
+ return nil
+}
+
+func encodeFloat32(e *bytes.Buffer, f32 float32) error {
+ const argumentSize = 4
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat32
+ binary.BigEndian.PutUint32(scratch[1:], math.Float32bits(f32))
+ e.Write(scratch[:])
+ return nil
+}
+
+func encodeFloat64(e *bytes.Buffer, f64 float64) error {
+ const argumentSize = 8
+ const headSize = 1 + argumentSize
+ var scratch [headSize]byte
+ scratch[0] = byte(cborTypePrimitives) | additionalInformationAsFloat64
+ binary.BigEndian.PutUint64(scratch[1:], math.Float64bits(f64))
+ e.Write(scratch[:])
+ return nil
+}
+
+func encodeByteString(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ vk := v.Kind()
+ if vk == reflect.Slice && v.IsNil() && em.nilContainers == NilContainerAsNull {
+ e.Write(cborNil)
+ return nil
+ }
+ if vk == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 && em.byteSliceLaterEncodingTag != 0 {
+ encodeHead(e, byte(cborTypeTag), em.byteSliceLaterEncodingTag)
+ }
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ slen := v.Len()
+ if slen == 0 {
+ return e.WriteByte(byte(cborTypeByteString))
+ }
+ encodeHead(e, byte(cborTypeByteString), uint64(slen))
+ if vk == reflect.Array {
+ for i := 0; i < slen; i++ {
+ e.WriteByte(byte(v.Index(i).Uint()))
+ }
+ return nil
+ }
+ e.Write(v.Bytes())
+ return nil
+}
+
+func encodeString(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ s := v.String()
+ encodeHead(e, byte(em.stringMajorType), uint64(len(s)))
+ e.WriteString(s)
+ return nil
+}
+
+type arrayEncodeFunc struct {
+ f encodeFunc
+}
+
+func (ae arrayEncodeFunc) encode(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.byteArray == ByteArrayToByteSlice && v.Type().Elem().Kind() == reflect.Uint8 {
+ return encodeByteString(e, em, v)
+ }
+ if v.Kind() == reflect.Slice && v.IsNil() && em.nilContainers == NilContainerAsNull {
+ e.Write(cborNil)
+ return nil
+ }
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ alen := v.Len()
+ if alen == 0 {
+ return e.WriteByte(byte(cborTypeArray))
+ }
+ encodeHead(e, byte(cborTypeArray), uint64(alen))
+ for i := 0; i < alen; i++ {
+ if err := ae.f(e, em, v.Index(i)); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// encodeKeyValueFunc encodes key/value pairs in map (v).
+// If kvs is provided (having the same length as v), length of encoded key and value are stored in kvs.
+// kvs is used for canonical encoding of map.
+type encodeKeyValueFunc func(e *bytes.Buffer, em *encMode, v reflect.Value, kvs []keyValue) error
+
+type mapEncodeFunc struct {
+ e encodeKeyValueFunc
+}
+
+func (me mapEncodeFunc) encode(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if v.IsNil() && em.nilContainers == NilContainerAsNull {
+ e.Write(cborNil)
+ return nil
+ }
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+ mlen := v.Len()
+ if mlen == 0 {
+ return e.WriteByte(byte(cborTypeMap))
+ }
+
+ encodeHead(e, byte(cborTypeMap), uint64(mlen))
+ if em.sort == SortNone || em.sort == SortFastShuffle || mlen <= 1 {
+ return me.e(e, em, v, nil)
+ }
+
+ kvsp := getKeyValues(v.Len()) // for sorting keys
+ defer putKeyValues(kvsp)
+ kvs := *kvsp
+
+ kvBeginOffset := e.Len()
+ if err := me.e(e, em, v, kvs); err != nil {
+ return err
+ }
+ kvTotalLen := e.Len() - kvBeginOffset
+
+ // Use the capacity at the tail of the encode buffer as a staging area to rearrange the
+ // encoded pairs into sorted order.
+ e.Grow(kvTotalLen)
+ tmp := e.Bytes()[e.Len() : e.Len()+kvTotalLen] // Can use e.AvailableBuffer() in Go 1.21+.
+ dst := e.Bytes()[kvBeginOffset:]
+
+ if em.sort == SortBytewiseLexical {
+ sort.Sort(&bytewiseKeyValueSorter{kvs: kvs, data: dst})
+ } else {
+ sort.Sort(&lengthFirstKeyValueSorter{kvs: kvs, data: dst})
+ }
+
+ // This is where the encoded bytes are actually rearranged in the output buffer to reflect
+ // the desired order.
+ sortedOffset := 0
+ for _, kv := range kvs {
+ copy(tmp[sortedOffset:], dst[kv.offset:kv.nextOffset])
+ sortedOffset += kv.nextOffset - kv.offset
+ }
+ copy(dst, tmp[:kvTotalLen])
+
+ return nil
+
+}
+
+// keyValue is the position of an encoded pair in a buffer. All offsets are zero-based and relative
+// to the first byte of the first encoded pair.
+type keyValue struct {
+ offset int
+ valueOffset int
+ nextOffset int
+}
+
+type bytewiseKeyValueSorter struct {
+ kvs []keyValue
+ data []byte
+}
+
+func (x *bytewiseKeyValueSorter) Len() int {
+ return len(x.kvs)
+}
+
+func (x *bytewiseKeyValueSorter) Swap(i, j int) {
+ x.kvs[i], x.kvs[j] = x.kvs[j], x.kvs[i]
+}
+
+func (x *bytewiseKeyValueSorter) Less(i, j int) bool {
+ kvi, kvj := x.kvs[i], x.kvs[j]
+ return bytes.Compare(x.data[kvi.offset:kvi.valueOffset], x.data[kvj.offset:kvj.valueOffset]) <= 0
+}
+
+type lengthFirstKeyValueSorter struct {
+ kvs []keyValue
+ data []byte
+}
+
+func (x *lengthFirstKeyValueSorter) Len() int {
+ return len(x.kvs)
+}
+
+func (x *lengthFirstKeyValueSorter) Swap(i, j int) {
+ x.kvs[i], x.kvs[j] = x.kvs[j], x.kvs[i]
+}
+
+func (x *lengthFirstKeyValueSorter) Less(i, j int) bool {
+ kvi, kvj := x.kvs[i], x.kvs[j]
+ if keyLengthDifference := (kvi.valueOffset - kvi.offset) - (kvj.valueOffset - kvj.offset); keyLengthDifference != 0 {
+ return keyLengthDifference < 0
+ }
+ return bytes.Compare(x.data[kvi.offset:kvi.valueOffset], x.data[kvj.offset:kvj.valueOffset]) <= 0
+}
+
+var keyValuePool = sync.Pool{}
+
+func getKeyValues(length int) *[]keyValue {
+ v := keyValuePool.Get()
+ if v == nil {
+ y := make([]keyValue, length)
+ return &y
+ }
+ x := v.(*[]keyValue)
+ if cap(*x) >= length {
+ *x = (*x)[:length]
+ return x
+ }
+ // []keyValue from the pool does not have enough capacity.
+ // Return it back to the pool and create a new one.
+ keyValuePool.Put(x)
+ y := make([]keyValue, length)
+ return &y
+}
+
+func putKeyValues(x *[]keyValue) {
+ *x = (*x)[:0]
+ keyValuePool.Put(x)
+}
+
+func encodeStructToArray(e *bytes.Buffer, em *encMode, v reflect.Value) (err error) {
+ structType, err := getEncodingStructType(v.Type())
+ if err != nil {
+ return err
+ }
+
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+
+ flds := structType.fields
+
+ encodeHead(e, byte(cborTypeArray), uint64(len(flds)))
+ for i := 0; i < len(flds); i++ {
+ f := flds[i]
+
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ // Get embedded field value. No error is expected.
+ fv, _ = getFieldValue(v, f.idx, func(reflect.Value) (reflect.Value, error) {
+ // Write CBOR nil for null pointer to embedded struct
+ e.Write(cborNil)
+ return reflect.Value{}, nil
+ })
+ if !fv.IsValid() {
+ continue
+ }
+ }
+
+ if err := f.ef(e, em, fv); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func encodeStruct(e *bytes.Buffer, em *encMode, v reflect.Value) (err error) {
+ structType, err := getEncodingStructType(v.Type())
+ if err != nil {
+ return err
+ }
+
+ flds := structType.getFields(em)
+
+ start := 0
+ if em.sort == SortFastShuffle && len(flds) > 0 {
+ start = rand.Intn(len(flds)) //nolint:gosec // Don't need a CSPRNG for deck cutting.
+ }
+
+ if b := em.encTagBytes(v.Type()); b != nil {
+ e.Write(b)
+ }
+
+ // Encode head with struct field count.
+ // Head is rewritten later if actual encoded field count is different from struct field count.
+ encodedHeadLen := encodeHead(e, byte(cborTypeMap), uint64(len(flds)))
+
+ kvbegin := e.Len()
+ kvcount := 0
+ for offset := 0; offset < len(flds); offset++ {
+ f := flds[(start+offset)%len(flds)]
+
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ // Get embedded field value. No error is expected.
+ fv, _ = getFieldValue(v, f.idx, func(reflect.Value) (reflect.Value, error) {
+ // Skip null pointer to embedded struct
+ return reflect.Value{}, nil
+ })
+ if !fv.IsValid() {
+ continue
+ }
+ }
+ if f.omitEmpty {
+ empty, err := f.ief(em, fv)
+ if err != nil {
+ return err
+ }
+ if empty {
+ continue
+ }
+ }
+
+ if !f.keyAsInt && em.fieldName == FieldNameToByteString {
+ e.Write(f.cborNameByteString)
+ } else { // int or text string
+ e.Write(f.cborName)
+ }
+
+ if err := f.ef(e, em, fv); err != nil {
+ return err
+ }
+
+ kvcount++
+ }
+
+ if len(flds) == kvcount {
+ // Encoded element count in head is the same as actual element count.
+ return nil
+ }
+
+ // Overwrite the bytes that were reserved for the head before encoding the map entries.
+ var actualHeadLen int
+ {
+ headbuf := *bytes.NewBuffer(e.Bytes()[kvbegin-encodedHeadLen : kvbegin-encodedHeadLen : kvbegin])
+ actualHeadLen = encodeHead(&headbuf, byte(cborTypeMap), uint64(kvcount))
+ }
+
+ if actualHeadLen == encodedHeadLen {
+ // The bytes reserved for the encoded head were exactly the right size, so the
+ // encoded entries are already in their final positions.
+ return nil
+ }
+
+ // We reserved more bytes than needed for the encoded head, based on the number of fields
+ // encoded. The encoded entries are offset to the right by the number of excess reserved
+ // bytes. Shift the entries left to remove the gap.
+ excessReservedBytes := encodedHeadLen - actualHeadLen
+ dst := e.Bytes()[kvbegin-excessReservedBytes : e.Len()-excessReservedBytes]
+ src := e.Bytes()[kvbegin:e.Len()]
+ copy(dst, src)
+
+ // After shifting, the excess bytes are at the end of the output buffer and they are
+ // garbage.
+ e.Truncate(e.Len() - excessReservedBytes)
+ return nil
+}
+
+func encodeIntf(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if v.IsNil() {
+ e.Write(cborNil)
+ return nil
+ }
+ return encode(e, em, v.Elem())
+}
+
+func encodeTime(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ t := v.Interface().(time.Time)
+ if t.IsZero() {
+ e.Write(cborNil) // Even if tag is required, encode as CBOR null.
+ return nil
+ }
+ if em.timeTag == EncTagRequired {
+ tagNumber := 1
+ if em.time == TimeRFC3339 || em.time == TimeRFC3339Nano {
+ tagNumber = 0
+ }
+ encodeHead(e, byte(cborTypeTag), uint64(tagNumber))
+ }
+ switch em.time {
+ case TimeUnix:
+ secs := t.Unix()
+ return encodeInt(e, em, reflect.ValueOf(secs))
+
+ case TimeUnixMicro:
+ t = t.UTC().Round(time.Microsecond)
+ f := float64(t.UnixNano()) / 1e9
+ return encodeFloat(e, em, reflect.ValueOf(f))
+
+ case TimeUnixDynamic:
+ t = t.UTC().Round(time.Microsecond)
+ secs, nsecs := t.Unix(), uint64(t.Nanosecond())
+ if nsecs == 0 {
+ return encodeInt(e, em, reflect.ValueOf(secs))
+ }
+ f := float64(secs) + float64(nsecs)/1e9
+ return encodeFloat(e, em, reflect.ValueOf(f))
+
+ case TimeRFC3339:
+ s := t.Format(time.RFC3339)
+ return encodeString(e, em, reflect.ValueOf(s))
+
+ default: // TimeRFC3339Nano
+ s := t.Format(time.RFC3339Nano)
+ return encodeString(e, em, reflect.ValueOf(s))
+ }
+}
+
+func encodeBigInt(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.bigIntConvert == BigIntConvertReject {
+ return &UnsupportedTypeError{Type: typeBigInt}
+ }
+
+ vbi := v.Interface().(big.Int)
+ sign := vbi.Sign()
+ bi := new(big.Int).SetBytes(vbi.Bytes()) // bi is absolute value of v
+ if sign < 0 {
+ // For negative number, convert to CBOR encoded number (-v-1).
+ bi.Sub(bi, big.NewInt(1))
+ }
+
+ if em.bigIntConvert == BigIntConvertShortest {
+ if bi.IsUint64() {
+ if sign >= 0 {
+ // Encode as CBOR pos int (major type 0)
+ encodeHead(e, byte(cborTypePositiveInt), bi.Uint64())
+ return nil
+ }
+ // Encode as CBOR neg int (major type 1)
+ encodeHead(e, byte(cborTypeNegativeInt), bi.Uint64())
+ return nil
+ }
+ }
+
+ tagNum := 2
+ if sign < 0 {
+ tagNum = 3
+ }
+ // Write tag number
+ encodeHead(e, byte(cborTypeTag), uint64(tagNum))
+ // Write bignum byte string
+ b := bi.Bytes()
+ encodeHead(e, byte(cborTypeByteString), uint64(len(b)))
+ e.Write(b)
+ return nil
+}
+
+type binaryMarshalerEncoder struct {
+ alternateEncode encodeFunc
+ alternateIsEmpty isEmptyFunc
+}
+
+func (bme binaryMarshalerEncoder) encode(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.binaryMarshaler != BinaryMarshalerByteString {
+ return bme.alternateEncode(e, em, v)
+ }
+
+ vt := v.Type()
+ m, ok := v.Interface().(encoding.BinaryMarshaler)
+ if !ok {
+ pv := reflect.New(vt)
+ pv.Elem().Set(v)
+ m = pv.Interface().(encoding.BinaryMarshaler)
+ }
+ data, err := m.MarshalBinary()
+ if err != nil {
+ return err
+ }
+ if b := em.encTagBytes(vt); b != nil {
+ e.Write(b)
+ }
+ encodeHead(e, byte(cborTypeByteString), uint64(len(data)))
+ e.Write(data)
+ return nil
+}
+
+func (bme binaryMarshalerEncoder) isEmpty(em *encMode, v reflect.Value) (bool, error) {
+ if em.binaryMarshaler != BinaryMarshalerByteString {
+ return bme.alternateIsEmpty(em, v)
+ }
+
+ m, ok := v.Interface().(encoding.BinaryMarshaler)
+ if !ok {
+ pv := reflect.New(v.Type())
+ pv.Elem().Set(v)
+ m = pv.Interface().(encoding.BinaryMarshaler)
+ }
+ data, err := m.MarshalBinary()
+ if err != nil {
+ return false, err
+ }
+ return len(data) == 0, nil
+}
+
+func encodeMarshalerType(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.tagsMd == TagsForbidden && v.Type() == typeRawTag {
+ return errors.New("cbor: cannot encode cbor.RawTag when TagsMd is TagsForbidden")
+ }
+ m, ok := v.Interface().(Marshaler)
+ if !ok {
+ pv := reflect.New(v.Type())
+ pv.Elem().Set(v)
+ m = pv.Interface().(Marshaler)
+ }
+ data, err := m.MarshalCBOR()
+ if err != nil {
+ return err
+ }
+
+ // Verify returned CBOR data item from MarshalCBOR() is well-formed and passes tag validity for builtin tags 0-3.
+ d := decoder{data: data, dm: getMarshalerDecMode(em.indefLength, em.tagsMd)}
+ err = d.wellformed(false, true)
+ if err != nil {
+ return &MarshalerError{typ: v.Type(), err: err}
+ }
+
+ e.Write(data)
+ return nil
+}
+
+func encodeTag(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ if em.tagsMd == TagsForbidden {
+ return errors.New("cbor: cannot encode cbor.Tag when TagsMd is TagsForbidden")
+ }
+
+ t := v.Interface().(Tag)
+
+ if t.Number == 0 && t.Content == nil {
+ // Marshal uninitialized cbor.Tag
+ e.Write(cborNil)
+ return nil
+ }
+
+ // Marshal tag number
+ encodeHead(e, byte(cborTypeTag), t.Number)
+
+ vem := *em // shallow copy
+
+ // For built-in tags, disable settings that may introduce tag validity errors when
+ // marshaling certain Content values.
+ switch t.Number {
+ case tagNumRFC3339Time:
+ vem.stringType = StringToTextString
+ vem.stringMajorType = cborTypeTextString
+ case tagNumUnsignedBignum, tagNumNegativeBignum:
+ vem.byteSliceLaterFormat = ByteSliceLaterFormatNone
+ vem.byteSliceLaterEncodingTag = 0
+ }
+
+ // Marshal tag content
+ return encode(e, &vem, reflect.ValueOf(t.Content))
+}
+
+// encodeHead writes CBOR head of specified type t and returns number of bytes written.
+func encodeHead(e *bytes.Buffer, t byte, n uint64) int {
+ if n <= maxAdditionalInformationWithoutArgument {
+ const headSize = 1
+ e.WriteByte(t | byte(n))
+ return headSize
+ }
+
+ if n <= math.MaxUint8 {
+ const headSize = 2
+ scratch := [headSize]byte{
+ t | byte(additionalInformationWith1ByteArgument),
+ byte(n),
+ }
+ e.Write(scratch[:])
+ return headSize
+ }
+
+ if n <= math.MaxUint16 {
+ const headSize = 3
+ var scratch [headSize]byte
+ scratch[0] = t | byte(additionalInformationWith2ByteArgument)
+ binary.BigEndian.PutUint16(scratch[1:], uint16(n))
+ e.Write(scratch[:])
+ return headSize
+ }
+
+ if n <= math.MaxUint32 {
+ const headSize = 5
+ var scratch [headSize]byte
+ scratch[0] = t | byte(additionalInformationWith4ByteArgument)
+ binary.BigEndian.PutUint32(scratch[1:], uint32(n))
+ e.Write(scratch[:])
+ return headSize
+ }
+
+ const headSize = 9
+ var scratch [headSize]byte
+ scratch[0] = t | byte(additionalInformationWith8ByteArgument)
+ binary.BigEndian.PutUint64(scratch[1:], n)
+ e.Write(scratch[:])
+ return headSize
+}
+
+var (
+ typeMarshaler = reflect.TypeOf((*Marshaler)(nil)).Elem()
+ typeBinaryMarshaler = reflect.TypeOf((*encoding.BinaryMarshaler)(nil)).Elem()
+ typeRawMessage = reflect.TypeOf(RawMessage(nil))
+ typeByteString = reflect.TypeOf(ByteString(""))
+)
+
+func getEncodeFuncInternal(t reflect.Type) (ef encodeFunc, ief isEmptyFunc) {
+ k := t.Kind()
+ if k == reflect.Ptr {
+ return getEncodeIndirectValueFunc(t), isEmptyPtr
+ }
+ switch t {
+ case typeSimpleValue:
+ return encodeMarshalerType, isEmptyUint
+
+ case typeTag:
+ return encodeTag, alwaysNotEmpty
+
+ case typeTime:
+ return encodeTime, alwaysNotEmpty
+
+ case typeBigInt:
+ return encodeBigInt, alwaysNotEmpty
+
+ case typeRawMessage:
+ return encodeMarshalerType, isEmptySlice
+
+ case typeByteString:
+ return encodeMarshalerType, isEmptyString
+ }
+ if reflect.PtrTo(t).Implements(typeMarshaler) {
+ return encodeMarshalerType, alwaysNotEmpty
+ }
+ if reflect.PtrTo(t).Implements(typeBinaryMarshaler) {
+ defer func() {
+ // capture encoding method used for modes that disable BinaryMarshaler
+ bme := binaryMarshalerEncoder{
+ alternateEncode: ef,
+ alternateIsEmpty: ief,
+ }
+ ef = bme.encode
+ ief = bme.isEmpty
+ }()
+ }
+ switch k {
+ case reflect.Bool:
+ return encodeBool, isEmptyBool
+
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return encodeInt, isEmptyInt
+
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+ return encodeUint, isEmptyUint
+
+ case reflect.Float32, reflect.Float64:
+ return encodeFloat, isEmptyFloat
+
+ case reflect.String:
+ return encodeString, isEmptyString
+
+ case reflect.Slice:
+ if t.Elem().Kind() == reflect.Uint8 {
+ return encodeByteString, isEmptySlice
+ }
+ fallthrough
+
+ case reflect.Array:
+ f, _ := getEncodeFunc(t.Elem())
+ if f == nil {
+ return nil, nil
+ }
+ return arrayEncodeFunc{f: f}.encode, isEmptySlice
+
+ case reflect.Map:
+ f := getEncodeMapFunc(t)
+ if f == nil {
+ return nil, nil
+ }
+ return f, isEmptyMap
+
+ case reflect.Struct:
+ // Get struct's special field "_" tag options
+ if f, ok := t.FieldByName("_"); ok {
+ tag := f.Tag.Get("cbor")
+ if tag != "-" {
+ if hasToArrayOption(tag) {
+ return encodeStructToArray, isEmptyStruct
+ }
+ }
+ }
+ return encodeStruct, isEmptyStruct
+
+ case reflect.Interface:
+ return encodeIntf, isEmptyIntf
+ }
+ return nil, nil
+}
+
+func getEncodeIndirectValueFunc(t reflect.Type) encodeFunc {
+ for t.Kind() == reflect.Ptr {
+ t = t.Elem()
+ }
+ f, _ := getEncodeFunc(t)
+ if f == nil {
+ return nil
+ }
+ return func(e *bytes.Buffer, em *encMode, v reflect.Value) error {
+ for v.Kind() == reflect.Ptr && !v.IsNil() {
+ v = v.Elem()
+ }
+ if v.Kind() == reflect.Ptr && v.IsNil() {
+ e.Write(cborNil)
+ return nil
+ }
+ return f(e, em, v)
+ }
+}
+
+func alwaysNotEmpty(_ *encMode, _ reflect.Value) (empty bool, err error) {
+ return false, nil
+}
+
+func isEmptyBool(_ *encMode, v reflect.Value) (bool, error) {
+ return !v.Bool(), nil
+}
+
+func isEmptyInt(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Int() == 0, nil
+}
+
+func isEmptyUint(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Uint() == 0, nil
+}
+
+func isEmptyFloat(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Float() == 0.0, nil
+}
+
+func isEmptyString(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Len() == 0, nil
+}
+
+func isEmptySlice(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Len() == 0, nil
+}
+
+func isEmptyMap(_ *encMode, v reflect.Value) (bool, error) {
+ return v.Len() == 0, nil
+}
+
+func isEmptyPtr(_ *encMode, v reflect.Value) (bool, error) {
+ return v.IsNil(), nil
+}
+
+func isEmptyIntf(_ *encMode, v reflect.Value) (bool, error) {
+ return v.IsNil(), nil
+}
+
+func isEmptyStruct(em *encMode, v reflect.Value) (bool, error) {
+ structType, err := getEncodingStructType(v.Type())
+ if err != nil {
+ return false, err
+ }
+
+ if em.omitEmpty == OmitEmptyGoValue {
+ return false, nil
+ }
+
+ if structType.toArray {
+ return len(structType.fields) == 0, nil
+ }
+
+ if len(structType.fields) > len(structType.omitEmptyFieldsIdx) {
+ return false, nil
+ }
+
+ for _, i := range structType.omitEmptyFieldsIdx {
+ f := structType.fields[i]
+
+ // Get field value
+ var fv reflect.Value
+ if len(f.idx) == 1 {
+ fv = v.Field(f.idx[0])
+ } else {
+ // Get embedded field value. No error is expected.
+ fv, _ = getFieldValue(v, f.idx, func(reflect.Value) (reflect.Value, error) {
+ // Skip null pointer to embedded struct
+ return reflect.Value{}, nil
+ })
+ if !fv.IsValid() {
+ continue
+ }
+ }
+
+ empty, err := f.ief(em, fv)
+ if err != nil {
+ return false, err
+ }
+ if !empty {
+ return false, nil
+ }
+ }
+ return true, nil
+}
+
+func cannotFitFloat32(f64 float64) bool {
+ f32 := float32(f64)
+ return float64(f32) != f64
+}
+
+// float32NaNFromReflectValue extracts float32 NaN from reflect.Value while preserving NaN's quiet bit.
+func float32NaNFromReflectValue(v reflect.Value) float32 {
+ // Keith Randall's workaround for issue https://github.com/golang/go/issues/36400
+ p := reflect.New(v.Type())
+ p.Elem().Set(v)
+ f32 := p.Convert(reflect.TypeOf((*float32)(nil))).Elem().Interface().(float32)
+ return f32
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/encode_map.go b/vendor/github.com/fxamacker/cbor/v2/encode_map.go
new file mode 100644
index 000000000..8b4b4bbc5
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/encode_map.go
@@ -0,0 +1,94 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+//go:build go1.20
+
+package cbor
+
+import (
+ "bytes"
+ "reflect"
+ "sync"
+)
+
+type mapKeyValueEncodeFunc struct {
+ kf, ef encodeFunc
+ kpool, vpool sync.Pool
+}
+
+func (me *mapKeyValueEncodeFunc) encodeKeyValues(e *bytes.Buffer, em *encMode, v reflect.Value, kvs []keyValue) error {
+ iterk := me.kpool.Get().(*reflect.Value)
+ defer func() {
+ iterk.SetZero()
+ me.kpool.Put(iterk)
+ }()
+ iterv := me.vpool.Get().(*reflect.Value)
+ defer func() {
+ iterv.SetZero()
+ me.vpool.Put(iterv)
+ }()
+
+ if kvs == nil {
+ for i, iter := 0, v.MapRange(); iter.Next(); i++ {
+ iterk.SetIterKey(iter)
+ iterv.SetIterValue(iter)
+
+ if err := me.kf(e, em, *iterk); err != nil {
+ return err
+ }
+ if err := me.ef(e, em, *iterv); err != nil {
+ return err
+ }
+ }
+ return nil
+ }
+
+ initial := e.Len()
+ for i, iter := 0, v.MapRange(); iter.Next(); i++ {
+ iterk.SetIterKey(iter)
+ iterv.SetIterValue(iter)
+
+ offset := e.Len()
+ if err := me.kf(e, em, *iterk); err != nil {
+ return err
+ }
+ valueOffset := e.Len()
+ if err := me.ef(e, em, *iterv); err != nil {
+ return err
+ }
+ kvs[i] = keyValue{
+ offset: offset - initial,
+ valueOffset: valueOffset - initial,
+ nextOffset: e.Len() - initial,
+ }
+ }
+
+ return nil
+}
+
+func getEncodeMapFunc(t reflect.Type) encodeFunc {
+ kf, _ := getEncodeFunc(t.Key())
+ ef, _ := getEncodeFunc(t.Elem())
+ if kf == nil || ef == nil {
+ return nil
+ }
+ mkv := &mapKeyValueEncodeFunc{
+ kf: kf,
+ ef: ef,
+ kpool: sync.Pool{
+ New: func() interface{} {
+ rk := reflect.New(t.Key()).Elem()
+ return &rk
+ },
+ },
+ vpool: sync.Pool{
+ New: func() interface{} {
+ rv := reflect.New(t.Elem()).Elem()
+ return &rv
+ },
+ },
+ }
+ return mapEncodeFunc{
+ e: mkv.encodeKeyValues,
+ }.encode
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/encode_map_go117.go b/vendor/github.com/fxamacker/cbor/v2/encode_map_go117.go
new file mode 100644
index 000000000..31c39336d
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/encode_map_go117.go
@@ -0,0 +1,60 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+//go:build !go1.20
+
+package cbor
+
+import (
+ "bytes"
+ "reflect"
+)
+
+type mapKeyValueEncodeFunc struct {
+ kf, ef encodeFunc
+}
+
+func (me *mapKeyValueEncodeFunc) encodeKeyValues(e *bytes.Buffer, em *encMode, v reflect.Value, kvs []keyValue) error {
+ if kvs == nil {
+ for i, iter := 0, v.MapRange(); iter.Next(); i++ {
+ if err := me.kf(e, em, iter.Key()); err != nil {
+ return err
+ }
+ if err := me.ef(e, em, iter.Value()); err != nil {
+ return err
+ }
+ }
+ return nil
+ }
+
+ initial := e.Len()
+ for i, iter := 0, v.MapRange(); iter.Next(); i++ {
+ offset := e.Len()
+ if err := me.kf(e, em, iter.Key()); err != nil {
+ return err
+ }
+ valueOffset := e.Len()
+ if err := me.ef(e, em, iter.Value()); err != nil {
+ return err
+ }
+ kvs[i] = keyValue{
+ offset: offset - initial,
+ valueOffset: valueOffset - initial,
+ nextOffset: e.Len() - initial,
+ }
+ }
+
+ return nil
+}
+
+func getEncodeMapFunc(t reflect.Type) encodeFunc {
+ kf, _ := getEncodeFunc(t.Key())
+ ef, _ := getEncodeFunc(t.Elem())
+ if kf == nil || ef == nil {
+ return nil
+ }
+ mkv := &mapKeyValueEncodeFunc{kf: kf, ef: ef}
+ return mapEncodeFunc{
+ e: mkv.encodeKeyValues,
+ }.encode
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/simplevalue.go b/vendor/github.com/fxamacker/cbor/v2/simplevalue.go
new file mode 100644
index 000000000..de175cee4
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/simplevalue.go
@@ -0,0 +1,69 @@
+package cbor
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+)
+
+// SimpleValue represents CBOR simple value.
+// CBOR simple value is:
+// - an extension point like CBOR tag.
+// - a subset of CBOR major type 7 that isn't floating-point.
+// - "identified by a number between 0 and 255, but distinct from that number itself".
+// For example, "a simple value 2 is not equivalent to an integer 2" as a CBOR map key.
+//
+// CBOR simple values identified by 20..23 are: "false", "true" , "null", and "undefined".
+// Other CBOR simple values are currently unassigned/reserved by IANA.
+type SimpleValue uint8
+
+var (
+ typeSimpleValue = reflect.TypeOf(SimpleValue(0))
+)
+
+// MarshalCBOR encodes SimpleValue as CBOR simple value (major type 7).
+func (sv SimpleValue) MarshalCBOR() ([]byte, error) {
+ // RFC 8949 3.3. Floating-Point Numbers and Values with No Content says:
+ // "An encoder MUST NOT issue two-byte sequences that start with 0xf8
+ // (major type 7, additional information 24) and continue with a byte
+ // less than 0x20 (32 decimal). Such sequences are not well-formed.
+ // (This implies that an encoder cannot encode false, true, null, or
+ // undefined in two-byte sequences and that only the one-byte variants
+ // of these are well-formed; more generally speaking, each simple value
+ // only has a single representation variant)."
+
+ switch {
+ case sv <= maxSimpleValueInAdditionalInformation:
+ return []byte{byte(cborTypePrimitives) | byte(sv)}, nil
+
+ case sv >= minSimpleValueIn1ByteArgument:
+ return []byte{byte(cborTypePrimitives) | additionalInformationWith1ByteArgument, byte(sv)}, nil
+
+ default:
+ return nil, &UnsupportedValueError{msg: fmt.Sprintf("SimpleValue(%d)", sv)}
+ }
+}
+
+// UnmarshalCBOR decodes CBOR simple value (major type 7) to SimpleValue.
+func (sv *SimpleValue) UnmarshalCBOR(data []byte) error {
+ if sv == nil {
+ return errors.New("cbor.SimpleValue: UnmarshalCBOR on nil pointer")
+ }
+
+ d := decoder{data: data, dm: defaultDecMode}
+
+ typ, ai, val := d.getHead()
+
+ if typ != cborTypePrimitives {
+ return &UnmarshalTypeError{CBORType: typ.String(), GoType: "SimpleValue"}
+ }
+ if ai > additionalInformationWith1ByteArgument {
+ return &UnmarshalTypeError{CBORType: typ.String(), GoType: "SimpleValue", errorMsg: "not simple values"}
+ }
+
+ // It is safe to cast val to uint8 here because
+ // - data is already verified to be well-formed CBOR simple value and
+ // - val is <= math.MaxUint8.
+ *sv = SimpleValue(val)
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/stream.go b/vendor/github.com/fxamacker/cbor/v2/stream.go
new file mode 100644
index 000000000..507ab6c18
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/stream.go
@@ -0,0 +1,277 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "bytes"
+ "errors"
+ "io"
+ "reflect"
+)
+
+// Decoder reads and decodes CBOR values from io.Reader.
+type Decoder struct {
+ r io.Reader
+ d decoder
+ buf []byte
+ off int // next read offset in buf
+ bytesRead int
+}
+
+// NewDecoder returns a new decoder that reads and decodes from r using
+// the default decoding options.
+func NewDecoder(r io.Reader) *Decoder {
+ return defaultDecMode.NewDecoder(r)
+}
+
+// Decode reads CBOR value and decodes it into the value pointed to by v.
+func (dec *Decoder) Decode(v interface{}) error {
+ _, err := dec.readNext()
+ if err != nil {
+ // Return validation error or read error.
+ return err
+ }
+
+ dec.d.reset(dec.buf[dec.off:])
+ err = dec.d.value(v)
+
+ // Increment dec.off even if decoding err is not nil because
+ // dec.d.off points to the next CBOR data item if current
+ // CBOR data item is valid but failed to be decoded into v.
+ // This allows next CBOR data item to be decoded in next
+ // call to this function.
+ dec.off += dec.d.off
+ dec.bytesRead += dec.d.off
+
+ return err
+}
+
+// Skip skips to the next CBOR data item (if there is any),
+// otherwise it returns error such as io.EOF, io.UnexpectedEOF, etc.
+func (dec *Decoder) Skip() error {
+ n, err := dec.readNext()
+ if err != nil {
+ // Return validation error or read error.
+ return err
+ }
+
+ dec.off += n
+ dec.bytesRead += n
+ return nil
+}
+
+// NumBytesRead returns the number of bytes read.
+func (dec *Decoder) NumBytesRead() int {
+ return dec.bytesRead
+}
+
+// Buffered returns a reader for data remaining in Decoder's buffer.
+// Returned reader is valid until the next call to Decode or Skip.
+func (dec *Decoder) Buffered() io.Reader {
+ return bytes.NewReader(dec.buf[dec.off:])
+}
+
+// readNext() reads next CBOR data item from Reader to buffer.
+// It returns the size of next CBOR data item.
+// It also returns validation error or read error if any.
+func (dec *Decoder) readNext() (int, error) {
+ var readErr error
+ var validErr error
+
+ for {
+ // Process any unread data in dec.buf.
+ if dec.off < len(dec.buf) {
+ dec.d.reset(dec.buf[dec.off:])
+ off := dec.off // Save offset before data validation
+ validErr = dec.d.wellformed(true, false)
+ dec.off = off // Restore offset
+
+ if validErr == nil {
+ return dec.d.off, nil
+ }
+
+ if validErr != io.ErrUnexpectedEOF {
+ return 0, validErr
+ }
+
+ // Process last read error on io.ErrUnexpectedEOF.
+ if readErr != nil {
+ if readErr == io.EOF {
+ // current CBOR data item is incomplete.
+ return 0, io.ErrUnexpectedEOF
+ }
+ return 0, readErr
+ }
+ }
+
+ // More data is needed and there was no read error.
+ var n int
+ for n == 0 {
+ n, readErr = dec.read()
+ if n == 0 && readErr != nil {
+ // No more data can be read and read error is encountered.
+ // At this point, validErr is either nil or io.ErrUnexpectedEOF.
+ if readErr == io.EOF {
+ if validErr == io.ErrUnexpectedEOF {
+ // current CBOR data item is incomplete.
+ return 0, io.ErrUnexpectedEOF
+ }
+ }
+ return 0, readErr
+ }
+ }
+
+ // At this point, dec.buf contains new data from last read (n > 0).
+ }
+}
+
+// read() reads data from Reader to buffer.
+// It returns number of bytes read and any read error encountered.
+// Postconditions:
+// - dec.buf contains previously unread data and new data.
+// - dec.off is 0.
+func (dec *Decoder) read() (int, error) {
+ // Grow buf if needed.
+ const minRead = 512
+ if cap(dec.buf)-len(dec.buf)+dec.off < minRead {
+ oldUnreadBuf := dec.buf[dec.off:]
+ dec.buf = make([]byte, len(dec.buf)-dec.off, 2*cap(dec.buf)+minRead)
+ dec.overwriteBuf(oldUnreadBuf)
+ }
+
+ // Copy unread data over read data and reset off to 0.
+ if dec.off > 0 {
+ dec.overwriteBuf(dec.buf[dec.off:])
+ }
+
+ // Read from reader and reslice buf.
+ n, err := dec.r.Read(dec.buf[len(dec.buf):cap(dec.buf)])
+ dec.buf = dec.buf[0 : len(dec.buf)+n]
+ return n, err
+}
+
+func (dec *Decoder) overwriteBuf(newBuf []byte) {
+ n := copy(dec.buf, newBuf)
+ dec.buf = dec.buf[:n]
+ dec.off = 0
+}
+
+// Encoder writes CBOR values to io.Writer.
+type Encoder struct {
+ w io.Writer
+ em *encMode
+ indefTypes []cborType
+}
+
+// NewEncoder returns a new encoder that writes to w using the default encoding options.
+func NewEncoder(w io.Writer) *Encoder {
+ return defaultEncMode.NewEncoder(w)
+}
+
+// Encode writes the CBOR encoding of v.
+func (enc *Encoder) Encode(v interface{}) error {
+ if len(enc.indefTypes) > 0 && v != nil {
+ indefType := enc.indefTypes[len(enc.indefTypes)-1]
+ if indefType == cborTypeTextString {
+ k := reflect.TypeOf(v).Kind()
+ if k != reflect.String {
+ return errors.New("cbor: cannot encode item type " + k.String() + " for indefinite-length text string")
+ }
+ } else if indefType == cborTypeByteString {
+ t := reflect.TypeOf(v)
+ k := t.Kind()
+ if (k != reflect.Array && k != reflect.Slice) || t.Elem().Kind() != reflect.Uint8 {
+ return errors.New("cbor: cannot encode item type " + k.String() + " for indefinite-length byte string")
+ }
+ }
+ }
+
+ buf := getEncodeBuffer()
+
+ err := encode(buf, enc.em, reflect.ValueOf(v))
+ if err == nil {
+ _, err = enc.w.Write(buf.Bytes())
+ }
+
+ putEncodeBuffer(buf)
+ return err
+}
+
+// StartIndefiniteByteString starts byte string encoding of indefinite length.
+// Subsequent calls of (*Encoder).Encode() encodes definite length byte strings
+// ("chunks") as one contiguous string until EndIndefinite is called.
+func (enc *Encoder) StartIndefiniteByteString() error {
+ return enc.startIndefinite(cborTypeByteString)
+}
+
+// StartIndefiniteTextString starts text string encoding of indefinite length.
+// Subsequent calls of (*Encoder).Encode() encodes definite length text strings
+// ("chunks") as one contiguous string until EndIndefinite is called.
+func (enc *Encoder) StartIndefiniteTextString() error {
+ return enc.startIndefinite(cborTypeTextString)
+}
+
+// StartIndefiniteArray starts array encoding of indefinite length.
+// Subsequent calls of (*Encoder).Encode() encodes elements of the array
+// until EndIndefinite is called.
+func (enc *Encoder) StartIndefiniteArray() error {
+ return enc.startIndefinite(cborTypeArray)
+}
+
+// StartIndefiniteMap starts array encoding of indefinite length.
+// Subsequent calls of (*Encoder).Encode() encodes elements of the map
+// until EndIndefinite is called.
+func (enc *Encoder) StartIndefiniteMap() error {
+ return enc.startIndefinite(cborTypeMap)
+}
+
+// EndIndefinite closes last opened indefinite length value.
+func (enc *Encoder) EndIndefinite() error {
+ if len(enc.indefTypes) == 0 {
+ return errors.New("cbor: cannot encode \"break\" code outside indefinite length values")
+ }
+ _, err := enc.w.Write([]byte{cborBreakFlag})
+ if err == nil {
+ enc.indefTypes = enc.indefTypes[:len(enc.indefTypes)-1]
+ }
+ return err
+}
+
+var cborIndefHeader = map[cborType][]byte{
+ cborTypeByteString: {cborByteStringWithIndefiniteLengthHead},
+ cborTypeTextString: {cborTextStringWithIndefiniteLengthHead},
+ cborTypeArray: {cborArrayWithIndefiniteLengthHead},
+ cborTypeMap: {cborMapWithIndefiniteLengthHead},
+}
+
+func (enc *Encoder) startIndefinite(typ cborType) error {
+ if enc.em.indefLength == IndefLengthForbidden {
+ return &IndefiniteLengthError{typ}
+ }
+ _, err := enc.w.Write(cborIndefHeader[typ])
+ if err == nil {
+ enc.indefTypes = append(enc.indefTypes, typ)
+ }
+ return err
+}
+
+// RawMessage is a raw encoded CBOR value.
+type RawMessage []byte
+
+// MarshalCBOR returns m or CBOR nil if m is nil.
+func (m RawMessage) MarshalCBOR() ([]byte, error) {
+ if len(m) == 0 {
+ return cborNil, nil
+ }
+ return m, nil
+}
+
+// UnmarshalCBOR creates a copy of data and saves to *m.
+func (m *RawMessage) UnmarshalCBOR(data []byte) error {
+ if m == nil {
+ return errors.New("cbor.RawMessage: UnmarshalCBOR on nil pointer")
+ }
+ *m = append((*m)[0:0], data...)
+ return nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/structfields.go b/vendor/github.com/fxamacker/cbor/v2/structfields.go
new file mode 100644
index 000000000..81228acf0
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/structfields.go
@@ -0,0 +1,260 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "reflect"
+ "sort"
+ "strings"
+)
+
+type field struct {
+ name string
+ nameAsInt int64 // used to decoder to match field name with CBOR int
+ cborName []byte
+ cborNameByteString []byte // major type 2 name encoding iff cborName has major type 3
+ idx []int
+ typ reflect.Type
+ ef encodeFunc
+ ief isEmptyFunc
+ typInfo *typeInfo // used to decoder to reuse type info
+ tagged bool // used to choose dominant field (at the same level tagged fields dominate untagged fields)
+ omitEmpty bool // used to skip empty field
+ keyAsInt bool // used to encode/decode field name as int
+}
+
+type fields []*field
+
+// indexFieldSorter sorts fields by field idx at each level, breaking ties with idx depth.
+type indexFieldSorter struct {
+ fields fields
+}
+
+func (x *indexFieldSorter) Len() int {
+ return len(x.fields)
+}
+
+func (x *indexFieldSorter) Swap(i, j int) {
+ x.fields[i], x.fields[j] = x.fields[j], x.fields[i]
+}
+
+func (x *indexFieldSorter) Less(i, j int) bool {
+ iIdx, jIdx := x.fields[i].idx, x.fields[j].idx
+ for k := 0; k < len(iIdx) && k < len(jIdx); k++ {
+ if iIdx[k] != jIdx[k] {
+ return iIdx[k] < jIdx[k]
+ }
+ }
+ return len(iIdx) <= len(jIdx)
+}
+
+// nameLevelAndTagFieldSorter sorts fields by field name, idx depth, and presence of tag.
+type nameLevelAndTagFieldSorter struct {
+ fields fields
+}
+
+func (x *nameLevelAndTagFieldSorter) Len() int {
+ return len(x.fields)
+}
+
+func (x *nameLevelAndTagFieldSorter) Swap(i, j int) {
+ x.fields[i], x.fields[j] = x.fields[j], x.fields[i]
+}
+
+func (x *nameLevelAndTagFieldSorter) Less(i, j int) bool {
+ fi, fj := x.fields[i], x.fields[j]
+ if fi.name != fj.name {
+ return fi.name < fj.name
+ }
+ if len(fi.idx) != len(fj.idx) {
+ return len(fi.idx) < len(fj.idx)
+ }
+ if fi.tagged != fj.tagged {
+ return fi.tagged
+ }
+ return i < j // Field i and j have the same name, depth, and tagged status. Nothing else matters.
+}
+
+// getFields returns visible fields of struct type t following visibility rules for JSON encoding.
+func getFields(t reflect.Type) (flds fields, structOptions string) {
+ // Get special field "_" tag options
+ if f, ok := t.FieldByName("_"); ok {
+ tag := f.Tag.Get("cbor")
+ if tag != "-" {
+ structOptions = tag
+ }
+ }
+
+ // nTypes contains next level anonymous fields' types and indexes
+ // (there can be multiple fields of the same type at the same level)
+ flds, nTypes := appendFields(t, nil, nil, nil)
+
+ if len(nTypes) > 0 {
+
+ var cTypes map[reflect.Type][][]int // current level anonymous fields' types and indexes
+ vTypes := map[reflect.Type]bool{t: true} // visited field types at less nested levels
+
+ for len(nTypes) > 0 {
+ cTypes, nTypes = nTypes, nil
+
+ for t, idx := range cTypes {
+ // If there are multiple anonymous fields of the same struct type at the same level, all are ignored.
+ if len(idx) > 1 {
+ continue
+ }
+
+ // Anonymous field of the same type at deeper nested level is ignored.
+ if vTypes[t] {
+ continue
+ }
+ vTypes[t] = true
+
+ flds, nTypes = appendFields(t, idx[0], flds, nTypes)
+ }
+ }
+ }
+
+ sort.Sort(&nameLevelAndTagFieldSorter{flds})
+
+ // Keep visible fields.
+ j := 0 // index of next unique field
+ for i := 0; i < len(flds); {
+ name := flds[i].name
+ if i == len(flds)-1 || // last field
+ name != flds[i+1].name || // field i has unique field name
+ len(flds[i].idx) < len(flds[i+1].idx) || // field i is at a less nested level than field i+1
+ (flds[i].tagged && !flds[i+1].tagged) { // field i is tagged while field i+1 is not
+ flds[j] = flds[i]
+ j++
+ }
+
+ // Skip fields with the same field name.
+ for i++; i < len(flds) && name == flds[i].name; i++ { //nolint:revive
+ }
+ }
+ if j != len(flds) {
+ flds = flds[:j]
+ }
+
+ // Sort fields by field index
+ sort.Sort(&indexFieldSorter{flds})
+
+ return flds, structOptions
+}
+
+// appendFields appends type t's exportable fields to flds and anonymous struct fields to nTypes .
+func appendFields(
+ t reflect.Type,
+ idx []int,
+ flds fields,
+ nTypes map[reflect.Type][][]int,
+) (
+ _flds fields,
+ _nTypes map[reflect.Type][][]int,
+) {
+ for i := 0; i < t.NumField(); i++ {
+ f := t.Field(i)
+
+ ft := f.Type
+ for ft.Kind() == reflect.Ptr {
+ ft = ft.Elem()
+ }
+
+ if !isFieldExportable(f, ft.Kind()) {
+ continue
+ }
+
+ tag := f.Tag.Get("cbor")
+ if tag == "" {
+ tag = f.Tag.Get("json")
+ }
+ if tag == "-" {
+ continue
+ }
+
+ tagged := tag != ""
+
+ // Parse field tag options
+ var tagFieldName string
+ var omitempty, keyasint bool
+ for j := 0; tag != ""; j++ {
+ var token string
+ idx := strings.IndexByte(tag, ',')
+ if idx == -1 {
+ token, tag = tag, ""
+ } else {
+ token, tag = tag[:idx], tag[idx+1:]
+ }
+ if j == 0 {
+ tagFieldName = token
+ } else {
+ switch token {
+ case "omitempty":
+ omitempty = true
+ case "keyasint":
+ keyasint = true
+ }
+ }
+ }
+
+ fieldName := tagFieldName
+ if tagFieldName == "" {
+ fieldName = f.Name
+ }
+
+ fIdx := make([]int, len(idx)+1)
+ copy(fIdx, idx)
+ fIdx[len(fIdx)-1] = i
+
+ if !f.Anonymous || ft.Kind() != reflect.Struct || tagFieldName != "" {
+ flds = append(flds, &field{
+ name: fieldName,
+ idx: fIdx,
+ typ: f.Type,
+ omitEmpty: omitempty,
+ keyAsInt: keyasint,
+ tagged: tagged})
+ } else {
+ if nTypes == nil {
+ nTypes = make(map[reflect.Type][][]int)
+ }
+ nTypes[ft] = append(nTypes[ft], fIdx)
+ }
+ }
+
+ return flds, nTypes
+}
+
+// isFieldExportable returns true if f is an exportable (regular or anonymous) field or
+// a nonexportable anonymous field of struct type.
+// Nonexportable anonymous field of struct type can contain exportable fields.
+func isFieldExportable(f reflect.StructField, fk reflect.Kind) bool { //nolint:gocritic // ignore hugeParam
+ exportable := f.PkgPath == ""
+ return exportable || (f.Anonymous && fk == reflect.Struct)
+}
+
+type embeddedFieldNullPtrFunc func(reflect.Value) (reflect.Value, error)
+
+// getFieldValue returns field value of struct v by index. When encountering null pointer
+// to anonymous (embedded) struct field, f is called with the last traversed field value.
+func getFieldValue(v reflect.Value, idx []int, f embeddedFieldNullPtrFunc) (fv reflect.Value, err error) {
+ fv = v
+ for i, n := range idx {
+ fv = fv.Field(n)
+
+ if i < len(idx)-1 {
+ if fv.Kind() == reflect.Ptr && fv.Type().Elem().Kind() == reflect.Struct {
+ if fv.IsNil() {
+ // Null pointer to embedded struct field
+ fv, err = f(fv)
+ if err != nil || !fv.IsValid() {
+ return fv, err
+ }
+ }
+ fv = fv.Elem()
+ }
+ }
+ }
+ return fv, nil
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/tag.go b/vendor/github.com/fxamacker/cbor/v2/tag.go
new file mode 100644
index 000000000..5c4d2b7a4
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/tag.go
@@ -0,0 +1,299 @@
+package cbor
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+ "sync"
+)
+
+// Tag represents CBOR tag data, including tag number and unmarshaled tag content. Marshaling and
+// unmarshaling of tag content is subject to any encode and decode options that would apply to
+// enclosed data item if it were to appear outside of a tag.
+type Tag struct {
+ Number uint64
+ Content interface{}
+}
+
+// RawTag represents CBOR tag data, including tag number and raw tag content.
+// RawTag implements Unmarshaler and Marshaler interfaces.
+type RawTag struct {
+ Number uint64
+ Content RawMessage
+}
+
+// UnmarshalCBOR sets *t with tag number and raw tag content copied from data.
+func (t *RawTag) UnmarshalCBOR(data []byte) error {
+ if t == nil {
+ return errors.New("cbor.RawTag: UnmarshalCBOR on nil pointer")
+ }
+
+ // Decoding CBOR null and undefined to cbor.RawTag is no-op.
+ if len(data) == 1 && (data[0] == 0xf6 || data[0] == 0xf7) {
+ return nil
+ }
+
+ d := decoder{data: data, dm: defaultDecMode}
+
+ // Unmarshal tag number.
+ typ, _, num := d.getHead()
+ if typ != cborTypeTag {
+ return &UnmarshalTypeError{CBORType: typ.String(), GoType: typeRawTag.String()}
+ }
+ t.Number = num
+
+ // Unmarshal tag content.
+ c := d.data[d.off:]
+ t.Content = make([]byte, len(c))
+ copy(t.Content, c)
+ return nil
+}
+
+// MarshalCBOR returns CBOR encoding of t.
+func (t RawTag) MarshalCBOR() ([]byte, error) {
+ if t.Number == 0 && len(t.Content) == 0 {
+ // Marshal uninitialized cbor.RawTag
+ b := make([]byte, len(cborNil))
+ copy(b, cborNil)
+ return b, nil
+ }
+
+ e := getEncodeBuffer()
+
+ encodeHead(e, byte(cborTypeTag), t.Number)
+
+ content := t.Content
+ if len(content) == 0 {
+ content = cborNil
+ }
+
+ buf := make([]byte, len(e.Bytes())+len(content))
+ n := copy(buf, e.Bytes())
+ copy(buf[n:], content)
+
+ putEncodeBuffer(e)
+ return buf, nil
+}
+
+// DecTagMode specifies how decoder handles tag number.
+type DecTagMode int
+
+const (
+ // DecTagIgnored makes decoder ignore tag number (skips if present).
+ DecTagIgnored DecTagMode = iota
+
+ // DecTagOptional makes decoder verify tag number if it's present.
+ DecTagOptional
+
+ // DecTagRequired makes decoder verify tag number and tag number must be present.
+ DecTagRequired
+
+ maxDecTagMode
+)
+
+func (dtm DecTagMode) valid() bool {
+ return dtm >= 0 && dtm < maxDecTagMode
+}
+
+// EncTagMode specifies how encoder handles tag number.
+type EncTagMode int
+
+const (
+ // EncTagNone makes encoder not encode tag number.
+ EncTagNone EncTagMode = iota
+
+ // EncTagRequired makes encoder encode tag number.
+ EncTagRequired
+
+ maxEncTagMode
+)
+
+func (etm EncTagMode) valid() bool {
+ return etm >= 0 && etm < maxEncTagMode
+}
+
+// TagOptions specifies how encoder and decoder handle tag number.
+type TagOptions struct {
+ DecTag DecTagMode
+ EncTag EncTagMode
+}
+
+// TagSet is an interface to add and remove tag info. It is used by EncMode and DecMode
+// to provide CBOR tag support.
+type TagSet interface {
+ // Add adds given tag number(s), content type, and tag options to TagSet.
+ Add(opts TagOptions, contentType reflect.Type, num uint64, nestedNum ...uint64) error
+
+ // Remove removes given tag content type from TagSet.
+ Remove(contentType reflect.Type)
+
+ tagProvider
+}
+
+type tagProvider interface {
+ getTagItemFromType(t reflect.Type) *tagItem
+ getTypeFromTagNum(num []uint64) reflect.Type
+}
+
+type tagItem struct {
+ num []uint64
+ cborTagNum []byte
+ contentType reflect.Type
+ opts TagOptions
+}
+
+func (t *tagItem) equalTagNum(num []uint64) bool {
+ // Fast path to compare 1 tag number
+ if len(t.num) == 1 && len(num) == 1 && t.num[0] == num[0] {
+ return true
+ }
+
+ if len(t.num) != len(num) {
+ return false
+ }
+
+ for i := 0; i < len(t.num); i++ {
+ if t.num[i] != num[i] {
+ return false
+ }
+ }
+
+ return true
+}
+
+type (
+ tagSet map[reflect.Type]*tagItem
+
+ syncTagSet struct {
+ sync.RWMutex
+ t tagSet
+ }
+)
+
+func (t tagSet) getTagItemFromType(typ reflect.Type) *tagItem {
+ return t[typ]
+}
+
+func (t tagSet) getTypeFromTagNum(num []uint64) reflect.Type {
+ for typ, tag := range t {
+ if tag.equalTagNum(num) {
+ return typ
+ }
+ }
+ return nil
+}
+
+// NewTagSet returns TagSet (safe for concurrency).
+func NewTagSet() TagSet {
+ return &syncTagSet{t: make(map[reflect.Type]*tagItem)}
+}
+
+// Add adds given tag number(s), content type, and tag options to TagSet.
+func (t *syncTagSet) Add(opts TagOptions, contentType reflect.Type, num uint64, nestedNum ...uint64) error {
+ if contentType == nil {
+ return errors.New("cbor: cannot add nil content type to TagSet")
+ }
+ for contentType.Kind() == reflect.Ptr {
+ contentType = contentType.Elem()
+ }
+ tag, err := newTagItem(opts, contentType, num, nestedNum...)
+ if err != nil {
+ return err
+ }
+ t.Lock()
+ defer t.Unlock()
+ for typ, ti := range t.t {
+ if typ == contentType {
+ return errors.New("cbor: content type " + contentType.String() + " already exists in TagSet")
+ }
+ if ti.equalTagNum(tag.num) {
+ return fmt.Errorf("cbor: tag number %v already exists in TagSet", tag.num)
+ }
+ }
+ t.t[contentType] = tag
+ return nil
+}
+
+// Remove removes given tag content type from TagSet.
+func (t *syncTagSet) Remove(contentType reflect.Type) {
+ for contentType.Kind() == reflect.Ptr {
+ contentType = contentType.Elem()
+ }
+ t.Lock()
+ delete(t.t, contentType)
+ t.Unlock()
+}
+
+func (t *syncTagSet) getTagItemFromType(typ reflect.Type) *tagItem {
+ t.RLock()
+ ti := t.t[typ]
+ t.RUnlock()
+ return ti
+}
+
+func (t *syncTagSet) getTypeFromTagNum(num []uint64) reflect.Type {
+ t.RLock()
+ rt := t.t.getTypeFromTagNum(num)
+ t.RUnlock()
+ return rt
+}
+
+func newTagItem(opts TagOptions, contentType reflect.Type, num uint64, nestedNum ...uint64) (*tagItem, error) {
+ if opts.DecTag == DecTagIgnored && opts.EncTag == EncTagNone {
+ return nil, errors.New("cbor: cannot add tag with DecTagIgnored and EncTagNone options to TagSet")
+ }
+ if contentType.PkgPath() == "" || contentType.Kind() == reflect.Interface {
+ return nil, errors.New("cbor: can only add named types to TagSet, got " + contentType.String())
+ }
+ if contentType == typeTime {
+ return nil, errors.New("cbor: cannot add time.Time to TagSet, use EncOptions.TimeTag and DecOptions.TimeTag instead")
+ }
+ if contentType == typeBigInt {
+ return nil, errors.New("cbor: cannot add big.Int to TagSet, it's built-in and supported automatically")
+ }
+ if contentType == typeTag {
+ return nil, errors.New("cbor: cannot add cbor.Tag to TagSet")
+ }
+ if contentType == typeRawTag {
+ return nil, errors.New("cbor: cannot add cbor.RawTag to TagSet")
+ }
+ if num == 0 || num == 1 {
+ return nil, errors.New("cbor: cannot add tag number 0 or 1 to TagSet, use EncOptions.TimeTag and DecOptions.TimeTag instead")
+ }
+ if num == 2 || num == 3 {
+ return nil, errors.New("cbor: cannot add tag number 2 or 3 to TagSet, it's built-in and supported automatically")
+ }
+ if num == tagNumSelfDescribedCBOR {
+ return nil, errors.New("cbor: cannot add tag number 55799 to TagSet, it's built-in and ignored automatically")
+ }
+
+ te := tagItem{num: []uint64{num}, opts: opts, contentType: contentType}
+ te.num = append(te.num, nestedNum...)
+
+ // Cache encoded tag numbers
+ e := getEncodeBuffer()
+ for _, n := range te.num {
+ encodeHead(e, byte(cborTypeTag), n)
+ }
+ te.cborTagNum = make([]byte, e.Len())
+ copy(te.cborTagNum, e.Bytes())
+ putEncodeBuffer(e)
+
+ return &te, nil
+}
+
+var (
+ typeTag = reflect.TypeOf(Tag{})
+ typeRawTag = reflect.TypeOf(RawTag{})
+)
+
+// WrongTagError describes mismatch between CBOR tag and registered tag.
+type WrongTagError struct {
+ RegisteredType reflect.Type
+ RegisteredTagNum []uint64
+ TagNum []uint64
+}
+
+func (e *WrongTagError) Error() string {
+ return fmt.Sprintf("cbor: wrong tag number for %s, got %v, expected %v", e.RegisteredType.String(), e.TagNum, e.RegisteredTagNum)
+}
diff --git a/vendor/github.com/fxamacker/cbor/v2/valid.go b/vendor/github.com/fxamacker/cbor/v2/valid.go
new file mode 100644
index 000000000..b40793b95
--- /dev/null
+++ b/vendor/github.com/fxamacker/cbor/v2/valid.go
@@ -0,0 +1,394 @@
+// Copyright (c) Faye Amacker. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+package cbor
+
+import (
+ "encoding/binary"
+ "errors"
+ "io"
+ "math"
+ "strconv"
+
+ "github.com/x448/float16"
+)
+
+// SyntaxError is a description of a CBOR syntax error.
+type SyntaxError struct {
+ msg string
+}
+
+func (e *SyntaxError) Error() string { return e.msg }
+
+// SemanticError is a description of a CBOR semantic error.
+type SemanticError struct {
+ msg string
+}
+
+func (e *SemanticError) Error() string { return e.msg }
+
+// MaxNestedLevelError indicates exceeded max nested level of any combination of CBOR arrays/maps/tags.
+type MaxNestedLevelError struct {
+ maxNestedLevels int
+}
+
+func (e *MaxNestedLevelError) Error() string {
+ return "cbor: exceeded max nested level " + strconv.Itoa(e.maxNestedLevels)
+}
+
+// MaxArrayElementsError indicates exceeded max number of elements for CBOR arrays.
+type MaxArrayElementsError struct {
+ maxArrayElements int
+}
+
+func (e *MaxArrayElementsError) Error() string {
+ return "cbor: exceeded max number of elements " + strconv.Itoa(e.maxArrayElements) + " for CBOR array"
+}
+
+// MaxMapPairsError indicates exceeded max number of key-value pairs for CBOR maps.
+type MaxMapPairsError struct {
+ maxMapPairs int
+}
+
+func (e *MaxMapPairsError) Error() string {
+ return "cbor: exceeded max number of key-value pairs " + strconv.Itoa(e.maxMapPairs) + " for CBOR map"
+}
+
+// IndefiniteLengthError indicates found disallowed indefinite length items.
+type IndefiniteLengthError struct {
+ t cborType
+}
+
+func (e *IndefiniteLengthError) Error() string {
+ return "cbor: indefinite-length " + e.t.String() + " isn't allowed"
+}
+
+// TagsMdError indicates found disallowed CBOR tags.
+type TagsMdError struct {
+}
+
+func (e *TagsMdError) Error() string {
+ return "cbor: CBOR tag isn't allowed"
+}
+
+// ExtraneousDataError indicates found extraneous data following well-formed CBOR data item.
+type ExtraneousDataError struct {
+ numOfBytes int // number of bytes of extraneous data
+ index int // location of extraneous data
+}
+
+func (e *ExtraneousDataError) Error() string {
+ return "cbor: " + strconv.Itoa(e.numOfBytes) + " bytes of extraneous data starting at index " + strconv.Itoa(e.index)
+}
+
+// wellformed checks whether the CBOR data item is well-formed.
+// allowExtraData indicates if extraneous data is allowed after the CBOR data item.
+// - use allowExtraData = true when using Decoder.Decode()
+// - use allowExtraData = false when using Unmarshal()
+func (d *decoder) wellformed(allowExtraData bool, checkBuiltinTags bool) error {
+ if len(d.data) == d.off {
+ return io.EOF
+ }
+ _, err := d.wellformedInternal(0, checkBuiltinTags)
+ if err == nil {
+ if !allowExtraData && d.off != len(d.data) {
+ err = &ExtraneousDataError{len(d.data) - d.off, d.off}
+ }
+ }
+ return err
+}
+
+// wellformedInternal checks data's well-formedness and returns max depth and error.
+func (d *decoder) wellformedInternal(depth int, checkBuiltinTags bool) (int, error) { //nolint:gocyclo
+ t, _, val, indefiniteLength, err := d.wellformedHeadWithIndefiniteLengthFlag()
+ if err != nil {
+ return 0, err
+ }
+
+ switch t {
+ case cborTypeByteString, cborTypeTextString:
+ if indefiniteLength {
+ if d.dm.indefLength == IndefLengthForbidden {
+ return 0, &IndefiniteLengthError{t}
+ }
+ return d.wellformedIndefiniteString(t, depth, checkBuiltinTags)
+ }
+ valInt := int(val)
+ if valInt < 0 {
+ // Detect integer overflow
+ return 0, errors.New("cbor: " + t.String() + " length " + strconv.FormatUint(val, 10) + " is too large, causing integer overflow")
+ }
+ if len(d.data)-d.off < valInt { // valInt+off may overflow integer
+ return 0, io.ErrUnexpectedEOF
+ }
+ d.off += valInt
+
+ case cborTypeArray, cborTypeMap:
+ depth++
+ if depth > d.dm.maxNestedLevels {
+ return 0, &MaxNestedLevelError{d.dm.maxNestedLevels}
+ }
+
+ if indefiniteLength {
+ if d.dm.indefLength == IndefLengthForbidden {
+ return 0, &IndefiniteLengthError{t}
+ }
+ return d.wellformedIndefiniteArrayOrMap(t, depth, checkBuiltinTags)
+ }
+
+ valInt := int(val)
+ if valInt < 0 {
+ // Detect integer overflow
+ return 0, errors.New("cbor: " + t.String() + " length " + strconv.FormatUint(val, 10) + " is too large, it would cause integer overflow")
+ }
+
+ if t == cborTypeArray {
+ if valInt > d.dm.maxArrayElements {
+ return 0, &MaxArrayElementsError{d.dm.maxArrayElements}
+ }
+ } else {
+ if valInt > d.dm.maxMapPairs {
+ return 0, &MaxMapPairsError{d.dm.maxMapPairs}
+ }
+ }
+
+ count := 1
+ if t == cborTypeMap {
+ count = 2
+ }
+ maxDepth := depth
+ for j := 0; j < count; j++ {
+ for i := 0; i < valInt; i++ {
+ var dpt int
+ if dpt, err = d.wellformedInternal(depth, checkBuiltinTags); err != nil {
+ return 0, err
+ }
+ if dpt > maxDepth {
+ maxDepth = dpt // Save max depth
+ }
+ }
+ }
+ depth = maxDepth
+
+ case cborTypeTag:
+ if d.dm.tagsMd == TagsForbidden {
+ return 0, &TagsMdError{}
+ }
+
+ tagNum := val
+
+ // Scan nested tag numbers to avoid recursion.
+ for {
+ if len(d.data) == d.off { // Tag number must be followed by tag content.
+ return 0, io.ErrUnexpectedEOF
+ }
+ if checkBuiltinTags {
+ err = validBuiltinTag(tagNum, d.data[d.off])
+ if err != nil {
+ return 0, err
+ }
+ }
+ if d.dm.bignumTag == BignumTagForbidden && (tagNum == 2 || tagNum == 3) {
+ return 0, &UnacceptableDataItemError{
+ CBORType: cborTypeTag.String(),
+ Message: "bignum",
+ }
+ }
+ if getType(d.data[d.off]) != cborTypeTag {
+ break
+ }
+ if _, _, tagNum, err = d.wellformedHead(); err != nil {
+ return 0, err
+ }
+ depth++
+ if depth > d.dm.maxNestedLevels {
+ return 0, &MaxNestedLevelError{d.dm.maxNestedLevels}
+ }
+ }
+ // Check tag content.
+ return d.wellformedInternal(depth, checkBuiltinTags)
+ }
+
+ return depth, nil
+}
+
+// wellformedIndefiniteString checks indefinite length byte/text string's well-formedness and returns max depth and error.
+func (d *decoder) wellformedIndefiniteString(t cborType, depth int, checkBuiltinTags bool) (int, error) {
+ var err error
+ for {
+ if len(d.data) == d.off {
+ return 0, io.ErrUnexpectedEOF
+ }
+ if isBreakFlag(d.data[d.off]) {
+ d.off++
+ break
+ }
+ // Peek ahead to get next type and indefinite length status.
+ nt, ai := parseInitialByte(d.data[d.off])
+ if t != nt {
+ return 0, &SyntaxError{"cbor: wrong element type " + nt.String() + " for indefinite-length " + t.String()}
+ }
+ if additionalInformation(ai).isIndefiniteLength() {
+ return 0, &SyntaxError{"cbor: indefinite-length " + t.String() + " chunk is not definite-length"}
+ }
+ if depth, err = d.wellformedInternal(depth, checkBuiltinTags); err != nil {
+ return 0, err
+ }
+ }
+ return depth, nil
+}
+
+// wellformedIndefiniteArrayOrMap checks indefinite length array/map's well-formedness and returns max depth and error.
+func (d *decoder) wellformedIndefiniteArrayOrMap(t cborType, depth int, checkBuiltinTags bool) (int, error) {
+ var err error
+ maxDepth := depth
+ i := 0
+ for {
+ if len(d.data) == d.off {
+ return 0, io.ErrUnexpectedEOF
+ }
+ if isBreakFlag(d.data[d.off]) {
+ d.off++
+ break
+ }
+ var dpt int
+ if dpt, err = d.wellformedInternal(depth, checkBuiltinTags); err != nil {
+ return 0, err
+ }
+ if dpt > maxDepth {
+ maxDepth = dpt
+ }
+ i++
+ if t == cborTypeArray {
+ if i > d.dm.maxArrayElements {
+ return 0, &MaxArrayElementsError{d.dm.maxArrayElements}
+ }
+ } else {
+ if i%2 == 0 && i/2 > d.dm.maxMapPairs {
+ return 0, &MaxMapPairsError{d.dm.maxMapPairs}
+ }
+ }
+ }
+ if t == cborTypeMap && i%2 == 1 {
+ return 0, &SyntaxError{"cbor: unexpected \"break\" code"}
+ }
+ return maxDepth, nil
+}
+
+func (d *decoder) wellformedHeadWithIndefiniteLengthFlag() (
+ t cborType,
+ ai byte,
+ val uint64,
+ indefiniteLength bool,
+ err error,
+) {
+ t, ai, val, err = d.wellformedHead()
+ if err != nil {
+ return
+ }
+ indefiniteLength = additionalInformation(ai).isIndefiniteLength()
+ return
+}
+
+func (d *decoder) wellformedHead() (t cborType, ai byte, val uint64, err error) {
+ dataLen := len(d.data) - d.off
+ if dataLen == 0 {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+
+ t, ai = parseInitialByte(d.data[d.off])
+ val = uint64(ai)
+ d.off++
+ dataLen--
+
+ if ai <= maxAdditionalInformationWithoutArgument {
+ return t, ai, val, nil
+ }
+
+ if ai == additionalInformationWith1ByteArgument {
+ const argumentSize = 1
+ if dataLen < argumentSize {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+ val = uint64(d.data[d.off])
+ d.off++
+ if t == cborTypePrimitives && val < 32 {
+ return 0, 0, 0, &SyntaxError{"cbor: invalid simple value " + strconv.Itoa(int(val)) + " for type " + t.String()}
+ }
+ return t, ai, val, nil
+ }
+
+ if ai == additionalInformationWith2ByteArgument {
+ const argumentSize = 2
+ if dataLen < argumentSize {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+ val = uint64(binary.BigEndian.Uint16(d.data[d.off : d.off+argumentSize]))
+ d.off += argumentSize
+ if t == cborTypePrimitives {
+ if err := d.acceptableFloat(float64(float16.Frombits(uint16(val)).Float32())); err != nil {
+ return 0, 0, 0, err
+ }
+ }
+ return t, ai, val, nil
+ }
+
+ if ai == additionalInformationWith4ByteArgument {
+ const argumentSize = 4
+ if dataLen < argumentSize {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+ val = uint64(binary.BigEndian.Uint32(d.data[d.off : d.off+argumentSize]))
+ d.off += argumentSize
+ if t == cborTypePrimitives {
+ if err := d.acceptableFloat(float64(math.Float32frombits(uint32(val)))); err != nil {
+ return 0, 0, 0, err
+ }
+ }
+ return t, ai, val, nil
+ }
+
+ if ai == additionalInformationWith8ByteArgument {
+ const argumentSize = 8
+ if dataLen < argumentSize {
+ return 0, 0, 0, io.ErrUnexpectedEOF
+ }
+ val = binary.BigEndian.Uint64(d.data[d.off : d.off+argumentSize])
+ d.off += argumentSize
+ if t == cborTypePrimitives {
+ if err := d.acceptableFloat(math.Float64frombits(val)); err != nil {
+ return 0, 0, 0, err
+ }
+ }
+ return t, ai, val, nil
+ }
+
+ if additionalInformation(ai).isIndefiniteLength() {
+ switch t {
+ case cborTypePositiveInt, cborTypeNegativeInt, cborTypeTag:
+ return 0, 0, 0, &SyntaxError{"cbor: invalid additional information " + strconv.Itoa(int(ai)) + " for type " + t.String()}
+ case cborTypePrimitives: // 0xff (break code) should not be outside wellformedIndefinite().
+ return 0, 0, 0, &SyntaxError{"cbor: unexpected \"break\" code"}
+ }
+ return t, ai, val, nil
+ }
+
+ // ai == 28, 29, 30
+ return 0, 0, 0, &SyntaxError{"cbor: invalid additional information " + strconv.Itoa(int(ai)) + " for type " + t.String()}
+}
+
+func (d *decoder) acceptableFloat(f float64) error {
+ switch {
+ case d.dm.nanDec == NaNDecodeForbidden && math.IsNaN(f):
+ return &UnacceptableDataItemError{
+ CBORType: cborTypePrimitives.String(),
+ Message: "floating-point NaN",
+ }
+ case d.dm.infDec == InfDecodeForbidden && math.IsInf(f, 0):
+ return &UnacceptableDataItemError{
+ CBORType: cborTypePrimitives.String(),
+ Message: "floating-point infinity",
+ }
+ }
+ return nil
+}
diff --git a/vendor/github.com/go-openapi/jsonpointer/.travis.yml b/vendor/github.com/go-openapi/jsonpointer/.travis.yml
deleted file mode 100644
index 03a22fe06..000000000
--- a/vendor/github.com/go-openapi/jsonpointer/.travis.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-after_success:
-- bash <(curl -s https://codecov.io/bash)
-go:
-- 1.14.x
-- 1.15.x
-install:
-- GO111MODULE=off go get -u gotest.tools/gotestsum
-env:
-- GO111MODULE=on
-language: go
-notifications:
- slack:
- secure: a5VgoiwB1G/AZqzmephPZIhEB9avMlsWSlVnM1dSAtYAwdrQHGTQxAmpOxYIoSPDhWNN5bfZmjd29++UlTwLcHSR+e0kJhH6IfDlsHj/HplNCJ9tyI0zYc7XchtdKgeMxMzBKCzgwFXGSbQGydXTliDNBo0HOzmY3cou/daMFTP60K+offcjS+3LRAYb1EroSRXZqrk1nuF/xDL3792DZUdPMiFR/L/Df6y74D6/QP4sTkTDFQitz4Wy/7jbsfj8dG6qK2zivgV6/l+w4OVjFkxVpPXogDWY10vVXNVynqxfJ7to2d1I9lNCHE2ilBCkWMIPdyJF7hjF8pKW+82yP4EzRh0vu8Xn0HT5MZpQxdRY/YMxNrWaG7SxsoEaO4q5uhgdzAqLYY3TRa7MjIK+7Ur+aqOeTXn6OKwVi0CjvZ6mIU3WUKSwiwkFZMbjRAkSb5CYwMEfGFO/z964xz83qGt6WAtBXNotqCQpTIiKtDHQeLOMfksHImCg6JLhQcWBVxamVgu0G3Pdh8Y6DyPnxraXY95+QDavbjqv7TeYT9T/FNnrkXaTTK0s4iWE5H4ACU0Qvz0wUYgfQrZv0/Hp7V17+rabUwnzYySHCy9SWX/7OV9Cfh31iMp9ZIffr76xmmThtOEqs8TrTtU6BWI3rWwvA9cXQipZTVtL0oswrGw=
-script:
-- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./...
diff --git a/vendor/github.com/go-openapi/jsonreference/.golangci.yml b/vendor/github.com/go-openapi/jsonreference/.golangci.yml
index f9381aee5..013fc1943 100644
--- a/vendor/github.com/go-openapi/jsonreference/.golangci.yml
+++ b/vendor/github.com/go-openapi/jsonreference/.golangci.yml
@@ -1,8 +1,6 @@
linters-settings:
govet:
check-shadowing: true
- golint:
- min-confidence: 0
gocyclo:
min-complexity: 30
maligned:
@@ -12,6 +10,8 @@ linters-settings:
goconst:
min-len: 2
min-occurrences: 4
+ paralleltest:
+ ignore-missing: true
linters:
enable-all: true
disable:
@@ -39,3 +39,12 @@ linters:
- nestif
- godot
- errorlint
+ - varcheck
+ - interfacer
+ - deadcode
+ - golint
+ - ifshort
+ - structcheck
+ - nosnakecase
+ - varnamelen
+ - exhaustruct
diff --git a/vendor/github.com/go-openapi/jsonreference/.travis.yml b/vendor/github.com/go-openapi/jsonreference/.travis.yml
deleted file mode 100644
index 05482f4b9..000000000
--- a/vendor/github.com/go-openapi/jsonreference/.travis.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-after_success:
-- bash <(curl -s https://codecov.io/bash)
-go:
-- 1.14.x
-- 1.x
-install:
-- go get gotest.tools/gotestsum
-jobs:
- include:
- # include linting job, but only for latest go version and amd64 arch
- - go: 1.x
- arch: amd64
- install:
- go get github.com/golangci/golangci-lint/cmd/golangci-lint
- script:
- - golangci-lint run --new-from-rev master
-env:
-- GO111MODULE=on
-language: go
-notifications:
- slack:
- secure: OpQG/36F7DSF00HLm9WZMhyqFCYYyYTsVDObW226cWiR8PWYiNfLZiSEvIzT1Gx4dDjhigKTIqcLhG34CkL5iNXDjm9Yyo2RYhQPlK8NErNqUEXuBqn4RqYHW48VGhEhOyDd4Ei0E2FN5ZbgpvHgtpkdZ6XDi64r3Ac89isP9aPHXQTuv2Jog6b4/OKKiUTftLcTIst0p4Cp3gqOJWf1wnoj+IadWiECNVQT6zb47IYjtyw6+uV8iUjTzdKcRB6Zc6b4Dq7JAg1Zd7Jfxkql3hlKp4PNlRf9Cy7y5iA3G7MLyg3FcPX5z2kmcyPt2jOTRMBWUJ5zIQpOxizAcN8WsT3WWBL5KbuYK6k0PzujrIDLqdxGpNmjkkMfDBT9cKmZpm2FdW+oZgPFJP+oKmAo4u4KJz/vjiPTXgQlN5bmrLuRMCp+AwC5wkIohTqWZVPE2TK6ZSnMYcg/W39s+RP/9mJoyryAvPSpBOLTI+biCgaUCTOAZxNTWpMFc3tPYntc41WWkdKcooZ9JA5DwfcaVFyTGQ3YXz+HvX6G1z/gW0Q/A4dBi9mj2iE1xm7tRTT+4VQ2AXFvSEI1HJpfPgYnwAtwOD1v3Qm2EUHk9sCdtEDR4wVGEPIVn44GnwFMnGKx9JWppMPYwFu3SVDdHt+E+LOlhZUply11Aa+IVrT2KUQ=
-script:
-- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./...
diff --git a/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go b/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go
index 8956c3088..f0610cf1e 100644
--- a/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go
+++ b/vendor/github.com/go-openapi/jsonreference/internal/normalize_url.go
@@ -7,8 +7,8 @@ import (
)
const (
- defaultHttpPort = ":80"
- defaultHttpsPort = ":443"
+ defaultHTTPPort = ":80"
+ defaultHTTPSPort = ":443"
)
// Regular expressions used by the normalizations
@@ -18,18 +18,24 @@ var rxDupSlashes = regexp.MustCompile(`/{2,}`)
// NormalizeURL will normalize the specified URL
// This was added to replace a previous call to the no longer maintained purell library:
// The call that was used looked like the following:
-// url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes))
+//
+// url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes))
//
// To explain all that was included in the call above, purell.FlagsSafe was really just the following:
-// - FlagLowercaseScheme
-// - FlagLowercaseHost
-// - FlagRemoveDefaultPort
-// - FlagRemoveDuplicateSlashes (and this was mixed in with the |)
+// - FlagLowercaseScheme
+// - FlagLowercaseHost
+// - FlagRemoveDefaultPort
+// - FlagRemoveDuplicateSlashes (and this was mixed in with the |)
+//
+// This also normalizes the URL into its urlencoded form by removing RawPath and RawFragment.
func NormalizeURL(u *url.URL) {
lowercaseScheme(u)
lowercaseHost(u)
removeDefaultPort(u)
removeDuplicateSlashes(u)
+
+ u.RawPath = ""
+ u.RawFragment = ""
}
func lowercaseScheme(u *url.URL) {
@@ -48,7 +54,7 @@ func removeDefaultPort(u *url.URL) {
if len(u.Host) > 0 {
scheme := strings.ToLower(u.Scheme)
u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string {
- if (scheme == "http" && val == defaultHttpPort) || (scheme == "https" && val == defaultHttpsPort) {
+ if (scheme == "http" && val == defaultHTTPPort) || (scheme == "https" && val == defaultHTTPSPort) {
return ""
}
return val
diff --git a/vendor/github.com/go-openapi/swag/.gitattributes b/vendor/github.com/go-openapi/swag/.gitattributes
new file mode 100644
index 000000000..49ad52766
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/.gitattributes
@@ -0,0 +1,2 @@
+# gofmt always uses LF, whereas Git uses CRLF on Windows.
+*.go text eol=lf
diff --git a/vendor/github.com/go-openapi/swag/.golangci.yml b/vendor/github.com/go-openapi/swag/.golangci.yml
index 813c47aa6..bf503e400 100644
--- a/vendor/github.com/go-openapi/swag/.golangci.yml
+++ b/vendor/github.com/go-openapi/swag/.golangci.yml
@@ -37,3 +37,18 @@ linters:
- gci
- gocognit
- paralleltest
+ - thelper
+ - ifshort
+ - gomoddirectives
+ - cyclop
+ - forcetypeassert
+ - ireturn
+ - tagliatelle
+ - varnamelen
+ - goimports
+ - tenv
+ - golint
+ - exhaustruct
+ - nilnil
+ - nonamedreturns
+ - nosnakecase
diff --git a/vendor/github.com/go-openapi/swag/.travis.yml b/vendor/github.com/go-openapi/swag/.travis.yml
deleted file mode 100644
index fc25a8872..000000000
--- a/vendor/github.com/go-openapi/swag/.travis.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-after_success:
-- bash <(curl -s https://codecov.io/bash)
-go:
-- 1.14.x
-- 1.x
-arch:
-- amd64
-jobs:
- include:
- # include arch ppc, but only for latest go version - skip testing for race
- - go: 1.x
- arch: ppc64le
- install: ~
- script:
- - go test -v
-
- #- go: 1.x
- # arch: arm
- # install: ~
- # script:
- # - go test -v
-
- # include linting job, but only for latest go version and amd64 arch
- - go: 1.x
- arch: amd64
- install:
- go get github.com/golangci/golangci-lint/cmd/golangci-lint
- script:
- - golangci-lint run --new-from-rev master
-install:
-- GO111MODULE=off go get -u gotest.tools/gotestsum
-language: go
-notifications:
- slack:
- secure: QUWvCkBBK09GF7YtEvHHVt70JOkdlNBG0nIKu/5qc4/nW5HP8I2w0SEf/XR2je0eED1Qe3L/AfMCWwrEj+IUZc3l4v+ju8X8R3Lomhme0Eb0jd1MTMCuPcBT47YCj0M7RON7vXtbFfm1hFJ/jLe5+9FXz0hpXsR24PJc5ZIi/ogNwkaPqG4BmndzecpSh0vc2FJPZUD9LT0I09REY/vXR0oQAalLkW0asGD5taHZTUZq/kBpsNxaAFrLM23i4mUcf33M5fjLpvx5LRICrX/57XpBrDh2TooBU6Qj3CgoY0uPRYUmSNxbVx1czNzl2JtEpb5yjoxfVPQeg0BvQM00G8LJINISR+ohrjhkZmAqchDupAX+yFrxTtORa78CtnIL6z/aTNlgwwVD8kvL/1pFA/JWYmKDmz93mV/+6wubGzNSQCstzjkFA4/iZEKewKUoRIAi/fxyscP6L/rCpmY/4llZZvrnyTqVbt6URWpopUpH4rwYqreXAtJxJsfBJIeSmUIiDIOMGkCTvyTEW3fWGmGoqWtSHLoaWDyAIGb7azb+KvfpWtEcoPFWfSWU+LGee0A/YsUhBl7ADB9A0CJEuR8q4BPpKpfLwPKSiKSAXL7zDkyjExyhtgqbSl2jS+rKIHOZNL8JkCcTP2MKMVd563C5rC5FMKqu3S9m2b6380E=
-script:
-- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./...
diff --git a/vendor/github.com/go-openapi/swag/doc.go b/vendor/github.com/go-openapi/swag/doc.go
index 8d2c8c501..55094cb74 100644
--- a/vendor/github.com/go-openapi/swag/doc.go
+++ b/vendor/github.com/go-openapi/swag/doc.go
@@ -17,16 +17,15 @@ Package swag contains a bunch of helper functions for go-openapi and go-swagger
You may also use it standalone for your projects.
- * convert between value and pointers for builtin types
- * convert from string to builtin types (wraps strconv)
- * fast json concatenation
- * search in path
- * load from file or http
- * name mangling
-
+ - convert between value and pointers for builtin types
+ - convert from string to builtin types (wraps strconv)
+ - fast json concatenation
+ - search in path
+ - load from file or http
+ - name mangling
This repo has only few dependencies outside of the standard library:
- * YAML utilities depend on gopkg.in/yaml.v2
+ - YAML utilities depend on gopkg.in/yaml.v2
*/
package swag
diff --git a/vendor/github.com/go-openapi/swag/file.go b/vendor/github.com/go-openapi/swag/file.go
new file mode 100644
index 000000000..16accc55f
--- /dev/null
+++ b/vendor/github.com/go-openapi/swag/file.go
@@ -0,0 +1,33 @@
+// Copyright 2015 go-swagger maintainers
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package swag
+
+import "mime/multipart"
+
+// File represents an uploaded file.
+type File struct {
+ Data multipart.File
+ Header *multipart.FileHeader
+}
+
+// Read bytes from the file
+func (f *File) Read(p []byte) (n int, err error) {
+ return f.Data.Read(p)
+}
+
+// Close the file
+func (f *File) Close() error {
+ return f.Data.Close()
+}
diff --git a/vendor/github.com/go-openapi/swag/loading.go b/vendor/github.com/go-openapi/swag/loading.go
index 9a6040972..00038c377 100644
--- a/vendor/github.com/go-openapi/swag/loading.go
+++ b/vendor/github.com/go-openapi/swag/loading.go
@@ -16,10 +16,11 @@ package swag
import (
"fmt"
- "io/ioutil"
+ "io"
"log"
"net/http"
"net/url"
+ "os"
"path/filepath"
"runtime"
"strings"
@@ -40,13 +41,13 @@ var LoadHTTPCustomHeaders = map[string]string{}
// LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in
func LoadFromFileOrHTTP(path string) ([]byte, error) {
- return LoadStrategy(path, ioutil.ReadFile, loadHTTPBytes(LoadHTTPTimeout))(path)
+ return LoadStrategy(path, os.ReadFile, loadHTTPBytes(LoadHTTPTimeout))(path)
}
// LoadFromFileOrHTTPWithTimeout loads the bytes from a file or a remote http server based on the path passed in
// timeout arg allows for per request overriding of the request timeout
func LoadFromFileOrHTTPWithTimeout(path string, timeout time.Duration) ([]byte, error) {
- return LoadStrategy(path, ioutil.ReadFile, loadHTTPBytes(timeout))(path)
+ return LoadStrategy(path, os.ReadFile, loadHTTPBytes(timeout))(path)
}
// LoadStrategy returns a loader function for a given path or uri
@@ -86,7 +87,7 @@ func LoadStrategy(path string, local, remote func(string) ([]byte, error)) func(
func loadHTTPBytes(timeout time.Duration) func(path string) ([]byte, error) {
return func(path string) ([]byte, error) {
client := &http.Client{Timeout: timeout}
- req, err := http.NewRequest("GET", path, nil) // nolint: noctx
+ req, err := http.NewRequest(http.MethodGet, path, nil) //nolint:noctx
if err != nil {
return nil, err
}
@@ -115,6 +116,6 @@ func loadHTTPBytes(timeout time.Duration) func(path string) ([]byte, error) {
return nil, fmt.Errorf("could not access document at %q [%s] ", path, resp.Status)
}
- return ioutil.ReadAll(resp.Body)
+ return io.ReadAll(resp.Body)
}
}
diff --git a/vendor/github.com/go-openapi/swag/post_go18.go b/vendor/github.com/go-openapi/swag/post_go18.go
index c2e686d31..f5228b82c 100644
--- a/vendor/github.com/go-openapi/swag/post_go18.go
+++ b/vendor/github.com/go-openapi/swag/post_go18.go
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build go1.8
// +build go1.8
package swag
diff --git a/vendor/github.com/go-openapi/swag/post_go19.go b/vendor/github.com/go-openapi/swag/post_go19.go
index eb2f2d8bc..7c7da9c08 100644
--- a/vendor/github.com/go-openapi/swag/post_go19.go
+++ b/vendor/github.com/go-openapi/swag/post_go19.go
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build go1.9
// +build go1.9
package swag
diff --git a/vendor/github.com/go-openapi/swag/pre_go18.go b/vendor/github.com/go-openapi/swag/pre_go18.go
index 6607f3393..2757d9b95 100644
--- a/vendor/github.com/go-openapi/swag/pre_go18.go
+++ b/vendor/github.com/go-openapi/swag/pre_go18.go
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build !go1.8
// +build !go1.8
package swag
diff --git a/vendor/github.com/go-openapi/swag/pre_go19.go b/vendor/github.com/go-openapi/swag/pre_go19.go
index 4bae187d1..0565db377 100644
--- a/vendor/github.com/go-openapi/swag/pre_go19.go
+++ b/vendor/github.com/go-openapi/swag/pre_go19.go
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build !go1.9
// +build !go1.9
package swag
diff --git a/vendor/github.com/go-openapi/swag/util.go b/vendor/github.com/go-openapi/swag/util.go
index 193702f2c..d971fbe34 100644
--- a/vendor/github.com/go-openapi/swag/util.go
+++ b/vendor/github.com/go-openapi/swag/util.go
@@ -99,10 +99,11 @@ const (
)
// JoinByFormat joins a string array by a known format (e.g. swagger's collectionFormat attribute):
-// ssv: space separated value
-// tsv: tab separated value
-// pipes: pipe (|) separated value
-// csv: comma separated value (default)
+//
+// ssv: space separated value
+// tsv: tab separated value
+// pipes: pipe (|) separated value
+// csv: comma separated value (default)
func JoinByFormat(data []string, format string) []string {
if len(data) == 0 {
return data
@@ -124,11 +125,11 @@ func JoinByFormat(data []string, format string) []string {
}
// SplitByFormat splits a string by a known format:
-// ssv: space separated value
-// tsv: tab separated value
-// pipes: pipe (|) separated value
-// csv: comma separated value (default)
//
+// ssv: space separated value
+// tsv: tab separated value
+// pipes: pipe (|) separated value
+// csv: comma separated value (default)
func SplitByFormat(data, format string) []string {
if data == "" {
return nil
@@ -340,12 +341,21 @@ type zeroable interface {
// IsZero returns true when the value passed into the function is a zero value.
// This allows for safer checking of interface values.
func IsZero(data interface{}) bool {
+ v := reflect.ValueOf(data)
+ // check for nil data
+ switch v.Kind() {
+ case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
+ if v.IsNil() {
+ return true
+ }
+ }
+
// check for things that have an IsZero method instead
if vv, ok := data.(zeroable); ok {
return vv.IsZero()
}
+
// continue with slightly more complex reflection
- v := reflect.ValueOf(data)
switch v.Kind() {
case reflect.String:
return v.Len() == 0
@@ -357,14 +367,13 @@ func IsZero(data interface{}) bool {
return v.Uint() == 0
case reflect.Float32, reflect.Float64:
return v.Float() == 0
- case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return v.IsNil()
case reflect.Struct, reflect.Array:
return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface())
case reflect.Invalid:
return true
+ default:
+ return false
}
- return false
}
// AddInitialisms add additional initialisms
diff --git a/vendor/github.com/go-openapi/swag/yaml.go b/vendor/github.com/go-openapi/swag/yaml.go
index ec9691440..f09ee609f 100644
--- a/vendor/github.com/go-openapi/swag/yaml.go
+++ b/vendor/github.com/go-openapi/swag/yaml.go
@@ -22,7 +22,7 @@ import (
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
- yaml "gopkg.in/yaml.v2"
+ yaml "gopkg.in/yaml.v3"
)
// YAMLMatcher matches yaml
@@ -43,16 +43,126 @@ func YAMLToJSON(data interface{}) (json.RawMessage, error) {
// BytesToYAMLDoc converts a byte slice into a YAML document
func BytesToYAMLDoc(data []byte) (interface{}, error) {
- var canary map[interface{}]interface{} // validate this is an object and not a different type
- if err := yaml.Unmarshal(data, &canary); err != nil {
+ var document yaml.Node // preserve order that is present in the document
+ if err := yaml.Unmarshal(data, &document); err != nil {
return nil, err
}
+ if document.Kind != yaml.DocumentNode || len(document.Content) != 1 || document.Content[0].Kind != yaml.MappingNode {
+ return nil, fmt.Errorf("only YAML documents that are objects are supported")
+ }
+ return &document, nil
+}
- var document yaml.MapSlice // preserve order that is present in the document
- if err := yaml.Unmarshal(data, &document); err != nil {
- return nil, err
+func yamlNode(root *yaml.Node) (interface{}, error) {
+ switch root.Kind {
+ case yaml.DocumentNode:
+ return yamlDocument(root)
+ case yaml.SequenceNode:
+ return yamlSequence(root)
+ case yaml.MappingNode:
+ return yamlMapping(root)
+ case yaml.ScalarNode:
+ return yamlScalar(root)
+ case yaml.AliasNode:
+ return yamlNode(root.Alias)
+ default:
+ return nil, fmt.Errorf("unsupported YAML node type: %v", root.Kind)
+ }
+}
+
+func yamlDocument(node *yaml.Node) (interface{}, error) {
+ if len(node.Content) != 1 {
+ return nil, fmt.Errorf("unexpected YAML Document node content length: %d", len(node.Content))
+ }
+ return yamlNode(node.Content[0])
+}
+
+func yamlMapping(node *yaml.Node) (interface{}, error) {
+ m := make(JSONMapSlice, len(node.Content)/2)
+
+ var j int
+ for i := 0; i < len(node.Content); i += 2 {
+ var nmi JSONMapItem
+ k, err := yamlStringScalarC(node.Content[i])
+ if err != nil {
+ return nil, fmt.Errorf("unable to decode YAML map key: %w", err)
+ }
+ nmi.Key = k
+ v, err := yamlNode(node.Content[i+1])
+ if err != nil {
+ return nil, fmt.Errorf("unable to process YAML map value for key %q: %w", k, err)
+ }
+ nmi.Value = v
+ m[j] = nmi
+ j++
+ }
+ return m, nil
+}
+
+func yamlSequence(node *yaml.Node) (interface{}, error) {
+ s := make([]interface{}, 0)
+
+ for i := 0; i < len(node.Content); i++ {
+
+ v, err := yamlNode(node.Content[i])
+ if err != nil {
+ return nil, fmt.Errorf("unable to decode YAML sequence value: %w", err)
+ }
+ s = append(s, v)
+ }
+ return s, nil
+}
+
+const ( // See https://yaml.org/type/
+ yamlStringScalar = "tag:yaml.org,2002:str"
+ yamlIntScalar = "tag:yaml.org,2002:int"
+ yamlBoolScalar = "tag:yaml.org,2002:bool"
+ yamlFloatScalar = "tag:yaml.org,2002:float"
+ yamlTimestamp = "tag:yaml.org,2002:timestamp"
+ yamlNull = "tag:yaml.org,2002:null"
+)
+
+func yamlScalar(node *yaml.Node) (interface{}, error) {
+ switch node.LongTag() {
+ case yamlStringScalar:
+ return node.Value, nil
+ case yamlBoolScalar:
+ b, err := strconv.ParseBool(node.Value)
+ if err != nil {
+ return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting bool content: %w", node.Value, err)
+ }
+ return b, nil
+ case yamlIntScalar:
+ i, err := strconv.ParseInt(node.Value, 10, 64)
+ if err != nil {
+ return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting integer content: %w", node.Value, err)
+ }
+ return i, nil
+ case yamlFloatScalar:
+ f, err := strconv.ParseFloat(node.Value, 64)
+ if err != nil {
+ return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting float content: %w", node.Value, err)
+ }
+ return f, nil
+ case yamlTimestamp:
+ return node.Value, nil
+ case yamlNull:
+ return nil, nil
+ default:
+ return nil, fmt.Errorf("YAML tag %q is not supported", node.LongTag())
+ }
+}
+
+func yamlStringScalarC(node *yaml.Node) (string, error) {
+ if node.Kind != yaml.ScalarNode {
+ return "", fmt.Errorf("expecting a string scalar but got %q", node.Kind)
+ }
+ switch node.LongTag() {
+ case yamlStringScalar, yamlIntScalar, yamlFloatScalar:
+ return node.Value, nil
+ default:
+ return "", fmt.Errorf("YAML tag %q is not supported as map key", node.LongTag())
}
- return document, nil
}
// JSONMapSlice represent a JSON object, with the order of keys maintained
@@ -105,6 +215,113 @@ func (s *JSONMapSlice) UnmarshalEasyJSON(in *jlexer.Lexer) {
*s = result
}
+func (s JSONMapSlice) MarshalYAML() (interface{}, error) {
+ var n yaml.Node
+ n.Kind = yaml.DocumentNode
+ var nodes []*yaml.Node
+ for _, item := range s {
+ nn, err := json2yaml(item.Value)
+ if err != nil {
+ return nil, err
+ }
+ ns := []*yaml.Node{
+ {
+ Kind: yaml.ScalarNode,
+ Tag: yamlStringScalar,
+ Value: item.Key,
+ },
+ nn,
+ }
+ nodes = append(nodes, ns...)
+ }
+
+ n.Content = []*yaml.Node{
+ {
+ Kind: yaml.MappingNode,
+ Content: nodes,
+ },
+ }
+
+ return yaml.Marshal(&n)
+}
+
+func json2yaml(item interface{}) (*yaml.Node, error) {
+ switch val := item.(type) {
+ case JSONMapSlice:
+ var n yaml.Node
+ n.Kind = yaml.MappingNode
+ for i := range val {
+ childNode, err := json2yaml(&val[i].Value)
+ if err != nil {
+ return nil, err
+ }
+ n.Content = append(n.Content, &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlStringScalar,
+ Value: val[i].Key,
+ }, childNode)
+ }
+ return &n, nil
+ case map[string]interface{}:
+ var n yaml.Node
+ n.Kind = yaml.MappingNode
+ for k, v := range val {
+ childNode, err := json2yaml(v)
+ if err != nil {
+ return nil, err
+ }
+ n.Content = append(n.Content, &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlStringScalar,
+ Value: k,
+ }, childNode)
+ }
+ return &n, nil
+ case []interface{}:
+ var n yaml.Node
+ n.Kind = yaml.SequenceNode
+ for i := range val {
+ childNode, err := json2yaml(val[i])
+ if err != nil {
+ return nil, err
+ }
+ n.Content = append(n.Content, childNode)
+ }
+ return &n, nil
+ case string:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlStringScalar,
+ Value: val,
+ }, nil
+ case float64:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlFloatScalar,
+ Value: strconv.FormatFloat(val, 'f', -1, 64),
+ }, nil
+ case int64:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlIntScalar,
+ Value: strconv.FormatInt(val, 10),
+ }, nil
+ case uint64:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlIntScalar,
+ Value: strconv.FormatUint(val, 10),
+ }, nil
+ case bool:
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: yamlBoolScalar,
+ Value: strconv.FormatBool(val),
+ }, nil
+ }
+ return nil, nil
+}
+
// JSONMapItem represents the value of a key in a JSON object held by JSONMapSlice
type JSONMapItem struct {
Key string
@@ -173,23 +390,10 @@ func transformData(input interface{}) (out interface{}, err error) {
}
switch in := input.(type) {
- case yaml.MapSlice:
-
- o := make(JSONMapSlice, len(in))
- for i, mi := range in {
- var nmi JSONMapItem
- if nmi.Key, err = format(mi.Key); err != nil {
- return nil, err
- }
-
- v, ert := transformData(mi.Value)
- if ert != nil {
- return nil, ert
- }
- nmi.Value = v
- o[i] = nmi
- }
- return o, nil
+ case yaml.Node:
+ return yamlNode(&in)
+ case *yaml.Node:
+ return yamlNode(in)
case map[interface{}]interface{}:
o := make(JSONMapSlice, 0, len(in))
for ke, va := range in {
diff --git a/vendor/github.com/golang/protobuf/jsonpb/decode.go b/vendor/github.com/golang/protobuf/jsonpb/decode.go
index 6c16c255f..c6f66f103 100644
--- a/vendor/github.com/golang/protobuf/jsonpb/decode.go
+++ b/vendor/github.com/golang/protobuf/jsonpb/decode.go
@@ -56,6 +56,7 @@ type Unmarshaler struct {
// implement JSONPBMarshaler so that the custom format can be produced.
//
// The JSON unmarshaling must follow the JSON to proto specification:
+//
// https://developers.google.com/protocol-buffers/docs/proto3#json
//
// Deprecated: Custom types should implement protobuf reflection instead.
diff --git a/vendor/github.com/golang/protobuf/jsonpb/encode.go b/vendor/github.com/golang/protobuf/jsonpb/encode.go
index 685c80a62..e9438a93f 100644
--- a/vendor/github.com/golang/protobuf/jsonpb/encode.go
+++ b/vendor/github.com/golang/protobuf/jsonpb/encode.go
@@ -55,6 +55,7 @@ type Marshaler struct {
// implement JSONPBUnmarshaler so that the custom format can be parsed.
//
// The JSON marshaling must follow the proto to JSON specification:
+//
// https://developers.google.com/protocol-buffers/docs/proto3#json
//
// Deprecated: Custom types should implement protobuf reflection instead.
diff --git a/vendor/github.com/golang/protobuf/ptypes/any.go b/vendor/github.com/golang/protobuf/ptypes/any.go
index 85f9f5736..fdff3fdb4 100644
--- a/vendor/github.com/golang/protobuf/ptypes/any.go
+++ b/vendor/github.com/golang/protobuf/ptypes/any.go
@@ -127,9 +127,10 @@ func Is(any *anypb.Any, m proto.Message) bool {
// The allocated message is stored in the embedded proto.Message.
//
// Example:
-// var x ptypes.DynamicAny
-// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
-// fmt.Printf("unmarshaled message: %v", x.Message)
+//
+// var x ptypes.DynamicAny
+// if err := ptypes.UnmarshalAny(a, &x); err != nil { ... }
+// fmt.Printf("unmarshaled message: %v", x.Message)
//
// Deprecated: Use the any.UnmarshalNew method instead to unmarshal
// the any message contents into a new instance of the underlying message.
diff --git a/vendor/github.com/google/gnostic-models/LICENSE b/vendor/github.com/google/gnostic-models/LICENSE
new file mode 100644
index 000000000..6b0b1270f
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/LICENSE
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/vendor/github.com/google/gnostic-models/compiler/README.md b/vendor/github.com/google/gnostic-models/compiler/README.md
new file mode 100644
index 000000000..ee9783d23
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/README.md
@@ -0,0 +1,4 @@
+# Compiler support code
+
+This directory contains compiler support code used by Gnostic and Gnostic
+extensions.
diff --git a/vendor/github.com/google/gnostic-models/compiler/context.go b/vendor/github.com/google/gnostic-models/compiler/context.go
new file mode 100644
index 000000000..1bfe96121
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/context.go
@@ -0,0 +1,49 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import (
+ yaml "gopkg.in/yaml.v3"
+)
+
+// Context contains state of the compiler as it traverses a document.
+type Context struct {
+ Parent *Context
+ Name string
+ Node *yaml.Node
+ ExtensionHandlers *[]ExtensionHandler
+}
+
+// NewContextWithExtensions returns a new object representing the compiler state
+func NewContextWithExtensions(name string, node *yaml.Node, parent *Context, extensionHandlers *[]ExtensionHandler) *Context {
+ return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: extensionHandlers}
+}
+
+// NewContext returns a new object representing the compiler state
+func NewContext(name string, node *yaml.Node, parent *Context) *Context {
+ if parent != nil {
+ return &Context{Name: name, Node: node, Parent: parent, ExtensionHandlers: parent.ExtensionHandlers}
+ }
+ return &Context{Name: name, Parent: parent, ExtensionHandlers: nil}
+}
+
+// Description returns a text description of the compiler state
+func (context *Context) Description() string {
+ name := context.Name
+ if context.Parent != nil {
+ name = context.Parent.Description() + "." + name
+ }
+ return name
+}
diff --git a/vendor/github.com/google/gnostic-models/compiler/error.go b/vendor/github.com/google/gnostic-models/compiler/error.go
new file mode 100644
index 000000000..6f40515d6
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/error.go
@@ -0,0 +1,70 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import "fmt"
+
+// Error represents compiler errors and their location in the document.
+type Error struct {
+ Context *Context
+ Message string
+}
+
+// NewError creates an Error.
+func NewError(context *Context, message string) *Error {
+ return &Error{Context: context, Message: message}
+}
+
+func (err *Error) locationDescription() string {
+ if err.Context.Node != nil {
+ return fmt.Sprintf("[%d,%d] %s", err.Context.Node.Line, err.Context.Node.Column, err.Context.Description())
+ }
+ return err.Context.Description()
+}
+
+// Error returns the string value of an Error.
+func (err *Error) Error() string {
+ if err.Context == nil {
+ return err.Message
+ }
+ return err.locationDescription() + " " + err.Message
+}
+
+// ErrorGroup is a container for groups of Error values.
+type ErrorGroup struct {
+ Errors []error
+}
+
+// NewErrorGroupOrNil returns a new ErrorGroup for a slice of errors or nil if the slice is empty.
+func NewErrorGroupOrNil(errors []error) error {
+ if len(errors) == 0 {
+ return nil
+ } else if len(errors) == 1 {
+ return errors[0]
+ } else {
+ return &ErrorGroup{Errors: errors}
+ }
+}
+
+func (group *ErrorGroup) Error() string {
+ result := ""
+ for i, err := range group.Errors {
+ if i > 0 {
+ result += "\n"
+ }
+ result += err.Error()
+ }
+ return result
+}
diff --git a/vendor/github.com/google/gnostic-models/compiler/extensions.go b/vendor/github.com/google/gnostic-models/compiler/extensions.go
new file mode 100644
index 000000000..250c81e8c
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/extensions.go
@@ -0,0 +1,86 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import (
+ "bytes"
+ "fmt"
+ "os/exec"
+ "strings"
+
+ "github.com/golang/protobuf/proto"
+ "github.com/golang/protobuf/ptypes/any"
+ yaml "gopkg.in/yaml.v3"
+
+ extensions "github.com/google/gnostic-models/extensions"
+)
+
+// ExtensionHandler describes a binary that is called by the compiler to handle specification extensions.
+type ExtensionHandler struct {
+ Name string
+}
+
+// CallExtension calls a binary extension handler.
+func CallExtension(context *Context, in *yaml.Node, extensionName string) (handled bool, response *any.Any, err error) {
+ if context == nil || context.ExtensionHandlers == nil {
+ return false, nil, nil
+ }
+ handled = false
+ for _, handler := range *(context.ExtensionHandlers) {
+ response, err = handler.handle(in, extensionName)
+ if response == nil {
+ continue
+ } else {
+ handled = true
+ break
+ }
+ }
+ return handled, response, err
+}
+
+func (extensionHandlers *ExtensionHandler) handle(in *yaml.Node, extensionName string) (*any.Any, error) {
+ if extensionHandlers.Name != "" {
+ yamlData, _ := yaml.Marshal(in)
+ request := &extensions.ExtensionHandlerRequest{
+ CompilerVersion: &extensions.Version{
+ Major: 0,
+ Minor: 1,
+ Patch: 0,
+ },
+ Wrapper: &extensions.Wrapper{
+ Version: "unknown", // TODO: set this to the type/version of spec being parsed.
+ Yaml: string(yamlData),
+ ExtensionName: extensionName,
+ },
+ }
+ requestBytes, _ := proto.Marshal(request)
+ cmd := exec.Command(extensionHandlers.Name)
+ cmd.Stdin = bytes.NewReader(requestBytes)
+ output, err := cmd.Output()
+ if err != nil {
+ return nil, err
+ }
+ response := &extensions.ExtensionHandlerResponse{}
+ err = proto.Unmarshal(output, response)
+ if err != nil || !response.Handled {
+ return nil, err
+ }
+ if len(response.Errors) != 0 {
+ return nil, fmt.Errorf("Errors when parsing: %+v for field %s by vendor extension handler %s. Details %+v", in, extensionName, extensionHandlers.Name, strings.Join(response.Errors, ","))
+ }
+ return response.Value, nil
+ }
+ return nil, nil
+}
diff --git a/vendor/github.com/google/gnostic-models/compiler/helpers.go b/vendor/github.com/google/gnostic-models/compiler/helpers.go
new file mode 100644
index 000000000..975d65e8f
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/helpers.go
@@ -0,0 +1,397 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import (
+ "fmt"
+ "regexp"
+ "sort"
+ "strconv"
+
+ "gopkg.in/yaml.v3"
+
+ "github.com/google/gnostic-models/jsonschema"
+)
+
+// compiler helper functions, usually called from generated code
+
+// UnpackMap gets a *yaml.Node if possible.
+func UnpackMap(in *yaml.Node) (*yaml.Node, bool) {
+ if in == nil {
+ return nil, false
+ }
+ return in, true
+}
+
+// SortedKeysForMap returns the sorted keys of a yamlv2.MapSlice.
+func SortedKeysForMap(m *yaml.Node) []string {
+ keys := make([]string, 0)
+ if m.Kind == yaml.MappingNode {
+ for i := 0; i < len(m.Content); i += 2 {
+ keys = append(keys, m.Content[i].Value)
+ }
+ }
+ sort.Strings(keys)
+ return keys
+}
+
+// MapHasKey returns true if a yamlv2.MapSlice contains a specified key.
+func MapHasKey(m *yaml.Node, key string) bool {
+ if m == nil {
+ return false
+ }
+ if m.Kind == yaml.MappingNode {
+ for i := 0; i < len(m.Content); i += 2 {
+ itemKey := m.Content[i].Value
+ if key == itemKey {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+// MapValueForKey gets the value of a map value for a specified key.
+func MapValueForKey(m *yaml.Node, key string) *yaml.Node {
+ if m == nil {
+ return nil
+ }
+ if m.Kind == yaml.MappingNode {
+ for i := 0; i < len(m.Content); i += 2 {
+ itemKey := m.Content[i].Value
+ if key == itemKey {
+ return m.Content[i+1]
+ }
+ }
+ }
+ return nil
+}
+
+// ConvertInterfaceArrayToStringArray converts an array of interfaces to an array of strings, if possible.
+func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string {
+ stringArray := make([]string, 0)
+ for _, item := range interfaceArray {
+ v, ok := item.(string)
+ if ok {
+ stringArray = append(stringArray, v)
+ }
+ }
+ return stringArray
+}
+
+// SequenceNodeForNode returns a node if it is a SequenceNode.
+func SequenceNodeForNode(node *yaml.Node) (*yaml.Node, bool) {
+ if node.Kind != yaml.SequenceNode {
+ return nil, false
+ }
+ return node, true
+}
+
+// BoolForScalarNode returns the bool value of a node.
+func BoolForScalarNode(node *yaml.Node) (bool, bool) {
+ if node == nil {
+ return false, false
+ }
+ if node.Kind == yaml.DocumentNode {
+ return BoolForScalarNode(node.Content[0])
+ }
+ if node.Kind != yaml.ScalarNode {
+ return false, false
+ }
+ if node.Tag != "!!bool" {
+ return false, false
+ }
+ v, err := strconv.ParseBool(node.Value)
+ if err != nil {
+ return false, false
+ }
+ return v, true
+}
+
+// IntForScalarNode returns the integer value of a node.
+func IntForScalarNode(node *yaml.Node) (int64, bool) {
+ if node == nil {
+ return 0, false
+ }
+ if node.Kind == yaml.DocumentNode {
+ return IntForScalarNode(node.Content[0])
+ }
+ if node.Kind != yaml.ScalarNode {
+ return 0, false
+ }
+ if node.Tag != "!!int" {
+ return 0, false
+ }
+ v, err := strconv.ParseInt(node.Value, 10, 64)
+ if err != nil {
+ return 0, false
+ }
+ return v, true
+}
+
+// FloatForScalarNode returns the float value of a node.
+func FloatForScalarNode(node *yaml.Node) (float64, bool) {
+ if node == nil {
+ return 0.0, false
+ }
+ if node.Kind == yaml.DocumentNode {
+ return FloatForScalarNode(node.Content[0])
+ }
+ if node.Kind != yaml.ScalarNode {
+ return 0.0, false
+ }
+ if (node.Tag != "!!int") && (node.Tag != "!!float") {
+ return 0.0, false
+ }
+ v, err := strconv.ParseFloat(node.Value, 64)
+ if err != nil {
+ return 0.0, false
+ }
+ return v, true
+}
+
+// StringForScalarNode returns the string value of a node.
+func StringForScalarNode(node *yaml.Node) (string, bool) {
+ if node == nil {
+ return "", false
+ }
+ if node.Kind == yaml.DocumentNode {
+ return StringForScalarNode(node.Content[0])
+ }
+ switch node.Kind {
+ case yaml.ScalarNode:
+ switch node.Tag {
+ case "!!int":
+ return node.Value, true
+ case "!!str":
+ return node.Value, true
+ case "!!timestamp":
+ return node.Value, true
+ case "!!null":
+ return "", true
+ default:
+ return "", false
+ }
+ default:
+ return "", false
+ }
+}
+
+// StringArrayForSequenceNode converts a sequence node to an array of strings, if possible.
+func StringArrayForSequenceNode(node *yaml.Node) []string {
+ stringArray := make([]string, 0)
+ for _, item := range node.Content {
+ v, ok := StringForScalarNode(item)
+ if ok {
+ stringArray = append(stringArray, v)
+ }
+ }
+ return stringArray
+}
+
+// MissingKeysInMap identifies which keys from a list of required keys are not in a map.
+func MissingKeysInMap(m *yaml.Node, requiredKeys []string) []string {
+ missingKeys := make([]string, 0)
+ for _, k := range requiredKeys {
+ if !MapHasKey(m, k) {
+ missingKeys = append(missingKeys, k)
+ }
+ }
+ return missingKeys
+}
+
+// InvalidKeysInMap returns keys in a map that don't match a list of allowed keys and patterns.
+func InvalidKeysInMap(m *yaml.Node, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string {
+ invalidKeys := make([]string, 0)
+ if m == nil || m.Kind != yaml.MappingNode {
+ return invalidKeys
+ }
+ for i := 0; i < len(m.Content); i += 2 {
+ key := m.Content[i].Value
+ found := false
+ // does the key match an allowed key?
+ for _, allowedKey := range allowedKeys {
+ if key == allowedKey {
+ found = true
+ break
+ }
+ }
+ if !found {
+ // does the key match an allowed pattern?
+ for _, allowedPattern := range allowedPatterns {
+ if allowedPattern.MatchString(key) {
+ found = true
+ break
+ }
+ }
+ if !found {
+ invalidKeys = append(invalidKeys, key)
+ }
+ }
+ }
+ return invalidKeys
+}
+
+// NewNullNode creates a new Null node.
+func NewNullNode() *yaml.Node {
+ node := &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!null",
+ }
+ return node
+}
+
+// NewMappingNode creates a new Mapping node.
+func NewMappingNode() *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.MappingNode,
+ Content: make([]*yaml.Node, 0),
+ }
+}
+
+// NewSequenceNode creates a new Sequence node.
+func NewSequenceNode() *yaml.Node {
+ node := &yaml.Node{
+ Kind: yaml.SequenceNode,
+ Content: make([]*yaml.Node, 0),
+ }
+ return node
+}
+
+// NewScalarNodeForString creates a new node to hold a string.
+func NewScalarNodeForString(s string) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!str",
+ Value: s,
+ }
+}
+
+// NewSequenceNodeForStringArray creates a new node to hold an array of strings.
+func NewSequenceNodeForStringArray(strings []string) *yaml.Node {
+ node := &yaml.Node{
+ Kind: yaml.SequenceNode,
+ Content: make([]*yaml.Node, 0),
+ }
+ for _, s := range strings {
+ node.Content = append(node.Content, NewScalarNodeForString(s))
+ }
+ return node
+}
+
+// NewScalarNodeForBool creates a new node to hold a bool.
+func NewScalarNodeForBool(b bool) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!bool",
+ Value: fmt.Sprintf("%t", b),
+ }
+}
+
+// NewScalarNodeForFloat creates a new node to hold a float.
+func NewScalarNodeForFloat(f float64) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!float",
+ Value: fmt.Sprintf("%g", f),
+ }
+}
+
+// NewScalarNodeForInt creates a new node to hold an integer.
+func NewScalarNodeForInt(i int64) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!int",
+ Value: fmt.Sprintf("%d", i),
+ }
+}
+
+// PluralProperties returns the string "properties" pluralized.
+func PluralProperties(count int) string {
+ if count == 1 {
+ return "property"
+ }
+ return "properties"
+}
+
+// StringArrayContainsValue returns true if a string array contains a specified value.
+func StringArrayContainsValue(array []string, value string) bool {
+ for _, item := range array {
+ if item == value {
+ return true
+ }
+ }
+ return false
+}
+
+// StringArrayContainsValues returns true if a string array contains all of a list of specified values.
+func StringArrayContainsValues(array []string, values []string) bool {
+ for _, value := range values {
+ if !StringArrayContainsValue(array, value) {
+ return false
+ }
+ }
+ return true
+}
+
+// StringValue returns the string value of an item.
+func StringValue(item interface{}) (value string, ok bool) {
+ value, ok = item.(string)
+ if ok {
+ return value, ok
+ }
+ intValue, ok := item.(int)
+ if ok {
+ return strconv.Itoa(intValue), true
+ }
+ return "", false
+}
+
+// Description returns a human-readable represention of an item.
+func Description(item interface{}) string {
+ value, ok := item.(*yaml.Node)
+ if ok {
+ return jsonschema.Render(value)
+ }
+ return fmt.Sprintf("%+v", item)
+}
+
+// Display returns a description of a node for use in error messages.
+func Display(node *yaml.Node) string {
+ switch node.Kind {
+ case yaml.ScalarNode:
+ switch node.Tag {
+ case "!!str":
+ return fmt.Sprintf("%s (string)", node.Value)
+ }
+ }
+ return fmt.Sprintf("%+v (%T)", node, node)
+}
+
+// Marshal creates a yaml version of a structure in our preferred style
+func Marshal(in *yaml.Node) []byte {
+ clearStyle(in)
+ //bytes, _ := yaml.Marshal(&yaml.Node{Kind: yaml.DocumentNode, Content: []*yaml.Node{in}})
+ bytes, _ := yaml.Marshal(in)
+
+ return bytes
+}
+
+func clearStyle(node *yaml.Node) {
+ node.Style = 0
+ for _, c := range node.Content {
+ clearStyle(c)
+ }
+}
diff --git a/vendor/github.com/google/gnostic-models/compiler/main.go b/vendor/github.com/google/gnostic-models/compiler/main.go
new file mode 100644
index 000000000..ce9fcc456
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/main.go
@@ -0,0 +1,16 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package compiler provides support functions to generated compiler code.
+package compiler
diff --git a/vendor/github.com/google/gnostic-models/compiler/reader.go b/vendor/github.com/google/gnostic-models/compiler/reader.go
new file mode 100644
index 000000000..be0e8b40c
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/compiler/reader.go
@@ -0,0 +1,307 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package compiler
+
+import (
+ "fmt"
+ "io/ioutil"
+ "log"
+ "net/http"
+ "net/url"
+ "path/filepath"
+ "strings"
+ "sync"
+
+ yaml "gopkg.in/yaml.v3"
+)
+
+var verboseReader = false
+
+var fileCache map[string][]byte
+var infoCache map[string]*yaml.Node
+
+var fileCacheEnable = true
+var infoCacheEnable = true
+
+// These locks are used to synchronize accesses to the fileCache and infoCache
+// maps (above). They are global state and can throw thread-related errors
+// when modified from separate goroutines. The general strategy is to protect
+// all public functions in this file with mutex Lock() calls. As a result, to
+// avoid deadlock, these public functions should not call other public
+// functions, so some public functions have private equivalents.
+// In the future, we might consider replacing the maps with sync.Map and
+// eliminating these mutexes.
+var fileCacheMutex sync.Mutex
+var infoCacheMutex sync.Mutex
+
+func initializeFileCache() {
+ if fileCache == nil {
+ fileCache = make(map[string][]byte, 0)
+ }
+}
+
+func initializeInfoCache() {
+ if infoCache == nil {
+ infoCache = make(map[string]*yaml.Node, 0)
+ }
+}
+
+// EnableFileCache turns on file caching.
+func EnableFileCache() {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ fileCacheEnable = true
+}
+
+// EnableInfoCache turns on parsed info caching.
+func EnableInfoCache() {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ infoCacheEnable = true
+}
+
+// DisableFileCache turns off file caching.
+func DisableFileCache() {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ fileCacheEnable = false
+}
+
+// DisableInfoCache turns off parsed info caching.
+func DisableInfoCache() {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ infoCacheEnable = false
+}
+
+// RemoveFromFileCache removes an entry from the file cache.
+func RemoveFromFileCache(fileurl string) {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ if !fileCacheEnable {
+ return
+ }
+ initializeFileCache()
+ delete(fileCache, fileurl)
+}
+
+// RemoveFromInfoCache removes an entry from the info cache.
+func RemoveFromInfoCache(filename string) {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ if !infoCacheEnable {
+ return
+ }
+ initializeInfoCache()
+ delete(infoCache, filename)
+}
+
+// GetInfoCache returns the info cache map.
+func GetInfoCache() map[string]*yaml.Node {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ if infoCache == nil {
+ initializeInfoCache()
+ }
+ return infoCache
+}
+
+// ClearFileCache clears the file cache.
+func ClearFileCache() {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ fileCache = make(map[string][]byte, 0)
+}
+
+// ClearInfoCache clears the info cache.
+func ClearInfoCache() {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ infoCache = make(map[string]*yaml.Node)
+}
+
+// ClearCaches clears all caches.
+func ClearCaches() {
+ ClearFileCache()
+ ClearInfoCache()
+}
+
+// FetchFile gets a specified file from the local filesystem or a remote location.
+func FetchFile(fileurl string) ([]byte, error) {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ return fetchFile(fileurl)
+}
+
+func fetchFile(fileurl string) ([]byte, error) {
+ var bytes []byte
+ initializeFileCache()
+ if fileCacheEnable {
+ bytes, ok := fileCache[fileurl]
+ if ok {
+ if verboseReader {
+ log.Printf("Cache hit %s", fileurl)
+ }
+ return bytes, nil
+ }
+ if verboseReader {
+ log.Printf("Fetching %s", fileurl)
+ }
+ }
+ response, err := http.Get(fileurl)
+ if err != nil {
+ return nil, err
+ }
+ defer response.Body.Close()
+ if response.StatusCode != 200 {
+ return nil, fmt.Errorf("Error downloading %s: %s", fileurl, response.Status)
+ }
+ bytes, err = ioutil.ReadAll(response.Body)
+ if fileCacheEnable && err == nil {
+ fileCache[fileurl] = bytes
+ }
+ return bytes, err
+}
+
+// ReadBytesForFile reads the bytes of a file.
+func ReadBytesForFile(filename string) ([]byte, error) {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ return readBytesForFile(filename)
+}
+
+func readBytesForFile(filename string) ([]byte, error) {
+ // is the filename a url?
+ fileurl, _ := url.Parse(filename)
+ if fileurl.Scheme != "" {
+ // yes, fetch it
+ bytes, err := fetchFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ return bytes, nil
+ }
+ // no, it's a local filename
+ bytes, err := ioutil.ReadFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ return bytes, nil
+}
+
+// ReadInfoFromBytes unmarshals a file as a *yaml.Node.
+func ReadInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) {
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ return readInfoFromBytes(filename, bytes)
+}
+
+func readInfoFromBytes(filename string, bytes []byte) (*yaml.Node, error) {
+ initializeInfoCache()
+ if infoCacheEnable {
+ cachedInfo, ok := infoCache[filename]
+ if ok {
+ if verboseReader {
+ log.Printf("Cache hit info for file %s", filename)
+ }
+ return cachedInfo, nil
+ }
+ if verboseReader {
+ log.Printf("Reading info for file %s", filename)
+ }
+ }
+ var info yaml.Node
+ err := yaml.Unmarshal(bytes, &info)
+ if err != nil {
+ return nil, err
+ }
+ if infoCacheEnable && len(filename) > 0 {
+ infoCache[filename] = &info
+ }
+ return &info, nil
+}
+
+// ReadInfoForRef reads a file and return the fragment needed to resolve a $ref.
+func ReadInfoForRef(basefile string, ref string) (*yaml.Node, error) {
+ fileCacheMutex.Lock()
+ defer fileCacheMutex.Unlock()
+ infoCacheMutex.Lock()
+ defer infoCacheMutex.Unlock()
+ initializeInfoCache()
+ if infoCacheEnable {
+ info, ok := infoCache[ref]
+ if ok {
+ if verboseReader {
+ log.Printf("Cache hit for ref %s#%s", basefile, ref)
+ }
+ return info, nil
+ }
+ if verboseReader {
+ log.Printf("Reading info for ref %s#%s", basefile, ref)
+ }
+ }
+ basedir, _ := filepath.Split(basefile)
+ parts := strings.Split(ref, "#")
+ var filename string
+ if parts[0] != "" {
+ filename = parts[0]
+ if _, err := url.ParseRequestURI(parts[0]); err != nil {
+ // It is not an URL, so the file is local
+ filename = basedir + parts[0]
+ }
+ } else {
+ filename = basefile
+ }
+ bytes, err := readBytesForFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ info, err := readInfoFromBytes(filename, bytes)
+ if info != nil && info.Kind == yaml.DocumentNode {
+ info = info.Content[0]
+ }
+ if err != nil {
+ log.Printf("File error: %v\n", err)
+ } else {
+ if info == nil {
+ return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref))
+ }
+ if len(parts) > 1 {
+ path := strings.Split(parts[1], "/")
+ for i, key := range path {
+ if i > 0 {
+ m := info
+ if true {
+ found := false
+ for i := 0; i < len(m.Content); i += 2 {
+ if m.Content[i].Value == key {
+ info = m.Content[i+1]
+ found = true
+ }
+ }
+ if !found {
+ infoCache[ref] = nil
+ return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref))
+ }
+ }
+ }
+ }
+ }
+ }
+ if infoCacheEnable {
+ infoCache[ref] = info
+ }
+ return info, nil
+}
diff --git a/vendor/github.com/google/gnostic-models/extensions/README.md b/vendor/github.com/google/gnostic-models/extensions/README.md
new file mode 100644
index 000000000..4b5d63e58
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/extensions/README.md
@@ -0,0 +1,13 @@
+# Extensions
+
+**Extension Support is experimental.**
+
+This directory contains support code for building Gnostic extensio handlers and
+associated examples.
+
+Extension handlers can be used to compile vendor or specification extensions
+into protocol buffer structures.
+
+Like plugins, extension handlers are built as separate executables. Extension
+bodies are written to extension handlers as serialized
+ExtensionHandlerRequests.
diff --git a/vendor/github.com/google/gnostic-models/extensions/extension.pb.go b/vendor/github.com/google/gnostic-models/extensions/extension.pb.go
new file mode 100644
index 000000000..a71df8abe
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/extensions/extension.pb.go
@@ -0,0 +1,461 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.27.1
+// protoc v3.19.3
+// source: extensions/extension.proto
+
+package gnostic_extension_v1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// The version number of Gnostic.
+type Version struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"`
+ Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"`
+ Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"`
+ // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
+ // be empty for mainline stable releases.
+ Suffix string `protobuf:"bytes,4,opt,name=suffix,proto3" json:"suffix,omitempty"`
+}
+
+func (x *Version) Reset() {
+ *x = Version{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_extensions_extension_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Version) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Version) ProtoMessage() {}
+
+func (x *Version) ProtoReflect() protoreflect.Message {
+ mi := &file_extensions_extension_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Version.ProtoReflect.Descriptor instead.
+func (*Version) Descriptor() ([]byte, []int) {
+ return file_extensions_extension_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Version) GetMajor() int32 {
+ if x != nil {
+ return x.Major
+ }
+ return 0
+}
+
+func (x *Version) GetMinor() int32 {
+ if x != nil {
+ return x.Minor
+ }
+ return 0
+}
+
+func (x *Version) GetPatch() int32 {
+ if x != nil {
+ return x.Patch
+ }
+ return 0
+}
+
+func (x *Version) GetSuffix() string {
+ if x != nil {
+ return x.Suffix
+ }
+ return ""
+}
+
+// An encoded Request is written to the ExtensionHandler's stdin.
+type ExtensionHandlerRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The extension to process.
+ Wrapper *Wrapper `protobuf:"bytes,1,opt,name=wrapper,proto3" json:"wrapper,omitempty"`
+ // The version number of Gnostic.
+ CompilerVersion *Version `protobuf:"bytes,2,opt,name=compiler_version,json=compilerVersion,proto3" json:"compiler_version,omitempty"`
+}
+
+func (x *ExtensionHandlerRequest) Reset() {
+ *x = ExtensionHandlerRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_extensions_extension_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExtensionHandlerRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExtensionHandlerRequest) ProtoMessage() {}
+
+func (x *ExtensionHandlerRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_extensions_extension_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExtensionHandlerRequest.ProtoReflect.Descriptor instead.
+func (*ExtensionHandlerRequest) Descriptor() ([]byte, []int) {
+ return file_extensions_extension_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *ExtensionHandlerRequest) GetWrapper() *Wrapper {
+ if x != nil {
+ return x.Wrapper
+ }
+ return nil
+}
+
+func (x *ExtensionHandlerRequest) GetCompilerVersion() *Version {
+ if x != nil {
+ return x.CompilerVersion
+ }
+ return nil
+}
+
+// The extensions writes an encoded ExtensionHandlerResponse to stdout.
+type ExtensionHandlerResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // true if the extension is handled by the extension handler; false otherwise
+ Handled bool `protobuf:"varint,1,opt,name=handled,proto3" json:"handled,omitempty"`
+ // Error message(s). If non-empty, the extension handling failed.
+ // The extension handler process should exit with status code zero
+ // even if it reports an error in this way.
+ //
+ // This should be used to indicate errors which prevent the extension from
+ // operating as intended. Errors which indicate a problem in gnostic
+ // itself -- such as the input Document being unparseable -- should be
+ // reported by writing a message to stderr and exiting with a non-zero
+ // status code.
+ Errors []string `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"`
+ // text output
+ Value *anypb.Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *ExtensionHandlerResponse) Reset() {
+ *x = ExtensionHandlerResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_extensions_extension_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExtensionHandlerResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExtensionHandlerResponse) ProtoMessage() {}
+
+func (x *ExtensionHandlerResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_extensions_extension_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExtensionHandlerResponse.ProtoReflect.Descriptor instead.
+func (*ExtensionHandlerResponse) Descriptor() ([]byte, []int) {
+ return file_extensions_extension_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *ExtensionHandlerResponse) GetHandled() bool {
+ if x != nil {
+ return x.Handled
+ }
+ return false
+}
+
+func (x *ExtensionHandlerResponse) GetErrors() []string {
+ if x != nil {
+ return x.Errors
+ }
+ return nil
+}
+
+func (x *ExtensionHandlerResponse) GetValue() *anypb.Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+type Wrapper struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // version of the OpenAPI specification in which this extension was written.
+ Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
+ // Name of the extension.
+ ExtensionName string `protobuf:"bytes,2,opt,name=extension_name,json=extensionName,proto3" json:"extension_name,omitempty"`
+ // YAML-formatted extension value.
+ Yaml string `protobuf:"bytes,3,opt,name=yaml,proto3" json:"yaml,omitempty"`
+}
+
+func (x *Wrapper) Reset() {
+ *x = Wrapper{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_extensions_extension_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Wrapper) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Wrapper) ProtoMessage() {}
+
+func (x *Wrapper) ProtoReflect() protoreflect.Message {
+ mi := &file_extensions_extension_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Wrapper.ProtoReflect.Descriptor instead.
+func (*Wrapper) Descriptor() ([]byte, []int) {
+ return file_extensions_extension_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *Wrapper) GetVersion() string {
+ if x != nil {
+ return x.Version
+ }
+ return ""
+}
+
+func (x *Wrapper) GetExtensionName() string {
+ if x != nil {
+ return x.ExtensionName
+ }
+ return ""
+}
+
+func (x *Wrapper) GetYaml() string {
+ if x != nil {
+ return x.Yaml
+ }
+ return ""
+}
+
+var File_extensions_extension_proto protoreflect.FileDescriptor
+
+var file_extensions_extension_proto_rawDesc = []byte{
+ 0x0a, 0x1a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x67, 0x6e,
+ 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e,
+ 0x76, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x63, 0x0a,
+ 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f,
+ 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14,
+ 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d,
+ 0x69, 0x6e, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x75,
+ 0x66, 0x66, 0x69, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x75, 0x66, 0x66,
+ 0x69, 0x78, 0x22, 0x9c, 0x01, 0x0a, 0x17, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37,
+ 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x07,
+ 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x70, 0x69,
+ 0x6c, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x52, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x22, 0x78, 0x0a, 0x18, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61,
+ 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a,
+ 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07,
+ 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72,
+ 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12,
+ 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5e, 0x0a, 0x07, 0x57,
+ 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
+ 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x42, 0x4d, 0x0a, 0x0e, 0x6f,
+ 0x72, 0x67, 0x2e, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x47,
+ 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x50,
+ 0x01, 0x5a, 0x21, 0x2e, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3b,
+ 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x5f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x47, 0x4e, 0x58, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x33,
+}
+
+var (
+ file_extensions_extension_proto_rawDescOnce sync.Once
+ file_extensions_extension_proto_rawDescData = file_extensions_extension_proto_rawDesc
+)
+
+func file_extensions_extension_proto_rawDescGZIP() []byte {
+ file_extensions_extension_proto_rawDescOnce.Do(func() {
+ file_extensions_extension_proto_rawDescData = protoimpl.X.CompressGZIP(file_extensions_extension_proto_rawDescData)
+ })
+ return file_extensions_extension_proto_rawDescData
+}
+
+var file_extensions_extension_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_extensions_extension_proto_goTypes = []interface{}{
+ (*Version)(nil), // 0: gnostic.extension.v1.Version
+ (*ExtensionHandlerRequest)(nil), // 1: gnostic.extension.v1.ExtensionHandlerRequest
+ (*ExtensionHandlerResponse)(nil), // 2: gnostic.extension.v1.ExtensionHandlerResponse
+ (*Wrapper)(nil), // 3: gnostic.extension.v1.Wrapper
+ (*anypb.Any)(nil), // 4: google.protobuf.Any
+}
+var file_extensions_extension_proto_depIdxs = []int32{
+ 3, // 0: gnostic.extension.v1.ExtensionHandlerRequest.wrapper:type_name -> gnostic.extension.v1.Wrapper
+ 0, // 1: gnostic.extension.v1.ExtensionHandlerRequest.compiler_version:type_name -> gnostic.extension.v1.Version
+ 4, // 2: gnostic.extension.v1.ExtensionHandlerResponse.value:type_name -> google.protobuf.Any
+ 3, // [3:3] is the sub-list for method output_type
+ 3, // [3:3] is the sub-list for method input_type
+ 3, // [3:3] is the sub-list for extension type_name
+ 3, // [3:3] is the sub-list for extension extendee
+ 0, // [0:3] is the sub-list for field type_name
+}
+
+func init() { file_extensions_extension_proto_init() }
+func file_extensions_extension_proto_init() {
+ if File_extensions_extension_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_extensions_extension_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Version); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_extensions_extension_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExtensionHandlerRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_extensions_extension_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExtensionHandlerResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_extensions_extension_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Wrapper); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_extensions_extension_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 4,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_extensions_extension_proto_goTypes,
+ DependencyIndexes: file_extensions_extension_proto_depIdxs,
+ MessageInfos: file_extensions_extension_proto_msgTypes,
+ }.Build()
+ File_extensions_extension_proto = out.File
+ file_extensions_extension_proto_rawDesc = nil
+ file_extensions_extension_proto_goTypes = nil
+ file_extensions_extension_proto_depIdxs = nil
+}
diff --git a/vendor/github.com/google/gnostic-models/extensions/extension.proto b/vendor/github.com/google/gnostic-models/extensions/extension.proto
new file mode 100644
index 000000000..875137c1a
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/extensions/extension.proto
@@ -0,0 +1,97 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+syntax = "proto3";
+
+package gnostic.extension.v1;
+
+import "google/protobuf/any.proto";
+
+// This option lets the proto compiler generate Java code inside the package
+// name (see below) instead of inside an outer class. It creates a simpler
+// developer experience by reducing one-level of name nesting and be
+// consistent with most programming languages that don't support outer classes.
+option java_multiple_files = true;
+
+// The Java outer classname should be the filename in UpperCamelCase. This
+// class is only used to hold proto descriptor, so developers don't need to
+// work with it directly.
+option java_outer_classname = "GnosticExtension";
+
+// The Java package name must be proto package name with proper prefix.
+option java_package = "org.gnostic.v1";
+
+// A reasonable prefix for the Objective-C symbols generated from the package.
+// It should at a minimum be 3 characters long, all uppercase, and convention
+// is to use an abbreviation of the package name. Something short, but
+// hopefully unique enough to not conflict with things that may come along in
+// the future. 'GPB' is reserved for the protocol buffer implementation itself.
+//
+// "Gnostic Extension"
+option objc_class_prefix = "GNX";
+
+// The Go package name.
+option go_package = "./extensions;gnostic_extension_v1";
+
+// The version number of Gnostic.
+message Version {
+ int32 major = 1;
+ int32 minor = 2;
+ int32 patch = 3;
+ // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
+ // be empty for mainline stable releases.
+ string suffix = 4;
+}
+
+// An encoded Request is written to the ExtensionHandler's stdin.
+message ExtensionHandlerRequest {
+
+ // The extension to process.
+ Wrapper wrapper = 1;
+
+ // The version number of Gnostic.
+ Version compiler_version = 2;
+}
+
+// The extensions writes an encoded ExtensionHandlerResponse to stdout.
+message ExtensionHandlerResponse {
+
+ // true if the extension is handled by the extension handler; false otherwise
+ bool handled = 1;
+
+ // Error message(s). If non-empty, the extension handling failed.
+ // The extension handler process should exit with status code zero
+ // even if it reports an error in this way.
+ //
+ // This should be used to indicate errors which prevent the extension from
+ // operating as intended. Errors which indicate a problem in gnostic
+ // itself -- such as the input Document being unparseable -- should be
+ // reported by writing a message to stderr and exiting with a non-zero
+ // status code.
+ repeated string errors = 2;
+
+ // text output
+ google.protobuf.Any value = 3;
+}
+
+message Wrapper {
+ // version of the OpenAPI specification in which this extension was written.
+ string version = 1;
+
+ // Name of the extension.
+ string extension_name = 2;
+
+ // YAML-formatted extension value.
+ string yaml = 3;
+}
diff --git a/vendor/github.com/google/gnostic-models/extensions/extensions.go b/vendor/github.com/google/gnostic-models/extensions/extensions.go
new file mode 100644
index 000000000..ec8afd009
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/extensions/extensions.go
@@ -0,0 +1,64 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gnostic_extension_v1
+
+import (
+ "io/ioutil"
+ "log"
+ "os"
+
+ "github.com/golang/protobuf/proto"
+ "github.com/golang/protobuf/ptypes"
+)
+
+type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)
+
+// Main implements the main program of an extension handler.
+func Main(handler extensionHandler) {
+ // unpack the request
+ data, err := ioutil.ReadAll(os.Stdin)
+ if err != nil {
+ log.Println("File error:", err.Error())
+ os.Exit(1)
+ }
+ if len(data) == 0 {
+ log.Println("No input data.")
+ os.Exit(1)
+ }
+ request := &ExtensionHandlerRequest{}
+ err = proto.Unmarshal(data, request)
+ if err != nil {
+ log.Println("Input error:", err.Error())
+ os.Exit(1)
+ }
+ // call the handler
+ handled, output, err := handler(request.Wrapper.ExtensionName, request.Wrapper.Yaml)
+ // respond with the output of the handler
+ response := &ExtensionHandlerResponse{
+ Handled: false, // default assumption
+ Errors: make([]string, 0),
+ }
+ if err != nil {
+ response.Errors = append(response.Errors, err.Error())
+ } else if handled {
+ response.Handled = true
+ response.Value, err = ptypes.MarshalAny(output)
+ if err != nil {
+ response.Errors = append(response.Errors, err.Error())
+ }
+ }
+ responseBytes, _ := proto.Marshal(response)
+ os.Stdout.Write(responseBytes)
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/README.md b/vendor/github.com/google/gnostic-models/jsonschema/README.md
new file mode 100644
index 000000000..6793c5179
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/README.md
@@ -0,0 +1,4 @@
+# jsonschema
+
+This directory contains code for reading, writing, and manipulating JSON
+schemas.
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/base.go b/vendor/github.com/google/gnostic-models/jsonschema/base.go
new file mode 100644
index 000000000..5fcc4885a
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/base.go
@@ -0,0 +1,97 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+package jsonschema
+
+import (
+ "encoding/base64"
+)
+
+func baseSchemaBytes() ([]byte, error){
+ return base64.StdEncoding.DecodeString(
+`ewogICAgImlkIjogImh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDQvc2NoZW1hIyIsCiAgICAi
+JHNjaGVtYSI6ICJodHRwOi8vanNvbi1zY2hlbWEub3JnL2RyYWZ0LTA0L3NjaGVtYSMiLAogICAgImRl
+c2NyaXB0aW9uIjogIkNvcmUgc2NoZW1hIG1ldGEtc2NoZW1hIiwKICAgICJkZWZpbml0aW9ucyI6IHsK
+ICAgICAgICAic2NoZW1hQXJyYXkiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImFycmF5IiwKICAgICAg
+ICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjIiB9CiAg
+ICAgICAgfSwKICAgICAgICAicG9zaXRpdmVJbnRlZ2VyIjogewogICAgICAgICAgICAidHlwZSI6ICJp
+bnRlZ2VyIiwKICAgICAgICAgICAgIm1pbmltdW0iOiAwCiAgICAgICAgfSwKICAgICAgICAicG9zaXRp
+dmVJbnRlZ2VyRGVmYXVsdDAiOiB7CiAgICAgICAgICAgICJhbGxPZiI6IFsgeyAiJHJlZiI6ICIjL2Rl
+ZmluaXRpb25zL3Bvc2l0aXZlSW50ZWdlciIgfSwgeyAiZGVmYXVsdCI6IDAgfSBdCiAgICAgICAgfSwK
+ICAgICAgICAic2ltcGxlVHlwZXMiOiB7CiAgICAgICAgICAgICJlbnVtIjogWyAiYXJyYXkiLCAiYm9v
+bGVhbiIsICJpbnRlZ2VyIiwgIm51bGwiLCAibnVtYmVyIiwgIm9iamVjdCIsICJzdHJpbmciIF0KICAg
+ICAgICB9LAogICAgICAgICJzdHJpbmdBcnJheSI6IHsKICAgICAgICAgICAgInR5cGUiOiAiYXJyYXki
+LAogICAgICAgICAgICAiaXRlbXMiOiB7ICJ0eXBlIjogInN0cmluZyIgfSwKICAgICAgICAgICAgIm1p
+bkl0ZW1zIjogMSwKICAgICAgICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0KICAgIH0s
+CiAgICAidHlwZSI6ICJvYmplY3QiLAogICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgImlkIjogewog
+ICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAogICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAg
+ICAgICB9LAogICAgICAgICIkc2NoZW1hIjogewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAog
+ICAgICAgICAgICAiZm9ybWF0IjogInVyaSIKICAgICAgICB9LAogICAgICAgICJ0aXRsZSI6IHsKICAg
+ICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0sCiAgICAgICAgImRlc2NyaXB0aW9uIjog
+ewogICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgfSwKICAgICAgICAiZGVmYXVsdCI6
+IHt9LAogICAgICAgICJtdWx0aXBsZU9mIjogewogICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiLAog
+ICAgICAgICAgICAibWluaW11bSI6IDAsCiAgICAgICAgICAgICJleGNsdXNpdmVNaW5pbXVtIjogdHJ1
+ZQogICAgICAgIH0sCiAgICAgICAgIm1heGltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJl
+ciIKICAgICAgICB9LAogICAgICAgICJleGNsdXNpdmVNYXhpbXVtIjogewogICAgICAgICAgICAidHlw
+ZSI6ICJib29sZWFuIiwKICAgICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAg
+ICAgIm1pbmltdW0iOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICB9LAogICAg
+ICAgICJleGNsdXNpdmVNaW5pbXVtIjogewogICAgICAgICAgICAidHlwZSI6ICJib29sZWFuIiwKICAg
+ICAgICAgICAgImRlZmF1bHQiOiBmYWxzZQogICAgICAgIH0sCiAgICAgICAgIm1heExlbmd0aCI6IHsg
+IiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pbkxlbmd0
+aCI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAg
+ICAgICAicGF0dGVybiI6IHsKICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIiwKICAgICAgICAgICAg
+ImZvcm1hdCI6ICJyZWdleCIKICAgICAgICB9LAogICAgICAgICJhZGRpdGlvbmFsSXRlbXMiOiB7CiAg
+ICAgICAgICAgICJhbnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgInR5cGUiOiAiYm9vbGVhbiIgfSwK
+ICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfQogICAgICAgICAgICBdLAogICAgICAgICAgICAi
+ZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAiaXRlbXMiOiB7CiAgICAgICAgICAgICJhbnlP
+ZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgICAgIHsgIiRy
+ZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIgfQogICAgICAgICAgICBdLAogICAgICAgICAg
+ICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAibWF4SXRlbXMiOiB7ICIkcmVmIjogIiMv
+ZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyIiB9LAogICAgICAgICJtaW5JdGVtcyI6IHsgIiRyZWYi
+OiAiIy9kZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXJEZWZhdWx0MCIgfSwKICAgICAgICAidW5pcXVl
+SXRlbXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iLAogICAgICAgICAgICAiZGVmYXVs
+dCI6IGZhbHNlCiAgICAgICAgfSwKICAgICAgICAibWF4UHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIy9k
+ZWZpbml0aW9ucy9wb3NpdGl2ZUludGVnZXIiIH0sCiAgICAgICAgIm1pblByb3BlcnRpZXMiOiB7ICIk
+cmVmIjogIiMvZGVmaW5pdGlvbnMvcG9zaXRpdmVJbnRlZ2VyRGVmYXVsdDAiIH0sCiAgICAgICAgInJl
+cXVpcmVkIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3N0cmluZ0FycmF5IiB9LAogICAgICAgICJh
+ZGRpdGlvbmFsUHJvcGVydGllcyI6IHsKICAgICAgICAgICAgImFueU9mIjogWwogICAgICAgICAgICAg
+ICAgeyAidHlwZSI6ICJib29sZWFuIiB9LAogICAgICAgICAgICAgICAgeyAiJHJlZiI6ICIjIiB9CiAg
+ICAgICAgICAgIF0sCiAgICAgICAgICAgICJkZWZhdWx0Ijoge30KICAgICAgICB9LAogICAgICAgICJk
+ZWZpbml0aW9ucyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgICAgICAgImFk
+ZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9LAogICAgICAgICAgICAiZGVmYXVsdCI6
+IHt9CiAgICAgICAgfSwKICAgICAgICAicHJvcGVydGllcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAi
+b2JqZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogeyAiJHJlZiI6ICIjIiB9
+LAogICAgICAgICAgICAiZGVmYXVsdCI6IHt9CiAgICAgICAgfSwKICAgICAgICAicGF0dGVyblByb3Bl
+cnRpZXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICAgICAgICJhZGRpdGlv
+bmFsUHJvcGVydGllcyI6IHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAgImRlZmF1bHQiOiB7fQog
+ICAgICAgIH0sCiAgICAgICAgImRlcGVuZGVuY2llcyI6IHsKICAgICAgICAgICAgInR5cGUiOiAib2Jq
+ZWN0IiwKICAgICAgICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICAg
+ImFueU9mIjogWwogICAgICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIyIgfSwKICAgICAgICAgICAg
+ICAgICAgICB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc3RyaW5nQXJyYXkiIH0KICAgICAgICAgICAg
+ICAgIF0KICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgImVudW0iOiB7CiAgICAgICAgICAg
+ICJ0eXBlIjogImFycmF5IiwKICAgICAgICAgICAgIm1pbkl0ZW1zIjogMSwKICAgICAgICAgICAgInVu
+aXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgIH0sCiAgICAgICAgInR5cGUiOiB7CiAgICAgICAgICAgICJh
+bnlPZiI6IFsKICAgICAgICAgICAgICAgIHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zaW1wbGVUeXBl
+cyIgfSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAidHlwZSI6ICJhcnJheSIs
+CiAgICAgICAgICAgICAgICAgICAgIml0ZW1zIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NpbXBs
+ZVR5cGVzIiB9LAogICAgICAgICAgICAgICAgICAgICJtaW5JdGVtcyI6IDEsCiAgICAgICAgICAgICAg
+ICAgICAgInVuaXF1ZUl0ZW1zIjogdHJ1ZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAg
+ICAgICAgfSwKICAgICAgICAiYWxsT2YiOiB7ICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc2NoZW1hQXJy
+YXkiIH0sCiAgICAgICAgImFueU9mIjogeyAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NjaGVtYUFycmF5
+IiB9LAogICAgICAgICJvbmVPZiI6IHsgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWFBcnJheSIg
+fSwKICAgICAgICAibm90IjogeyAiJHJlZiI6ICIjIiB9CiAgICB9LAogICAgImRlcGVuZGVuY2llcyI6
+IHsKICAgICAgICAiZXhjbHVzaXZlTWF4aW11bSI6IFsgIm1heGltdW0iIF0sCiAgICAgICAgImV4Y2x1
+c2l2ZU1pbmltdW0iOiBbICJtaW5pbXVtIiBdCiAgICB9LAogICAgImRlZmF1bHQiOiB7fQp9Cg==`)}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/display.go b/vendor/github.com/google/gnostic-models/jsonschema/display.go
new file mode 100644
index 000000000..028a760a9
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/display.go
@@ -0,0 +1,229 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package jsonschema
+
+import (
+ "fmt"
+ "strings"
+)
+
+//
+// DISPLAY
+// The following methods display Schemas.
+//
+
+// Description returns a string representation of a string or string array.
+func (s *StringOrStringArray) Description() string {
+ if s.String != nil {
+ return *s.String
+ }
+ if s.StringArray != nil {
+ return strings.Join(*s.StringArray, ", ")
+ }
+ return ""
+}
+
+// Returns a string representation of a Schema.
+func (schema *Schema) String() string {
+ return schema.describeSchema("")
+}
+
+// Helper: Returns a string representation of a Schema indented by a specified string.
+func (schema *Schema) describeSchema(indent string) string {
+ result := ""
+ if schema.Schema != nil {
+ result += indent + "$schema: " + *(schema.Schema) + "\n"
+ }
+ if schema.ID != nil {
+ result += indent + "id: " + *(schema.ID) + "\n"
+ }
+ if schema.MultipleOf != nil {
+ result += indent + fmt.Sprintf("multipleOf: %+v\n", *(schema.MultipleOf))
+ }
+ if schema.Maximum != nil {
+ result += indent + fmt.Sprintf("maximum: %+v\n", *(schema.Maximum))
+ }
+ if schema.ExclusiveMaximum != nil {
+ result += indent + fmt.Sprintf("exclusiveMaximum: %+v\n", *(schema.ExclusiveMaximum))
+ }
+ if schema.Minimum != nil {
+ result += indent + fmt.Sprintf("minimum: %+v\n", *(schema.Minimum))
+ }
+ if schema.ExclusiveMinimum != nil {
+ result += indent + fmt.Sprintf("exclusiveMinimum: %+v\n", *(schema.ExclusiveMinimum))
+ }
+ if schema.MaxLength != nil {
+ result += indent + fmt.Sprintf("maxLength: %+v\n", *(schema.MaxLength))
+ }
+ if schema.MinLength != nil {
+ result += indent + fmt.Sprintf("minLength: %+v\n", *(schema.MinLength))
+ }
+ if schema.Pattern != nil {
+ result += indent + fmt.Sprintf("pattern: %+v\n", *(schema.Pattern))
+ }
+ if schema.AdditionalItems != nil {
+ s := schema.AdditionalItems.Schema
+ if s != nil {
+ result += indent + "additionalItems:\n"
+ result += s.describeSchema(indent + " ")
+ } else {
+ b := *(schema.AdditionalItems.Boolean)
+ result += indent + fmt.Sprintf("additionalItems: %+v\n", b)
+ }
+ }
+ if schema.Items != nil {
+ result += indent + "items:\n"
+ items := schema.Items
+ if items.SchemaArray != nil {
+ for i, s := range *(items.SchemaArray) {
+ result += indent + " " + fmt.Sprintf("%d", i) + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ }
+ } else if items.Schema != nil {
+ result += items.Schema.describeSchema(indent + " " + " ")
+ }
+ }
+ if schema.MaxItems != nil {
+ result += indent + fmt.Sprintf("maxItems: %+v\n", *(schema.MaxItems))
+ }
+ if schema.MinItems != nil {
+ result += indent + fmt.Sprintf("minItems: %+v\n", *(schema.MinItems))
+ }
+ if schema.UniqueItems != nil {
+ result += indent + fmt.Sprintf("uniqueItems: %+v\n", *(schema.UniqueItems))
+ }
+ if schema.MaxProperties != nil {
+ result += indent + fmt.Sprintf("maxProperties: %+v\n", *(schema.MaxProperties))
+ }
+ if schema.MinProperties != nil {
+ result += indent + fmt.Sprintf("minProperties: %+v\n", *(schema.MinProperties))
+ }
+ if schema.Required != nil {
+ result += indent + fmt.Sprintf("required: %+v\n", *(schema.Required))
+ }
+ if schema.AdditionalProperties != nil {
+ s := schema.AdditionalProperties.Schema
+ if s != nil {
+ result += indent + "additionalProperties:\n"
+ result += s.describeSchema(indent + " ")
+ } else {
+ b := *(schema.AdditionalProperties.Boolean)
+ result += indent + fmt.Sprintf("additionalProperties: %+v\n", b)
+ }
+ }
+ if schema.Properties != nil {
+ result += indent + "properties:\n"
+ for _, pair := range *(schema.Properties) {
+ name := pair.Name
+ s := pair.Value
+ result += indent + " " + name + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ }
+ }
+ if schema.PatternProperties != nil {
+ result += indent + "patternProperties:\n"
+ for _, pair := range *(schema.PatternProperties) {
+ name := pair.Name
+ s := pair.Value
+ result += indent + " " + name + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ }
+ }
+ if schema.Dependencies != nil {
+ result += indent + "dependencies:\n"
+ for _, pair := range *(schema.Dependencies) {
+ name := pair.Name
+ schemaOrStringArray := pair.Value
+ s := schemaOrStringArray.Schema
+ if s != nil {
+ result += indent + " " + name + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ } else {
+ a := schemaOrStringArray.StringArray
+ if a != nil {
+ result += indent + " " + name + ":\n"
+ for _, s2 := range *a {
+ result += indent + " " + " " + s2 + "\n"
+ }
+ }
+ }
+
+ }
+ }
+ if schema.Enumeration != nil {
+ result += indent + "enumeration:\n"
+ for _, value := range *(schema.Enumeration) {
+ if value.String != nil {
+ result += indent + " " + fmt.Sprintf("%+v\n", *value.String)
+ } else {
+ result += indent + " " + fmt.Sprintf("%+v\n", *value.Bool)
+ }
+ }
+ }
+ if schema.Type != nil {
+ result += indent + fmt.Sprintf("type: %+v\n", schema.Type.Description())
+ }
+ if schema.AllOf != nil {
+ result += indent + "allOf:\n"
+ for _, s := range *(schema.AllOf) {
+ result += s.describeSchema(indent + " ")
+ result += indent + "-\n"
+ }
+ }
+ if schema.AnyOf != nil {
+ result += indent + "anyOf:\n"
+ for _, s := range *(schema.AnyOf) {
+ result += s.describeSchema(indent + " ")
+ result += indent + "-\n"
+ }
+ }
+ if schema.OneOf != nil {
+ result += indent + "oneOf:\n"
+ for _, s := range *(schema.OneOf) {
+ result += s.describeSchema(indent + " ")
+ result += indent + "-\n"
+ }
+ }
+ if schema.Not != nil {
+ result += indent + "not:\n"
+ result += schema.Not.describeSchema(indent + " ")
+ }
+ if schema.Definitions != nil {
+ result += indent + "definitions:\n"
+ for _, pair := range *(schema.Definitions) {
+ name := pair.Name
+ s := pair.Value
+ result += indent + " " + name + ":\n"
+ result += s.describeSchema(indent + " " + " ")
+ }
+ }
+ if schema.Title != nil {
+ result += indent + "title: " + *(schema.Title) + "\n"
+ }
+ if schema.Description != nil {
+ result += indent + "description: " + *(schema.Description) + "\n"
+ }
+ if schema.Default != nil {
+ result += indent + "default:\n"
+ result += indent + fmt.Sprintf(" %+v\n", *(schema.Default))
+ }
+ if schema.Format != nil {
+ result += indent + "format: " + *(schema.Format) + "\n"
+ }
+ if schema.Ref != nil {
+ result += indent + "$ref: " + *(schema.Ref) + "\n"
+ }
+ return result
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/models.go b/vendor/github.com/google/gnostic-models/jsonschema/models.go
new file mode 100644
index 000000000..4781bdc5f
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/models.go
@@ -0,0 +1,228 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package jsonschema supports the reading, writing, and manipulation
+// of JSON Schemas.
+package jsonschema
+
+import "gopkg.in/yaml.v3"
+
+// The Schema struct models a JSON Schema and, because schemas are
+// defined hierarchically, contains many references to itself.
+// All fields are pointers and are nil if the associated values
+// are not specified.
+type Schema struct {
+ Schema *string // $schema
+ ID *string // id keyword used for $ref resolution scope
+ Ref *string // $ref, i.e. JSON Pointers
+
+ // http://json-schema.org/latest/json-schema-validation.html
+ // 5.1. Validation keywords for numeric instances (number and integer)
+ MultipleOf *SchemaNumber
+ Maximum *SchemaNumber
+ ExclusiveMaximum *bool
+ Minimum *SchemaNumber
+ ExclusiveMinimum *bool
+
+ // 5.2. Validation keywords for strings
+ MaxLength *int64
+ MinLength *int64
+ Pattern *string
+
+ // 5.3. Validation keywords for arrays
+ AdditionalItems *SchemaOrBoolean
+ Items *SchemaOrSchemaArray
+ MaxItems *int64
+ MinItems *int64
+ UniqueItems *bool
+
+ // 5.4. Validation keywords for objects
+ MaxProperties *int64
+ MinProperties *int64
+ Required *[]string
+ AdditionalProperties *SchemaOrBoolean
+ Properties *[]*NamedSchema
+ PatternProperties *[]*NamedSchema
+ Dependencies *[]*NamedSchemaOrStringArray
+
+ // 5.5. Validation keywords for any instance type
+ Enumeration *[]SchemaEnumValue
+ Type *StringOrStringArray
+ AllOf *[]*Schema
+ AnyOf *[]*Schema
+ OneOf *[]*Schema
+ Not *Schema
+ Definitions *[]*NamedSchema
+
+ // 6. Metadata keywords
+ Title *string
+ Description *string
+ Default *yaml.Node
+
+ // 7. Semantic validation with "format"
+ Format *string
+}
+
+// These helper structs represent "combination" types that generally can
+// have values of one type or another. All are used to represent parts
+// of Schemas.
+
+// SchemaNumber represents a value that can be either an Integer or a Float.
+type SchemaNumber struct {
+ Integer *int64
+ Float *float64
+}
+
+// NewSchemaNumberWithInteger creates and returns a new object
+func NewSchemaNumberWithInteger(i int64) *SchemaNumber {
+ result := &SchemaNumber{}
+ result.Integer = &i
+ return result
+}
+
+// NewSchemaNumberWithFloat creates and returns a new object
+func NewSchemaNumberWithFloat(f float64) *SchemaNumber {
+ result := &SchemaNumber{}
+ result.Float = &f
+ return result
+}
+
+// SchemaOrBoolean represents a value that can be either a Schema or a Boolean.
+type SchemaOrBoolean struct {
+ Schema *Schema
+ Boolean *bool
+}
+
+// NewSchemaOrBooleanWithSchema creates and returns a new object
+func NewSchemaOrBooleanWithSchema(s *Schema) *SchemaOrBoolean {
+ result := &SchemaOrBoolean{}
+ result.Schema = s
+ return result
+}
+
+// NewSchemaOrBooleanWithBoolean creates and returns a new object
+func NewSchemaOrBooleanWithBoolean(b bool) *SchemaOrBoolean {
+ result := &SchemaOrBoolean{}
+ result.Boolean = &b
+ return result
+}
+
+// StringOrStringArray represents a value that can be either
+// a String or an Array of Strings.
+type StringOrStringArray struct {
+ String *string
+ StringArray *[]string
+}
+
+// NewStringOrStringArrayWithString creates and returns a new object
+func NewStringOrStringArrayWithString(s string) *StringOrStringArray {
+ result := &StringOrStringArray{}
+ result.String = &s
+ return result
+}
+
+// NewStringOrStringArrayWithStringArray creates and returns a new object
+func NewStringOrStringArrayWithStringArray(a []string) *StringOrStringArray {
+ result := &StringOrStringArray{}
+ result.StringArray = &a
+ return result
+}
+
+// SchemaOrStringArray represents a value that can be either
+// a Schema or an Array of Strings.
+type SchemaOrStringArray struct {
+ Schema *Schema
+ StringArray *[]string
+}
+
+// SchemaOrSchemaArray represents a value that can be either
+// a Schema or an Array of Schemas.
+type SchemaOrSchemaArray struct {
+ Schema *Schema
+ SchemaArray *[]*Schema
+}
+
+// NewSchemaOrSchemaArrayWithSchema creates and returns a new object
+func NewSchemaOrSchemaArrayWithSchema(s *Schema) *SchemaOrSchemaArray {
+ result := &SchemaOrSchemaArray{}
+ result.Schema = s
+ return result
+}
+
+// NewSchemaOrSchemaArrayWithSchemaArray creates and returns a new object
+func NewSchemaOrSchemaArrayWithSchemaArray(a []*Schema) *SchemaOrSchemaArray {
+ result := &SchemaOrSchemaArray{}
+ result.SchemaArray = &a
+ return result
+}
+
+// SchemaEnumValue represents a value that can be part of an
+// enumeration in a Schema.
+type SchemaEnumValue struct {
+ String *string
+ Bool *bool
+}
+
+// NamedSchema is a name-value pair that is used to emulate maps
+// with ordered keys.
+type NamedSchema struct {
+ Name string
+ Value *Schema
+}
+
+// NewNamedSchema creates and returns a new object
+func NewNamedSchema(name string, value *Schema) *NamedSchema {
+ return &NamedSchema{Name: name, Value: value}
+}
+
+// NamedSchemaOrStringArray is a name-value pair that is used
+// to emulate maps with ordered keys.
+type NamedSchemaOrStringArray struct {
+ Name string
+ Value *SchemaOrStringArray
+}
+
+// Access named subschemas by name
+
+func namedSchemaArrayElementWithName(array *[]*NamedSchema, name string) *Schema {
+ if array == nil {
+ return nil
+ }
+ for _, pair := range *array {
+ if pair.Name == name {
+ return pair.Value
+ }
+ }
+ return nil
+}
+
+// PropertyWithName returns the selected element.
+func (s *Schema) PropertyWithName(name string) *Schema {
+ return namedSchemaArrayElementWithName(s.Properties, name)
+}
+
+// PatternPropertyWithName returns the selected element.
+func (s *Schema) PatternPropertyWithName(name string) *Schema {
+ return namedSchemaArrayElementWithName(s.PatternProperties, name)
+}
+
+// DefinitionWithName returns the selected element.
+func (s *Schema) DefinitionWithName(name string) *Schema {
+ return namedSchemaArrayElementWithName(s.Definitions, name)
+}
+
+// AddProperty adds a named property.
+func (s *Schema) AddProperty(name string, property *Schema) {
+ *s.Properties = append(*s.Properties, NewNamedSchema(name, property))
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/operations.go b/vendor/github.com/google/gnostic-models/jsonschema/operations.go
new file mode 100644
index 000000000..ba8dd4a91
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/operations.go
@@ -0,0 +1,394 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package jsonschema
+
+import (
+ "fmt"
+ "log"
+ "strings"
+)
+
+//
+// OPERATIONS
+// The following methods perform operations on Schemas.
+//
+
+// IsEmpty returns true if no members of the Schema are specified.
+func (schema *Schema) IsEmpty() bool {
+ return (schema.Schema == nil) &&
+ (schema.ID == nil) &&
+ (schema.MultipleOf == nil) &&
+ (schema.Maximum == nil) &&
+ (schema.ExclusiveMaximum == nil) &&
+ (schema.Minimum == nil) &&
+ (schema.ExclusiveMinimum == nil) &&
+ (schema.MaxLength == nil) &&
+ (schema.MinLength == nil) &&
+ (schema.Pattern == nil) &&
+ (schema.AdditionalItems == nil) &&
+ (schema.Items == nil) &&
+ (schema.MaxItems == nil) &&
+ (schema.MinItems == nil) &&
+ (schema.UniqueItems == nil) &&
+ (schema.MaxProperties == nil) &&
+ (schema.MinProperties == nil) &&
+ (schema.Required == nil) &&
+ (schema.AdditionalProperties == nil) &&
+ (schema.Properties == nil) &&
+ (schema.PatternProperties == nil) &&
+ (schema.Dependencies == nil) &&
+ (schema.Enumeration == nil) &&
+ (schema.Type == nil) &&
+ (schema.AllOf == nil) &&
+ (schema.AnyOf == nil) &&
+ (schema.OneOf == nil) &&
+ (schema.Not == nil) &&
+ (schema.Definitions == nil) &&
+ (schema.Title == nil) &&
+ (schema.Description == nil) &&
+ (schema.Default == nil) &&
+ (schema.Format == nil) &&
+ (schema.Ref == nil)
+}
+
+// IsEqual returns true if two schemas are equal.
+func (schema *Schema) IsEqual(schema2 *Schema) bool {
+ return schema.String() == schema2.String()
+}
+
+// SchemaOperation represents a function that can be applied to a Schema.
+type SchemaOperation func(schema *Schema, context string)
+
+// Applies a specified function to a Schema and all of the Schemas that it contains.
+func (schema *Schema) applyToSchemas(operation SchemaOperation, context string) {
+
+ if schema.AdditionalItems != nil {
+ s := schema.AdditionalItems.Schema
+ if s != nil {
+ s.applyToSchemas(operation, "AdditionalItems")
+ }
+ }
+
+ if schema.Items != nil {
+ if schema.Items.SchemaArray != nil {
+ for _, s := range *(schema.Items.SchemaArray) {
+ s.applyToSchemas(operation, "Items.SchemaArray")
+ }
+ } else if schema.Items.Schema != nil {
+ schema.Items.Schema.applyToSchemas(operation, "Items.Schema")
+ }
+ }
+
+ if schema.AdditionalProperties != nil {
+ s := schema.AdditionalProperties.Schema
+ if s != nil {
+ s.applyToSchemas(operation, "AdditionalProperties")
+ }
+ }
+
+ if schema.Properties != nil {
+ for _, pair := range *(schema.Properties) {
+ s := pair.Value
+ s.applyToSchemas(operation, "Properties")
+ }
+ }
+ if schema.PatternProperties != nil {
+ for _, pair := range *(schema.PatternProperties) {
+ s := pair.Value
+ s.applyToSchemas(operation, "PatternProperties")
+ }
+ }
+
+ if schema.Dependencies != nil {
+ for _, pair := range *(schema.Dependencies) {
+ schemaOrStringArray := pair.Value
+ s := schemaOrStringArray.Schema
+ if s != nil {
+ s.applyToSchemas(operation, "Dependencies")
+ }
+ }
+ }
+
+ if schema.AllOf != nil {
+ for _, s := range *(schema.AllOf) {
+ s.applyToSchemas(operation, "AllOf")
+ }
+ }
+ if schema.AnyOf != nil {
+ for _, s := range *(schema.AnyOf) {
+ s.applyToSchemas(operation, "AnyOf")
+ }
+ }
+ if schema.OneOf != nil {
+ for _, s := range *(schema.OneOf) {
+ s.applyToSchemas(operation, "OneOf")
+ }
+ }
+ if schema.Not != nil {
+ schema.Not.applyToSchemas(operation, "Not")
+ }
+
+ if schema.Definitions != nil {
+ for _, pair := range *(schema.Definitions) {
+ s := pair.Value
+ s.applyToSchemas(operation, "Definitions")
+ }
+ }
+
+ operation(schema, context)
+}
+
+// CopyProperties copies all non-nil properties from the source Schema to the schema Schema.
+func (schema *Schema) CopyProperties(source *Schema) {
+ if source.Schema != nil {
+ schema.Schema = source.Schema
+ }
+ if source.ID != nil {
+ schema.ID = source.ID
+ }
+ if source.MultipleOf != nil {
+ schema.MultipleOf = source.MultipleOf
+ }
+ if source.Maximum != nil {
+ schema.Maximum = source.Maximum
+ }
+ if source.ExclusiveMaximum != nil {
+ schema.ExclusiveMaximum = source.ExclusiveMaximum
+ }
+ if source.Minimum != nil {
+ schema.Minimum = source.Minimum
+ }
+ if source.ExclusiveMinimum != nil {
+ schema.ExclusiveMinimum = source.ExclusiveMinimum
+ }
+ if source.MaxLength != nil {
+ schema.MaxLength = source.MaxLength
+ }
+ if source.MinLength != nil {
+ schema.MinLength = source.MinLength
+ }
+ if source.Pattern != nil {
+ schema.Pattern = source.Pattern
+ }
+ if source.AdditionalItems != nil {
+ schema.AdditionalItems = source.AdditionalItems
+ }
+ if source.Items != nil {
+ schema.Items = source.Items
+ }
+ if source.MaxItems != nil {
+ schema.MaxItems = source.MaxItems
+ }
+ if source.MinItems != nil {
+ schema.MinItems = source.MinItems
+ }
+ if source.UniqueItems != nil {
+ schema.UniqueItems = source.UniqueItems
+ }
+ if source.MaxProperties != nil {
+ schema.MaxProperties = source.MaxProperties
+ }
+ if source.MinProperties != nil {
+ schema.MinProperties = source.MinProperties
+ }
+ if source.Required != nil {
+ schema.Required = source.Required
+ }
+ if source.AdditionalProperties != nil {
+ schema.AdditionalProperties = source.AdditionalProperties
+ }
+ if source.Properties != nil {
+ schema.Properties = source.Properties
+ }
+ if source.PatternProperties != nil {
+ schema.PatternProperties = source.PatternProperties
+ }
+ if source.Dependencies != nil {
+ schema.Dependencies = source.Dependencies
+ }
+ if source.Enumeration != nil {
+ schema.Enumeration = source.Enumeration
+ }
+ if source.Type != nil {
+ schema.Type = source.Type
+ }
+ if source.AllOf != nil {
+ schema.AllOf = source.AllOf
+ }
+ if source.AnyOf != nil {
+ schema.AnyOf = source.AnyOf
+ }
+ if source.OneOf != nil {
+ schema.OneOf = source.OneOf
+ }
+ if source.Not != nil {
+ schema.Not = source.Not
+ }
+ if source.Definitions != nil {
+ schema.Definitions = source.Definitions
+ }
+ if source.Title != nil {
+ schema.Title = source.Title
+ }
+ if source.Description != nil {
+ schema.Description = source.Description
+ }
+ if source.Default != nil {
+ schema.Default = source.Default
+ }
+ if source.Format != nil {
+ schema.Format = source.Format
+ }
+ if source.Ref != nil {
+ schema.Ref = source.Ref
+ }
+}
+
+// TypeIs returns true if the Type of a Schema includes the specified type
+func (schema *Schema) TypeIs(typeName string) bool {
+ if schema.Type != nil {
+ // the schema Type is either a string or an array of strings
+ if schema.Type.String != nil {
+ return (*(schema.Type.String) == typeName)
+ } else if schema.Type.StringArray != nil {
+ for _, n := range *(schema.Type.StringArray) {
+ if n == typeName {
+ return true
+ }
+ }
+ }
+ }
+ return false
+}
+
+// ResolveRefs resolves "$ref" elements in a Schema and its children.
+// But if a reference refers to an object type, is inside a oneOf, or contains a oneOf,
+// the reference is kept and we expect downstream tools to separately model these
+// referenced schemas.
+func (schema *Schema) ResolveRefs() {
+ rootSchema := schema
+ count := 1
+ for count > 0 {
+ count = 0
+ schema.applyToSchemas(
+ func(schema *Schema, context string) {
+ if schema.Ref != nil {
+ resolvedRef, err := rootSchema.resolveJSONPointer(*(schema.Ref))
+ if err != nil {
+ log.Printf("%+v", err)
+ } else if resolvedRef.TypeIs("object") {
+ // don't substitute for objects, we'll model the referenced schema with a class
+ } else if context == "OneOf" {
+ // don't substitute for references inside oneOf declarations
+ } else if resolvedRef.OneOf != nil {
+ // don't substitute for references that contain oneOf declarations
+ } else if resolvedRef.AdditionalProperties != nil {
+ // don't substitute for references that look like objects
+ } else {
+ schema.Ref = nil
+ schema.CopyProperties(resolvedRef)
+ count++
+ }
+ }
+ }, "")
+ }
+}
+
+// resolveJSONPointer resolves JSON pointers.
+// This current implementation is very crude and custom for OpenAPI 2.0 schemas.
+// It panics for any pointer that it is unable to resolve.
+func (schema *Schema) resolveJSONPointer(ref string) (result *Schema, err error) {
+ parts := strings.Split(ref, "#")
+ if len(parts) == 2 {
+ documentName := parts[0] + "#"
+ if documentName == "#" && schema.ID != nil {
+ documentName = *(schema.ID)
+ }
+ path := parts[1]
+ document := schemas[documentName]
+ pathParts := strings.Split(path, "/")
+
+ // we currently do a very limited (hard-coded) resolution of certain paths and log errors for missed cases
+ if len(pathParts) == 1 {
+ return document, nil
+ } else if len(pathParts) == 3 {
+ switch pathParts[1] {
+ case "definitions":
+ dictionary := document.Definitions
+ for _, pair := range *dictionary {
+ if pair.Name == pathParts[2] {
+ result = pair.Value
+ }
+ }
+ case "properties":
+ dictionary := document.Properties
+ for _, pair := range *dictionary {
+ if pair.Name == pathParts[2] {
+ result = pair.Value
+ }
+ }
+ default:
+ break
+ }
+ }
+ }
+ if result == nil {
+ return nil, fmt.Errorf("unresolved pointer: %+v", ref)
+ }
+ return result, nil
+}
+
+// ResolveAllOfs replaces "allOf" elements by merging their properties into the parent Schema.
+func (schema *Schema) ResolveAllOfs() {
+ schema.applyToSchemas(
+ func(schema *Schema, context string) {
+ if schema.AllOf != nil {
+ for _, allOf := range *(schema.AllOf) {
+ schema.CopyProperties(allOf)
+ }
+ schema.AllOf = nil
+ }
+ }, "resolveAllOfs")
+}
+
+// ResolveAnyOfs replaces all "anyOf" elements with "oneOf".
+func (schema *Schema) ResolveAnyOfs() {
+ schema.applyToSchemas(
+ func(schema *Schema, context string) {
+ if schema.AnyOf != nil {
+ schema.OneOf = schema.AnyOf
+ schema.AnyOf = nil
+ }
+ }, "resolveAnyOfs")
+}
+
+// return a pointer to a copy of a passed-in string
+func stringptr(input string) (output *string) {
+ return &input
+}
+
+// CopyOfficialSchemaProperty copies a named property from the official JSON Schema definition
+func (schema *Schema) CopyOfficialSchemaProperty(name string) {
+ *schema.Properties = append(*schema.Properties,
+ NewNamedSchema(name,
+ &Schema{Ref: stringptr("http://json-schema.org/draft-04/schema#/properties/" + name)}))
+}
+
+// CopyOfficialSchemaProperties copies named properties from the official JSON Schema definition
+func (schema *Schema) CopyOfficialSchemaProperties(names []string) {
+ for _, name := range names {
+ schema.CopyOfficialSchemaProperty(name)
+ }
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/reader.go b/vendor/github.com/google/gnostic-models/jsonschema/reader.go
new file mode 100644
index 000000000..b8583d466
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/reader.go
@@ -0,0 +1,442 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:generate go run generate-base.go
+
+package jsonschema
+
+import (
+ "fmt"
+ "io/ioutil"
+ "strconv"
+
+ "gopkg.in/yaml.v3"
+)
+
+// This is a global map of all known Schemas.
+// It is initialized when the first Schema is created and inserted.
+var schemas map[string]*Schema
+
+// NewBaseSchema builds a schema object from an embedded json representation.
+func NewBaseSchema() (schema *Schema, err error) {
+ b, err := baseSchemaBytes()
+ if err != nil {
+ return nil, err
+ }
+ var node yaml.Node
+ err = yaml.Unmarshal(b, &node)
+ if err != nil {
+ return nil, err
+ }
+ return NewSchemaFromObject(&node), nil
+}
+
+// NewSchemaFromFile reads a schema from a file.
+// Currently this assumes that schemas are stored in the source distribution of this project.
+func NewSchemaFromFile(filename string) (schema *Schema, err error) {
+ file, err := ioutil.ReadFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ var node yaml.Node
+ err = yaml.Unmarshal(file, &node)
+ if err != nil {
+ return nil, err
+ }
+ return NewSchemaFromObject(&node), nil
+}
+
+// NewSchemaFromObject constructs a schema from a parsed JSON object.
+// Due to the complexity of the schema representation, this is a
+// custom reader and not the standard Go JSON reader (encoding/json).
+func NewSchemaFromObject(jsonData *yaml.Node) *Schema {
+ switch jsonData.Kind {
+ case yaml.DocumentNode:
+ return NewSchemaFromObject(jsonData.Content[0])
+ case yaml.MappingNode:
+ schema := &Schema{}
+
+ for i := 0; i < len(jsonData.Content); i += 2 {
+ k := jsonData.Content[i].Value
+ v := jsonData.Content[i+1]
+
+ switch k {
+ case "$schema":
+ schema.Schema = schema.stringValue(v)
+ case "id":
+ schema.ID = schema.stringValue(v)
+
+ case "multipleOf":
+ schema.MultipleOf = schema.numberValue(v)
+ case "maximum":
+ schema.Maximum = schema.numberValue(v)
+ case "exclusiveMaximum":
+ schema.ExclusiveMaximum = schema.boolValue(v)
+ case "minimum":
+ schema.Minimum = schema.numberValue(v)
+ case "exclusiveMinimum":
+ schema.ExclusiveMinimum = schema.boolValue(v)
+
+ case "maxLength":
+ schema.MaxLength = schema.intValue(v)
+ case "minLength":
+ schema.MinLength = schema.intValue(v)
+ case "pattern":
+ schema.Pattern = schema.stringValue(v)
+
+ case "additionalItems":
+ schema.AdditionalItems = schema.schemaOrBooleanValue(v)
+ case "items":
+ schema.Items = schema.schemaOrSchemaArrayValue(v)
+ case "maxItems":
+ schema.MaxItems = schema.intValue(v)
+ case "minItems":
+ schema.MinItems = schema.intValue(v)
+ case "uniqueItems":
+ schema.UniqueItems = schema.boolValue(v)
+
+ case "maxProperties":
+ schema.MaxProperties = schema.intValue(v)
+ case "minProperties":
+ schema.MinProperties = schema.intValue(v)
+ case "required":
+ schema.Required = schema.arrayOfStringsValue(v)
+ case "additionalProperties":
+ schema.AdditionalProperties = schema.schemaOrBooleanValue(v)
+ case "properties":
+ schema.Properties = schema.mapOfSchemasValue(v)
+ case "patternProperties":
+ schema.PatternProperties = schema.mapOfSchemasValue(v)
+ case "dependencies":
+ schema.Dependencies = schema.mapOfSchemasOrStringArraysValue(v)
+
+ case "enum":
+ schema.Enumeration = schema.arrayOfEnumValuesValue(v)
+
+ case "type":
+ schema.Type = schema.stringOrStringArrayValue(v)
+ case "allOf":
+ schema.AllOf = schema.arrayOfSchemasValue(v)
+ case "anyOf":
+ schema.AnyOf = schema.arrayOfSchemasValue(v)
+ case "oneOf":
+ schema.OneOf = schema.arrayOfSchemasValue(v)
+ case "not":
+ schema.Not = NewSchemaFromObject(v)
+ case "definitions":
+ schema.Definitions = schema.mapOfSchemasValue(v)
+
+ case "title":
+ schema.Title = schema.stringValue(v)
+ case "description":
+ schema.Description = schema.stringValue(v)
+
+ case "default":
+ schema.Default = v
+
+ case "format":
+ schema.Format = schema.stringValue(v)
+ case "$ref":
+ schema.Ref = schema.stringValue(v)
+ default:
+ fmt.Printf("UNSUPPORTED (%s)\n", k)
+ }
+ }
+
+ // insert schema in global map
+ if schema.ID != nil {
+ if schemas == nil {
+ schemas = make(map[string]*Schema, 0)
+ }
+ schemas[*(schema.ID)] = schema
+ }
+ return schema
+
+ default:
+ fmt.Printf("schemaValue: unexpected node %+v\n", jsonData)
+ return nil
+ }
+
+ return nil
+}
+
+//
+// BUILDERS
+// The following methods build elements of Schemas from interface{} values.
+// Each returns nil if it is unable to build the desired element.
+//
+
+// Gets the string value of an interface{} value if possible.
+func (schema *Schema) stringValue(v *yaml.Node) *string {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ return &v.Value
+ default:
+ fmt.Printf("stringValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets the numeric value of an interface{} value if possible.
+func (schema *Schema) numberValue(v *yaml.Node) *SchemaNumber {
+ number := &SchemaNumber{}
+ switch v.Kind {
+ case yaml.ScalarNode:
+ switch v.Tag {
+ case "!!float":
+ v2, _ := strconv.ParseFloat(v.Value, 64)
+ number.Float = &v2
+ return number
+ case "!!int":
+ v2, _ := strconv.ParseInt(v.Value, 10, 64)
+ number.Integer = &v2
+ return number
+ default:
+ fmt.Printf("stringValue: unexpected node %+v\n", v)
+ }
+ default:
+ fmt.Printf("stringValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets the integer value of an interface{} value if possible.
+func (schema *Schema) intValue(v *yaml.Node) *int64 {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ switch v.Tag {
+ case "!!float":
+ v2, _ := strconv.ParseFloat(v.Value, 64)
+ v3 := int64(v2)
+ return &v3
+ case "!!int":
+ v2, _ := strconv.ParseInt(v.Value, 10, 64)
+ return &v2
+ default:
+ fmt.Printf("intValue: unexpected node %+v\n", v)
+ }
+ default:
+ fmt.Printf("intValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets the bool value of an interface{} value if possible.
+func (schema *Schema) boolValue(v *yaml.Node) *bool {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ switch v.Tag {
+ case "!!bool":
+ v2, _ := strconv.ParseBool(v.Value)
+ return &v2
+ default:
+ fmt.Printf("boolValue: unexpected node %+v\n", v)
+ }
+ default:
+ fmt.Printf("boolValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets a map of Schemas from an interface{} value if possible.
+func (schema *Schema) mapOfSchemasValue(v *yaml.Node) *[]*NamedSchema {
+ switch v.Kind {
+ case yaml.MappingNode:
+ m := make([]*NamedSchema, 0)
+ for i := 0; i < len(v.Content); i += 2 {
+ k2 := v.Content[i].Value
+ v2 := v.Content[i+1]
+ pair := &NamedSchema{Name: k2, Value: NewSchemaFromObject(v2)}
+ m = append(m, pair)
+ }
+ return &m
+ default:
+ fmt.Printf("mapOfSchemasValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets an array of Schemas from an interface{} value if possible.
+func (schema *Schema) arrayOfSchemasValue(v *yaml.Node) *[]*Schema {
+ switch v.Kind {
+ case yaml.SequenceNode:
+ m := make([]*Schema, 0)
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.MappingNode:
+ s := NewSchemaFromObject(v2)
+ m = append(m, s)
+ default:
+ fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v2)
+ }
+ }
+ return &m
+ case yaml.MappingNode:
+ m := make([]*Schema, 0)
+ s := NewSchemaFromObject(v)
+ m = append(m, s)
+ return &m
+ default:
+ fmt.Printf("arrayOfSchemasValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets a Schema or an array of Schemas from an interface{} value if possible.
+func (schema *Schema) schemaOrSchemaArrayValue(v *yaml.Node) *SchemaOrSchemaArray {
+ switch v.Kind {
+ case yaml.SequenceNode:
+ m := make([]*Schema, 0)
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.MappingNode:
+ s := NewSchemaFromObject(v2)
+ m = append(m, s)
+ default:
+ fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v2)
+ }
+ }
+ return &SchemaOrSchemaArray{SchemaArray: &m}
+ case yaml.MappingNode:
+ s := NewSchemaFromObject(v)
+ return &SchemaOrSchemaArray{Schema: s}
+ default:
+ fmt.Printf("schemaOrSchemaArrayValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets an array of strings from an interface{} value if possible.
+func (schema *Schema) arrayOfStringsValue(v *yaml.Node) *[]string {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ a := []string{v.Value}
+ return &a
+ case yaml.SequenceNode:
+ a := make([]string, 0)
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.ScalarNode:
+ a = append(a, v2.Value)
+ default:
+ fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2)
+ }
+ }
+ return &a
+ default:
+ fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets a string or an array of strings from an interface{} value if possible.
+func (schema *Schema) stringOrStringArrayValue(v *yaml.Node) *StringOrStringArray {
+ switch v.Kind {
+ case yaml.ScalarNode:
+ s := &StringOrStringArray{}
+ s.String = &v.Value
+ return s
+ case yaml.SequenceNode:
+ a := make([]string, 0)
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.ScalarNode:
+ a = append(a, v2.Value)
+ default:
+ fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v2)
+ }
+ }
+ s := &StringOrStringArray{}
+ s.StringArray = &a
+ return s
+ default:
+ fmt.Printf("arrayOfStringsValue: unexpected node %+v\n", v)
+ }
+ return nil
+}
+
+// Gets an array of enum values from an interface{} value if possible.
+func (schema *Schema) arrayOfEnumValuesValue(v *yaml.Node) *[]SchemaEnumValue {
+ a := make([]SchemaEnumValue, 0)
+ switch v.Kind {
+ case yaml.SequenceNode:
+ for _, v2 := range v.Content {
+ switch v2.Kind {
+ case yaml.ScalarNode:
+ switch v2.Tag {
+ case "!!str":
+ a = append(a, SchemaEnumValue{String: &v2.Value})
+ case "!!bool":
+ v3, _ := strconv.ParseBool(v2.Value)
+ a = append(a, SchemaEnumValue{Bool: &v3})
+ default:
+ fmt.Printf("arrayOfEnumValuesValue: unexpected type %s\n", v2.Tag)
+ }
+ default:
+ fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v2)
+ }
+ }
+ default:
+ fmt.Printf("arrayOfEnumValuesValue: unexpected node %+v\n", v)
+ }
+ return &a
+}
+
+// Gets a map of schemas or string arrays from an interface{} value if possible.
+func (schema *Schema) mapOfSchemasOrStringArraysValue(v *yaml.Node) *[]*NamedSchemaOrStringArray {
+ m := make([]*NamedSchemaOrStringArray, 0)
+ switch v.Kind {
+ case yaml.MappingNode:
+ for i := 0; i < len(v.Content); i += 2 {
+ k2 := v.Content[i].Value
+ v2 := v.Content[i+1]
+ switch v2.Kind {
+ case yaml.SequenceNode:
+ a := make([]string, 0)
+ for _, v3 := range v2.Content {
+ switch v3.Kind {
+ case yaml.ScalarNode:
+ a = append(a, v3.Value)
+ default:
+ fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v3)
+ }
+ }
+ s := &SchemaOrStringArray{}
+ s.StringArray = &a
+ pair := &NamedSchemaOrStringArray{Name: k2, Value: s}
+ m = append(m, pair)
+ default:
+ fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v2)
+ }
+ }
+ default:
+ fmt.Printf("mapOfSchemasOrStringArraysValue: unexpected node %+v\n", v)
+ }
+ return &m
+}
+
+// Gets a schema or a boolean value from an interface{} value if possible.
+func (schema *Schema) schemaOrBooleanValue(v *yaml.Node) *SchemaOrBoolean {
+ schemaOrBoolean := &SchemaOrBoolean{}
+ switch v.Kind {
+ case yaml.ScalarNode:
+ v2, _ := strconv.ParseBool(v.Value)
+ schemaOrBoolean.Boolean = &v2
+ case yaml.MappingNode:
+ schemaOrBoolean.Schema = NewSchemaFromObject(v)
+ default:
+ fmt.Printf("schemaOrBooleanValue: unexpected node %+v\n", v)
+ }
+ return schemaOrBoolean
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/schema.json b/vendor/github.com/google/gnostic-models/jsonschema/schema.json
new file mode 100644
index 000000000..85eb502a6
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/schema.json
@@ -0,0 +1,150 @@
+{
+ "id": "http://json-schema.org/draft-04/schema#",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "Core schema meta-schema",
+ "definitions": {
+ "schemaArray": {
+ "type": "array",
+ "minItems": 1,
+ "items": { "$ref": "#" }
+ },
+ "positiveInteger": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "positiveIntegerDefault0": {
+ "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
+ },
+ "simpleTypes": {
+ "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
+ },
+ "stringArray": {
+ "type": "array",
+ "items": { "type": "string" },
+ "minItems": 1,
+ "uniqueItems": true
+ }
+ },
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "format": "uri"
+ },
+ "$schema": {
+ "type": "string",
+ "format": "uri"
+ },
+ "title": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "default": {},
+ "multipleOf": {
+ "type": "number",
+ "minimum": 0,
+ "exclusiveMinimum": true
+ },
+ "maximum": {
+ "type": "number"
+ },
+ "exclusiveMaximum": {
+ "type": "boolean",
+ "default": false
+ },
+ "minimum": {
+ "type": "number"
+ },
+ "exclusiveMinimum": {
+ "type": "boolean",
+ "default": false
+ },
+ "maxLength": { "$ref": "#/definitions/positiveInteger" },
+ "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
+ "pattern": {
+ "type": "string",
+ "format": "regex"
+ },
+ "additionalItems": {
+ "anyOf": [
+ { "type": "boolean" },
+ { "$ref": "#" }
+ ],
+ "default": {}
+ },
+ "items": {
+ "anyOf": [
+ { "$ref": "#" },
+ { "$ref": "#/definitions/schemaArray" }
+ ],
+ "default": {}
+ },
+ "maxItems": { "$ref": "#/definitions/positiveInteger" },
+ "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
+ "uniqueItems": {
+ "type": "boolean",
+ "default": false
+ },
+ "maxProperties": { "$ref": "#/definitions/positiveInteger" },
+ "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
+ "required": { "$ref": "#/definitions/stringArray" },
+ "additionalProperties": {
+ "anyOf": [
+ { "type": "boolean" },
+ { "$ref": "#" }
+ ],
+ "default": {}
+ },
+ "definitions": {
+ "type": "object",
+ "additionalProperties": { "$ref": "#" },
+ "default": {}
+ },
+ "properties": {
+ "type": "object",
+ "additionalProperties": { "$ref": "#" },
+ "default": {}
+ },
+ "patternProperties": {
+ "type": "object",
+ "additionalProperties": { "$ref": "#" },
+ "default": {}
+ },
+ "dependencies": {
+ "type": "object",
+ "additionalProperties": {
+ "anyOf": [
+ { "$ref": "#" },
+ { "$ref": "#/definitions/stringArray" }
+ ]
+ }
+ },
+ "enum": {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true
+ },
+ "type": {
+ "anyOf": [
+ { "$ref": "#/definitions/simpleTypes" },
+ {
+ "type": "array",
+ "items": { "$ref": "#/definitions/simpleTypes" },
+ "minItems": 1,
+ "uniqueItems": true
+ }
+ ]
+ },
+ "allOf": { "$ref": "#/definitions/schemaArray" },
+ "anyOf": { "$ref": "#/definitions/schemaArray" },
+ "oneOf": { "$ref": "#/definitions/schemaArray" },
+ "not": { "$ref": "#" }
+ },
+ "dependencies": {
+ "exclusiveMaximum": [ "maximum" ],
+ "exclusiveMinimum": [ "minimum" ]
+ },
+ "default": {}
+}
diff --git a/vendor/github.com/google/gnostic-models/jsonschema/writer.go b/vendor/github.com/google/gnostic-models/jsonschema/writer.go
new file mode 100644
index 000000000..340dc5f93
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/jsonschema/writer.go
@@ -0,0 +1,369 @@
+// Copyright 2017 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package jsonschema
+
+import (
+ "fmt"
+
+ "gopkg.in/yaml.v3"
+)
+
+const indentation = " "
+
+func renderMappingNode(node *yaml.Node, indent string) (result string) {
+ result = "{\n"
+ innerIndent := indent + indentation
+ for i := 0; i < len(node.Content); i += 2 {
+ // first print the key
+ key := node.Content[i].Value
+ result += fmt.Sprintf("%s\"%+v\": ", innerIndent, key)
+ // then the value
+ value := node.Content[i+1]
+ switch value.Kind {
+ case yaml.ScalarNode:
+ result += "\"" + value.Value + "\""
+ case yaml.MappingNode:
+ result += renderMappingNode(value, innerIndent)
+ case yaml.SequenceNode:
+ result += renderSequenceNode(value, innerIndent)
+ default:
+ result += fmt.Sprintf("???MapItem(Key:%+v, Value:%T)", value, value)
+ }
+ if i < len(node.Content)-2 {
+ result += ","
+ }
+ result += "\n"
+ }
+
+ result += indent + "}"
+ return result
+}
+
+func renderSequenceNode(node *yaml.Node, indent string) (result string) {
+ result = "[\n"
+ innerIndent := indent + indentation
+ for i := 0; i < len(node.Content); i++ {
+ item := node.Content[i]
+ switch item.Kind {
+ case yaml.ScalarNode:
+ result += innerIndent + "\"" + item.Value + "\""
+ case yaml.MappingNode:
+ result += innerIndent + renderMappingNode(item, innerIndent) + ""
+ default:
+ result += innerIndent + fmt.Sprintf("???ArrayItem(%+v)", item)
+ }
+ if i < len(node.Content)-1 {
+ result += ","
+ }
+ result += "\n"
+ }
+ result += indent + "]"
+ return result
+}
+
+func renderStringArray(array []string, indent string) (result string) {
+ result = "[\n"
+ innerIndent := indent + indentation
+ for i, item := range array {
+ result += innerIndent + "\"" + item + "\""
+ if i < len(array)-1 {
+ result += ","
+ }
+ result += "\n"
+ }
+ result += indent + "]"
+ return result
+}
+
+// Render renders a yaml.Node as JSON
+func Render(node *yaml.Node) string {
+ if node.Kind == yaml.DocumentNode {
+ if len(node.Content) == 1 {
+ return Render(node.Content[0])
+ }
+ } else if node.Kind == yaml.MappingNode {
+ return renderMappingNode(node, "") + "\n"
+ } else if node.Kind == yaml.SequenceNode {
+ return renderSequenceNode(node, "") + "\n"
+ }
+ return ""
+}
+
+func (object *SchemaNumber) nodeValue() *yaml.Node {
+ if object.Integer != nil {
+ return nodeForInt64(*object.Integer)
+ } else if object.Float != nil {
+ return nodeForFloat64(*object.Float)
+ } else {
+ return nil
+ }
+}
+
+func (object *SchemaOrBoolean) nodeValue() *yaml.Node {
+ if object.Schema != nil {
+ return object.Schema.nodeValue()
+ } else if object.Boolean != nil {
+ return nodeForBoolean(*object.Boolean)
+ } else {
+ return nil
+ }
+}
+
+func nodeForStringArray(array []string) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, item := range array {
+ content = append(content, nodeForString(item))
+ }
+ return nodeForSequence(content)
+}
+
+func nodeForSchemaArray(array []*Schema) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, item := range array {
+ content = append(content, item.nodeValue())
+ }
+ return nodeForSequence(content)
+}
+
+func (object *StringOrStringArray) nodeValue() *yaml.Node {
+ if object.String != nil {
+ return nodeForString(*object.String)
+ } else if object.StringArray != nil {
+ return nodeForStringArray(*(object.StringArray))
+ } else {
+ return nil
+ }
+}
+
+func (object *SchemaOrStringArray) nodeValue() *yaml.Node {
+ if object.Schema != nil {
+ return object.Schema.nodeValue()
+ } else if object.StringArray != nil {
+ return nodeForStringArray(*(object.StringArray))
+ } else {
+ return nil
+ }
+}
+
+func (object *SchemaOrSchemaArray) nodeValue() *yaml.Node {
+ if object.Schema != nil {
+ return object.Schema.nodeValue()
+ } else if object.SchemaArray != nil {
+ return nodeForSchemaArray(*(object.SchemaArray))
+ } else {
+ return nil
+ }
+}
+
+func (object *SchemaEnumValue) nodeValue() *yaml.Node {
+ if object.String != nil {
+ return nodeForString(*object.String)
+ } else if object.Bool != nil {
+ return nodeForBoolean(*object.Bool)
+ } else {
+ return nil
+ }
+}
+
+func nodeForNamedSchemaArray(array *[]*NamedSchema) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, pair := range *(array) {
+ content = appendPair(content, pair.Name, pair.Value.nodeValue())
+ }
+ return nodeForMapping(content)
+}
+
+func nodeForNamedSchemaOrStringArray(array *[]*NamedSchemaOrStringArray) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, pair := range *(array) {
+ content = appendPair(content, pair.Name, pair.Value.nodeValue())
+ }
+ return nodeForMapping(content)
+}
+
+func nodeForSchemaEnumArray(array *[]SchemaEnumValue) *yaml.Node {
+ content := make([]*yaml.Node, 0)
+ for _, item := range *array {
+ content = append(content, item.nodeValue())
+ }
+ return nodeForSequence(content)
+}
+
+func nodeForMapping(content []*yaml.Node) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.MappingNode,
+ Content: content,
+ }
+}
+
+func nodeForSequence(content []*yaml.Node) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.SequenceNode,
+ Content: content,
+ }
+}
+
+func nodeForString(value string) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!str",
+ Value: value,
+ }
+}
+
+func nodeForBoolean(value bool) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!bool",
+ Value: fmt.Sprintf("%t", value),
+ }
+}
+
+func nodeForInt64(value int64) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!int",
+ Value: fmt.Sprintf("%d", value),
+ }
+}
+
+func nodeForFloat64(value float64) *yaml.Node {
+ return &yaml.Node{
+ Kind: yaml.ScalarNode,
+ Tag: "!!float",
+ Value: fmt.Sprintf("%f", value),
+ }
+}
+
+func appendPair(nodes []*yaml.Node, name string, value *yaml.Node) []*yaml.Node {
+ nodes = append(nodes, nodeForString(name))
+ nodes = append(nodes, value)
+ return nodes
+}
+
+func (schema *Schema) nodeValue() *yaml.Node {
+ n := &yaml.Node{Kind: yaml.MappingNode}
+ content := make([]*yaml.Node, 0)
+ if schema.Title != nil {
+ content = appendPair(content, "title", nodeForString(*schema.Title))
+ }
+ if schema.ID != nil {
+ content = appendPair(content, "id", nodeForString(*schema.ID))
+ }
+ if schema.Schema != nil {
+ content = appendPair(content, "$schema", nodeForString(*schema.Schema))
+ }
+ if schema.Type != nil {
+ content = appendPair(content, "type", schema.Type.nodeValue())
+ }
+ if schema.Items != nil {
+ content = appendPair(content, "items", schema.Items.nodeValue())
+ }
+ if schema.Description != nil {
+ content = appendPair(content, "description", nodeForString(*schema.Description))
+ }
+ if schema.Required != nil {
+ content = appendPair(content, "required", nodeForStringArray(*schema.Required))
+ }
+ if schema.AdditionalProperties != nil {
+ content = appendPair(content, "additionalProperties", schema.AdditionalProperties.nodeValue())
+ }
+ if schema.PatternProperties != nil {
+ content = appendPair(content, "patternProperties", nodeForNamedSchemaArray(schema.PatternProperties))
+ }
+ if schema.Properties != nil {
+ content = appendPair(content, "properties", nodeForNamedSchemaArray(schema.Properties))
+ }
+ if schema.Dependencies != nil {
+ content = appendPair(content, "dependencies", nodeForNamedSchemaOrStringArray(schema.Dependencies))
+ }
+ if schema.Ref != nil {
+ content = appendPair(content, "$ref", nodeForString(*schema.Ref))
+ }
+ if schema.MultipleOf != nil {
+ content = appendPair(content, "multipleOf", schema.MultipleOf.nodeValue())
+ }
+ if schema.Maximum != nil {
+ content = appendPair(content, "maximum", schema.Maximum.nodeValue())
+ }
+ if schema.ExclusiveMaximum != nil {
+ content = appendPair(content, "exclusiveMaximum", nodeForBoolean(*schema.ExclusiveMaximum))
+ }
+ if schema.Minimum != nil {
+ content = appendPair(content, "minimum", schema.Minimum.nodeValue())
+ }
+ if schema.ExclusiveMinimum != nil {
+ content = appendPair(content, "exclusiveMinimum", nodeForBoolean(*schema.ExclusiveMinimum))
+ }
+ if schema.MaxLength != nil {
+ content = appendPair(content, "maxLength", nodeForInt64(*schema.MaxLength))
+ }
+ if schema.MinLength != nil {
+ content = appendPair(content, "minLength", nodeForInt64(*schema.MinLength))
+ }
+ if schema.Pattern != nil {
+ content = appendPair(content, "pattern", nodeForString(*schema.Pattern))
+ }
+ if schema.AdditionalItems != nil {
+ content = appendPair(content, "additionalItems", schema.AdditionalItems.nodeValue())
+ }
+ if schema.MaxItems != nil {
+ content = appendPair(content, "maxItems", nodeForInt64(*schema.MaxItems))
+ }
+ if schema.MinItems != nil {
+ content = appendPair(content, "minItems", nodeForInt64(*schema.MinItems))
+ }
+ if schema.UniqueItems != nil {
+ content = appendPair(content, "uniqueItems", nodeForBoolean(*schema.UniqueItems))
+ }
+ if schema.MaxProperties != nil {
+ content = appendPair(content, "maxProperties", nodeForInt64(*schema.MaxProperties))
+ }
+ if schema.MinProperties != nil {
+ content = appendPair(content, "minProperties", nodeForInt64(*schema.MinProperties))
+ }
+ if schema.Enumeration != nil {
+ content = appendPair(content, "enum", nodeForSchemaEnumArray(schema.Enumeration))
+ }
+ if schema.AllOf != nil {
+ content = appendPair(content, "allOf", nodeForSchemaArray(*schema.AllOf))
+ }
+ if schema.AnyOf != nil {
+ content = appendPair(content, "anyOf", nodeForSchemaArray(*schema.AnyOf))
+ }
+ if schema.OneOf != nil {
+ content = appendPair(content, "oneOf", nodeForSchemaArray(*schema.OneOf))
+ }
+ if schema.Not != nil {
+ content = appendPair(content, "not", schema.Not.nodeValue())
+ }
+ if schema.Definitions != nil {
+ content = appendPair(content, "definitions", nodeForNamedSchemaArray(schema.Definitions))
+ }
+ if schema.Default != nil {
+ // m = append(m, yaml.MapItem{Key: "default", Value: *schema.Default})
+ }
+ if schema.Format != nil {
+ content = appendPair(content, "format", nodeForString(*schema.Format))
+ }
+ n.Content = content
+ return n
+}
+
+// JSONString returns a json representation of a schema.
+func (schema *Schema) JSONString() string {
+ node := schema.nodeValue()
+ return Render(node)
+}
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go
new file mode 100644
index 000000000..d71fe6d54
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.go
@@ -0,0 +1,8820 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+package openapi_v2
+
+import (
+ "fmt"
+ "regexp"
+ "strings"
+
+ "gopkg.in/yaml.v3"
+
+ "github.com/google/gnostic-models/compiler"
+)
+
+// Version returns the package name (and OpenAPI version).
+func Version() string {
+ return "openapi_v2"
+}
+
+// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not.
+func NewAdditionalPropertiesItem(in *yaml.Node, context *compiler.Context) (*AdditionalPropertiesItem, error) {
+ errors := make([]error, 0)
+ x := &AdditionalPropertiesItem{}
+ matched := false
+ // Schema schema = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context))
+ if matchingError == nil {
+ x.Oneof = &AdditionalPropertiesItem_Schema{Schema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // bool boolean = 2;
+ boolValue, ok := compiler.BoolForScalarNode(in)
+ if ok {
+ x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue}
+ matched = true
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid AdditionalPropertiesItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewAny creates an object of type Any if possible, returning an error if not.
+func NewAny(in *yaml.Node, context *compiler.Context) (*Any, error) {
+ errors := make([]error, 0)
+ x := &Any{}
+ bytes := compiler.Marshal(in)
+ x.Yaml = string(bytes)
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewApiKeySecurity creates an object of type ApiKeySecurity if possible, returning an error if not.
+func NewApiKeySecurity(in *yaml.Node, context *compiler.Context) (*ApiKeySecurity, error) {
+ errors := make([]error, 0)
+ x := &ApiKeySecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"in", "name", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "in", "name", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [apiKey]
+ if ok && !compiler.StringArrayContainsValue([]string{"apiKey"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 2;
+ v2 := compiler.MapValueForKey(m, "name")
+ if v2 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 3;
+ v3 := compiler.MapValueForKey(m, "in")
+ if v3 != nil {
+ x.In, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [header query]
+ if ok && !compiler.StringArrayContainsValue([]string{"header", "query"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 4;
+ v4 := compiler.MapValueForKey(m, "description")
+ if v4 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 5;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewBasicAuthenticationSecurity creates an object of type BasicAuthenticationSecurity if possible, returning an error if not.
+func NewBasicAuthenticationSecurity(in *yaml.Node, context *compiler.Context) (*BasicAuthenticationSecurity, error) {
+ errors := make([]error, 0)
+ x := &BasicAuthenticationSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [basic]
+ if ok && !compiler.StringArrayContainsValue([]string{"basic"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 3;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewBodyParameter creates an object of type BodyParameter if possible, returning an error if not.
+func NewBodyParameter(in *yaml.Node, context *compiler.Context) (*BodyParameter, error) {
+ errors := make([]error, 0)
+ x := &BodyParameter{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"in", "name", "schema"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "in", "name", "required", "schema"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 2;
+ v2 := compiler.MapValueForKey(m, "name")
+ if v2 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 3;
+ v3 := compiler.MapValueForKey(m, "in")
+ if v3 != nil {
+ x.In, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [body]
+ if ok && !compiler.StringArrayContainsValue([]string{"body"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool required = 4;
+ v4 := compiler.MapValueForKey(m, "required")
+ if v4 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Schema schema = 5;
+ v5 := compiler.MapValueForKey(m, "schema")
+ if v5 != nil {
+ var err error
+ x.Schema, err = NewSchema(v5, compiler.NewContext("schema", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewContact creates an object of type Contact if possible, returning an error if not.
+func NewContact(in *yaml.Node, context *compiler.Context) (*Contact, error) {
+ errors := make([]error, 0)
+ x := &Contact{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"email", "name", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string email = 3;
+ v3 := compiler.MapValueForKey(m, "email")
+ if v3 != nil {
+ x.Email, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for email: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 4;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDefault creates an object of type Default if possible, returning an error if not.
+func NewDefault(in *yaml.Node, context *compiler.Context) (*Default, error) {
+ errors := make([]error, 0)
+ x := &Default{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedAny additional_properties = 1;
+ // MAP: Any
+ x.AdditionalProperties = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDefinitions creates an object of type Definitions if possible, returning an error if not.
+func NewDefinitions(in *yaml.Node, context *compiler.Context) (*Definitions, error) {
+ errors := make([]error, 0)
+ x := &Definitions{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSchema additional_properties = 1;
+ // MAP: Schema
+ x.AdditionalProperties = make([]*NamedSchema, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSchema{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewDocument creates an object of type Document if possible, returning an error if not.
+func NewDocument(in *yaml.Node, context *compiler.Context) (*Document, error) {
+ errors := make([]error, 0)
+ x := &Document{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"info", "paths", "swagger"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"basePath", "consumes", "definitions", "externalDocs", "host", "info", "parameters", "paths", "produces", "responses", "schemes", "security", "securityDefinitions", "swagger", "tags"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string swagger = 1;
+ v1 := compiler.MapValueForKey(m, "swagger")
+ if v1 != nil {
+ x.Swagger, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [2.0]
+ if ok && !compiler.StringArrayContainsValue([]string{"2.0"}, x.Swagger) {
+ message := fmt.Sprintf("has unexpected value for swagger: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Info info = 2;
+ v2 := compiler.MapValueForKey(m, "info")
+ if v2 != nil {
+ var err error
+ x.Info, err = NewInfo(v2, compiler.NewContext("info", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string host = 3;
+ v3 := compiler.MapValueForKey(m, "host")
+ if v3 != nil {
+ x.Host, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for host: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string base_path = 4;
+ v4 := compiler.MapValueForKey(m, "basePath")
+ if v4 != nil {
+ x.BasePath, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for basePath: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string schemes = 5;
+ v5 := compiler.MapValueForKey(m, "schemes")
+ if v5 != nil {
+ v, ok := compiler.SequenceNodeForNode(v5)
+ if ok {
+ x.Schemes = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [http https ws wss]
+ if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) {
+ message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string consumes = 6;
+ v6 := compiler.MapValueForKey(m, "consumes")
+ if v6 != nil {
+ v, ok := compiler.SequenceNodeForNode(v6)
+ if ok {
+ x.Consumes = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string produces = 7;
+ v7 := compiler.MapValueForKey(m, "produces")
+ if v7 != nil {
+ v, ok := compiler.SequenceNodeForNode(v7)
+ if ok {
+ x.Produces = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Paths paths = 8;
+ v8 := compiler.MapValueForKey(m, "paths")
+ if v8 != nil {
+ var err error
+ x.Paths, err = NewPaths(v8, compiler.NewContext("paths", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Definitions definitions = 9;
+ v9 := compiler.MapValueForKey(m, "definitions")
+ if v9 != nil {
+ var err error
+ x.Definitions, err = NewDefinitions(v9, compiler.NewContext("definitions", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ParameterDefinitions parameters = 10;
+ v10 := compiler.MapValueForKey(m, "parameters")
+ if v10 != nil {
+ var err error
+ x.Parameters, err = NewParameterDefinitions(v10, compiler.NewContext("parameters", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ResponseDefinitions responses = 11;
+ v11 := compiler.MapValueForKey(m, "responses")
+ if v11 != nil {
+ var err error
+ x.Responses, err = NewResponseDefinitions(v11, compiler.NewContext("responses", v11, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated SecurityRequirement security = 12;
+ v12 := compiler.MapValueForKey(m, "security")
+ if v12 != nil {
+ // repeated SecurityRequirement
+ x.Security = make([]*SecurityRequirement, 0)
+ a, ok := compiler.SequenceNodeForNode(v12)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Security = append(x.Security, y)
+ }
+ }
+ }
+ // SecurityDefinitions security_definitions = 13;
+ v13 := compiler.MapValueForKey(m, "securityDefinitions")
+ if v13 != nil {
+ var err error
+ x.SecurityDefinitions, err = NewSecurityDefinitions(v13, compiler.NewContext("securityDefinitions", v13, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated Tag tags = 14;
+ v14 := compiler.MapValueForKey(m, "tags")
+ if v14 != nil {
+ // repeated Tag
+ x.Tags = make([]*Tag, 0)
+ a, ok := compiler.SequenceNodeForNode(v14)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewTag(item, compiler.NewContext("tags", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Tags = append(x.Tags, y)
+ }
+ }
+ }
+ // ExternalDocs external_docs = 15;
+ v15 := compiler.MapValueForKey(m, "externalDocs")
+ if v15 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v15, compiler.NewContext("externalDocs", v15, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 16;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExamples creates an object of type Examples if possible, returning an error if not.
+func NewExamples(in *yaml.Node, context *compiler.Context) (*Examples, error) {
+ errors := make([]error, 0)
+ x := &Examples{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedAny additional_properties = 1;
+ // MAP: Any
+ x.AdditionalProperties = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewExternalDocs creates an object of type ExternalDocs if possible, returning an error if not.
+func NewExternalDocs(in *yaml.Node, context *compiler.Context) (*ExternalDocs, error) {
+ errors := make([]error, 0)
+ x := &ExternalDocs{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"url"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 3;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewFileSchema creates an object of type FileSchema if possible, returning an error if not.
+func NewFileSchema(in *yaml.Node, context *compiler.Context) (*FileSchema, error) {
+ errors := make([]error, 0)
+ x := &FileSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"default", "description", "example", "externalDocs", "format", "readOnly", "required", "title", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string format = 1;
+ v1 := compiler.MapValueForKey(m, "format")
+ if v1 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string title = 2;
+ v2 := compiler.MapValueForKey(m, "title")
+ if v2 != nil {
+ x.Title, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 4;
+ v4 := compiler.MapValueForKey(m, "default")
+ if v4 != nil {
+ var err error
+ x.Default, err = NewAny(v4, compiler.NewContext("default", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated string required = 5;
+ v5 := compiler.MapValueForKey(m, "required")
+ if v5 != nil {
+ v, ok := compiler.SequenceNodeForNode(v5)
+ if ok {
+ x.Required = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 6;
+ v6 := compiler.MapValueForKey(m, "type")
+ if v6 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [file]
+ if ok && !compiler.StringArrayContainsValue([]string{"file"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool read_only = 7;
+ v7 := compiler.MapValueForKey(m, "readOnly")
+ if v7 != nil {
+ x.ReadOnly, ok = compiler.BoolForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExternalDocs external_docs = 8;
+ v8 := compiler.MapValueForKey(m, "externalDocs")
+ if v8 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v8, compiler.NewContext("externalDocs", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Any example = 9;
+ v9 := compiler.MapValueForKey(m, "example")
+ if v9 != nil {
+ var err error
+ x.Example, err = NewAny(v9, compiler.NewContext("example", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 10;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewFormDataParameterSubSchema creates an object of type FormDataParameterSubSchema if possible, returning an error if not.
+func NewFormDataParameterSubSchema(in *yaml.Node, context *compiler.Context) (*FormDataParameterSubSchema, error) {
+ errors := make([]error, 0)
+ x := &FormDataParameterSubSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool required = 1;
+ v1 := compiler.MapValueForKey(m, "required")
+ if v1 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [formData]
+ if ok && !compiler.StringArrayContainsValue([]string{"formData"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 4;
+ v4 := compiler.MapValueForKey(m, "name")
+ if v4 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_empty_value = 5;
+ v5 := compiler.MapValueForKey(m, "allowEmptyValue")
+ if v5 != nil {
+ x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 6;
+ v6 := compiler.MapValueForKey(m, "type")
+ if v6 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number boolean integer array file]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array", "file"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 7;
+ v7 := compiler.MapValueForKey(m, "format")
+ if v7 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 8;
+ v8 := compiler.MapValueForKey(m, "items")
+ if v8 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 9;
+ v9 := compiler.MapValueForKey(m, "collectionFormat")
+ if v9 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes multi]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 10;
+ v10 := compiler.MapValueForKey(m, "default")
+ if v10 != nil {
+ var err error
+ x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 11;
+ v11 := compiler.MapValueForKey(m, "maximum")
+ if v11 != nil {
+ v, ok := compiler.FloatForScalarNode(v11)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 12;
+ v12 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v12 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 13;
+ v13 := compiler.MapValueForKey(m, "minimum")
+ if v13 != nil {
+ v, ok := compiler.FloatForScalarNode(v13)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 14;
+ v14 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v14 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 15;
+ v15 := compiler.MapValueForKey(m, "maxLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 16;
+ v16 := compiler.MapValueForKey(m, "minLength")
+ if v16 != nil {
+ t, ok := compiler.IntForScalarNode(v16)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 17;
+ v17 := compiler.MapValueForKey(m, "pattern")
+ if v17 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v17)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 18;
+ v18 := compiler.MapValueForKey(m, "maxItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 19;
+ v19 := compiler.MapValueForKey(m, "minItems")
+ if v19 != nil {
+ t, ok := compiler.IntForScalarNode(v19)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 20;
+ v20 := compiler.MapValueForKey(m, "uniqueItems")
+ if v20 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v20)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 21;
+ v21 := compiler.MapValueForKey(m, "enum")
+ if v21 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v21)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 22;
+ v22 := compiler.MapValueForKey(m, "multipleOf")
+ if v22 != nil {
+ v, ok := compiler.FloatForScalarNode(v22)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 23;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeader creates an object of type Header if possible, returning an error if not.
+func NewHeader(in *yaml.Node, context *compiler.Context) (*Header, error) {
+ errors := make([]error, 0)
+ x := &Header{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number integer boolean array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 2;
+ v2 := compiler.MapValueForKey(m, "format")
+ if v2 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 3;
+ v3 := compiler.MapValueForKey(m, "items")
+ if v3 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 4;
+ v4 := compiler.MapValueForKey(m, "collectionFormat")
+ if v4 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 5;
+ v5 := compiler.MapValueForKey(m, "default")
+ if v5 != nil {
+ var err error
+ x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 6;
+ v6 := compiler.MapValueForKey(m, "maximum")
+ if v6 != nil {
+ v, ok := compiler.FloatForScalarNode(v6)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 7;
+ v7 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v7 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 8;
+ v8 := compiler.MapValueForKey(m, "minimum")
+ if v8 != nil {
+ v, ok := compiler.FloatForScalarNode(v8)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 9;
+ v9 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v9 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 10;
+ v10 := compiler.MapValueForKey(m, "maxLength")
+ if v10 != nil {
+ t, ok := compiler.IntForScalarNode(v10)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 11;
+ v11 := compiler.MapValueForKey(m, "minLength")
+ if v11 != nil {
+ t, ok := compiler.IntForScalarNode(v11)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 12;
+ v12 := compiler.MapValueForKey(m, "pattern")
+ if v12 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 13;
+ v13 := compiler.MapValueForKey(m, "maxItems")
+ if v13 != nil {
+ t, ok := compiler.IntForScalarNode(v13)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 14;
+ v14 := compiler.MapValueForKey(m, "minItems")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 15;
+ v15 := compiler.MapValueForKey(m, "uniqueItems")
+ if v15 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v15)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 16;
+ v16 := compiler.MapValueForKey(m, "enum")
+ if v16 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v16)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 17;
+ v17 := compiler.MapValueForKey(m, "multipleOf")
+ if v17 != nil {
+ v, ok := compiler.FloatForScalarNode(v17)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 18;
+ v18 := compiler.MapValueForKey(m, "description")
+ if v18 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v18)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 19;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeaderParameterSubSchema creates an object of type HeaderParameterSubSchema if possible, returning an error if not.
+func NewHeaderParameterSubSchema(in *yaml.Node, context *compiler.Context) (*HeaderParameterSubSchema, error) {
+ errors := make([]error, 0)
+ x := &HeaderParameterSubSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool required = 1;
+ v1 := compiler.MapValueForKey(m, "required")
+ if v1 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [header]
+ if ok && !compiler.StringArrayContainsValue([]string{"header"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 4;
+ v4 := compiler.MapValueForKey(m, "name")
+ if v4 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 5;
+ v5 := compiler.MapValueForKey(m, "type")
+ if v5 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number boolean integer array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 6;
+ v6 := compiler.MapValueForKey(m, "format")
+ if v6 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 7;
+ v7 := compiler.MapValueForKey(m, "items")
+ if v7 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 8;
+ v8 := compiler.MapValueForKey(m, "collectionFormat")
+ if v8 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 9;
+ v9 := compiler.MapValueForKey(m, "default")
+ if v9 != nil {
+ var err error
+ x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 10;
+ v10 := compiler.MapValueForKey(m, "maximum")
+ if v10 != nil {
+ v, ok := compiler.FloatForScalarNode(v10)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 11;
+ v11 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v11 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 12;
+ v12 := compiler.MapValueForKey(m, "minimum")
+ if v12 != nil {
+ v, ok := compiler.FloatForScalarNode(v12)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 13;
+ v13 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v13 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 14;
+ v14 := compiler.MapValueForKey(m, "maxLength")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 15;
+ v15 := compiler.MapValueForKey(m, "minLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 16;
+ v16 := compiler.MapValueForKey(m, "pattern")
+ if v16 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v16)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 17;
+ v17 := compiler.MapValueForKey(m, "maxItems")
+ if v17 != nil {
+ t, ok := compiler.IntForScalarNode(v17)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 18;
+ v18 := compiler.MapValueForKey(m, "minItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 19;
+ v19 := compiler.MapValueForKey(m, "uniqueItems")
+ if v19 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v19)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 20;
+ v20 := compiler.MapValueForKey(m, "enum")
+ if v20 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v20)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 21;
+ v21 := compiler.MapValueForKey(m, "multipleOf")
+ if v21 != nil {
+ v, ok := compiler.FloatForScalarNode(v21)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 22;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewHeaders creates an object of type Headers if possible, returning an error if not.
+func NewHeaders(in *yaml.Node, context *compiler.Context) (*Headers, error) {
+ errors := make([]error, 0)
+ x := &Headers{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedHeader additional_properties = 1;
+ // MAP: Header
+ x.AdditionalProperties = make([]*NamedHeader, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedHeader{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewHeader(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewInfo creates an object of type Info if possible, returning an error if not.
+func NewInfo(in *yaml.Node, context *compiler.Context) (*Info, error) {
+ errors := make([]error, 0)
+ x := &Info{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"title", "version"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"contact", "description", "license", "termsOfService", "title", "version"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string title = 1;
+ v1 := compiler.MapValueForKey(m, "title")
+ if v1 != nil {
+ x.Title, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string version = 2;
+ v2 := compiler.MapValueForKey(m, "version")
+ if v2 != nil {
+ x.Version, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for version: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string terms_of_service = 4;
+ v4 := compiler.MapValueForKey(m, "termsOfService")
+ if v4 != nil {
+ x.TermsOfService, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for termsOfService: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Contact contact = 5;
+ v5 := compiler.MapValueForKey(m, "contact")
+ if v5 != nil {
+ var err error
+ x.Contact, err = NewContact(v5, compiler.NewContext("contact", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // License license = 6;
+ v6 := compiler.MapValueForKey(m, "license")
+ if v6 != nil {
+ var err error
+ x.License, err = NewLicense(v6, compiler.NewContext("license", v6, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 7;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not.
+func NewItemsItem(in *yaml.Node, context *compiler.Context) (*ItemsItem, error) {
+ errors := make([]error, 0)
+ x := &ItemsItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ x.Schema = make([]*Schema, 0)
+ y, err := NewSchema(m, compiler.NewContext("", m, context))
+ if err != nil {
+ return nil, err
+ }
+ x.Schema = append(x.Schema, y)
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewJsonReference creates an object of type JsonReference if possible, returning an error if not.
+func NewJsonReference(in *yaml.Node, context *compiler.Context) (*JsonReference, error) {
+ errors := make([]error, 0)
+ x := &JsonReference{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"$ref"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string _ref = 1;
+ v1 := compiler.MapValueForKey(m, "$ref")
+ if v1 != nil {
+ x.XRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewLicense creates an object of type License if possible, returning an error if not.
+func NewLicense(in *yaml.Node, context *compiler.Context) (*License, error) {
+ errors := make([]error, 0)
+ x := &License{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"name"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"name", "url"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string url = 2;
+ v2 := compiler.MapValueForKey(m, "url")
+ if v2 != nil {
+ x.Url, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for url: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 3;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedAny creates an object of type NamedAny if possible, returning an error if not.
+func NewNamedAny(in *yaml.Node, context *compiler.Context) (*NamedAny, error) {
+ errors := make([]error, 0)
+ x := &NamedAny{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewAny(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedHeader creates an object of type NamedHeader if possible, returning an error if not.
+func NewNamedHeader(in *yaml.Node, context *compiler.Context) (*NamedHeader, error) {
+ errors := make([]error, 0)
+ x := &NamedHeader{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Header value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewHeader(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedParameter creates an object of type NamedParameter if possible, returning an error if not.
+func NewNamedParameter(in *yaml.Node, context *compiler.Context) (*NamedParameter, error) {
+ errors := make([]error, 0)
+ x := &NamedParameter{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Parameter value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewParameter(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not.
+func NewNamedPathItem(in *yaml.Node, context *compiler.Context) (*NamedPathItem, error) {
+ errors := make([]error, 0)
+ x := &NamedPathItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PathItem value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewPathItem(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedResponse creates an object of type NamedResponse if possible, returning an error if not.
+func NewNamedResponse(in *yaml.Node, context *compiler.Context) (*NamedResponse, error) {
+ errors := make([]error, 0)
+ x := &NamedResponse{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Response value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewResponse(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedResponseValue creates an object of type NamedResponseValue if possible, returning an error if not.
+func NewNamedResponseValue(in *yaml.Node, context *compiler.Context) (*NamedResponseValue, error) {
+ errors := make([]error, 0)
+ x := &NamedResponseValue{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ResponseValue value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewResponseValue(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedSchema creates an object of type NamedSchema if possible, returning an error if not.
+func NewNamedSchema(in *yaml.Node, context *compiler.Context) (*NamedSchema, error) {
+ errors := make([]error, 0)
+ x := &NamedSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Schema value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewSchema(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedSecurityDefinitionsItem creates an object of type NamedSecurityDefinitionsItem if possible, returning an error if not.
+func NewNamedSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*NamedSecurityDefinitionsItem, error) {
+ errors := make([]error, 0)
+ x := &NamedSecurityDefinitionsItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // SecurityDefinitionsItem value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewSecurityDefinitionsItem(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedString creates an object of type NamedString if possible, returning an error if not.
+func NewNamedString(in *yaml.Node, context *compiler.Context) (*NamedString, error) {
+ errors := make([]error, 0)
+ x := &NamedString{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ x.Value, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for value: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not.
+func NewNamedStringArray(in *yaml.Node, context *compiler.Context) (*NamedStringArray, error) {
+ errors := make([]error, 0)
+ x := &NamedStringArray{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"name", "value"}
+ var allowedPatterns []*regexp.Regexp
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // StringArray value = 2;
+ v2 := compiler.MapValueForKey(m, "value")
+ if v2 != nil {
+ var err error
+ x.Value, err = NewStringArray(v2, compiler.NewContext("value", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewNonBodyParameter creates an object of type NonBodyParameter if possible, returning an error if not.
+func NewNonBodyParameter(in *yaml.Node, context *compiler.Context) (*NonBodyParameter, error) {
+ errors := make([]error, 0)
+ x := &NonBodyParameter{}
+ matched := false
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"in", "name", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // HeaderParameterSubSchema header_parameter_sub_schema = 1;
+ {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewHeaderParameterSubSchema(m, compiler.NewContext("headerParameterSubSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &NonBodyParameter_HeaderParameterSubSchema{HeaderParameterSubSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ // FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
+ {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewFormDataParameterSubSchema(m, compiler.NewContext("formDataParameterSubSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &NonBodyParameter_FormDataParameterSubSchema{FormDataParameterSubSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ // QueryParameterSubSchema query_parameter_sub_schema = 3;
+ {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewQueryParameterSubSchema(m, compiler.NewContext("queryParameterSubSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &NonBodyParameter_QueryParameterSubSchema{QueryParameterSubSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ // PathParameterSubSchema path_parameter_sub_schema = 4;
+ {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewPathParameterSubSchema(m, compiler.NewContext("pathParameterSubSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &NonBodyParameter_PathParameterSubSchema{PathParameterSubSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid NonBodyParameter")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2AccessCodeSecurity creates an object of type Oauth2AccessCodeSecurity if possible, returning an error if not.
+func NewOauth2AccessCodeSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2AccessCodeSecurity, error) {
+ errors := make([]error, 0)
+ x := &Oauth2AccessCodeSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"authorizationUrl", "flow", "tokenUrl", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "tokenUrl", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [oauth2]
+ if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string flow = 2;
+ v2 := compiler.MapValueForKey(m, "flow")
+ if v2 != nil {
+ x.Flow, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [accessCode]
+ if ok && !compiler.StringArrayContainsValue([]string{"accessCode"}, x.Flow) {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Oauth2Scopes scopes = 3;
+ v3 := compiler.MapValueForKey(m, "scopes")
+ if v3 != nil {
+ var err error
+ x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string authorization_url = 4;
+ v4 := compiler.MapValueForKey(m, "authorizationUrl")
+ if v4 != nil {
+ x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string token_url = 5;
+ v5 := compiler.MapValueForKey(m, "tokenUrl")
+ if v5 != nil {
+ x.TokenUrl, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 6;
+ v6 := compiler.MapValueForKey(m, "description")
+ if v6 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 7;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2ApplicationSecurity creates an object of type Oauth2ApplicationSecurity if possible, returning an error if not.
+func NewOauth2ApplicationSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ApplicationSecurity, error) {
+ errors := make([]error, 0)
+ x := &Oauth2ApplicationSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"flow", "tokenUrl", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [oauth2]
+ if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string flow = 2;
+ v2 := compiler.MapValueForKey(m, "flow")
+ if v2 != nil {
+ x.Flow, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [application]
+ if ok && !compiler.StringArrayContainsValue([]string{"application"}, x.Flow) {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Oauth2Scopes scopes = 3;
+ v3 := compiler.MapValueForKey(m, "scopes")
+ if v3 != nil {
+ var err error
+ x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string token_url = 4;
+ v4 := compiler.MapValueForKey(m, "tokenUrl")
+ if v4 != nil {
+ x.TokenUrl, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 5;
+ v5 := compiler.MapValueForKey(m, "description")
+ if v5 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2ImplicitSecurity creates an object of type Oauth2ImplicitSecurity if possible, returning an error if not.
+func NewOauth2ImplicitSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2ImplicitSecurity, error) {
+ errors := make([]error, 0)
+ x := &Oauth2ImplicitSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"authorizationUrl", "flow", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [oauth2]
+ if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string flow = 2;
+ v2 := compiler.MapValueForKey(m, "flow")
+ if v2 != nil {
+ x.Flow, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [implicit]
+ if ok && !compiler.StringArrayContainsValue([]string{"implicit"}, x.Flow) {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Oauth2Scopes scopes = 3;
+ v3 := compiler.MapValueForKey(m, "scopes")
+ if v3 != nil {
+ var err error
+ x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string authorization_url = 4;
+ v4 := compiler.MapValueForKey(m, "authorizationUrl")
+ if v4 != nil {
+ x.AuthorizationUrl, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for authorizationUrl: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 5;
+ v5 := compiler.MapValueForKey(m, "description")
+ if v5 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2PasswordSecurity creates an object of type Oauth2PasswordSecurity if possible, returning an error if not.
+func NewOauth2PasswordSecurity(in *yaml.Node, context *compiler.Context) (*Oauth2PasswordSecurity, error) {
+ errors := make([]error, 0)
+ x := &Oauth2PasswordSecurity{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"flow", "tokenUrl", "type"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [oauth2]
+ if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string flow = 2;
+ v2 := compiler.MapValueForKey(m, "flow")
+ if v2 != nil {
+ x.Flow, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [password]
+ if ok && !compiler.StringArrayContainsValue([]string{"password"}, x.Flow) {
+ message := fmt.Sprintf("has unexpected value for flow: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Oauth2Scopes scopes = 3;
+ v3 := compiler.MapValueForKey(m, "scopes")
+ if v3 != nil {
+ var err error
+ x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string token_url = 4;
+ v4 := compiler.MapValueForKey(m, "tokenUrl")
+ if v4 != nil {
+ x.TokenUrl, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for tokenUrl: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 5;
+ v5 := compiler.MapValueForKey(m, "description")
+ if v5 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOauth2Scopes creates an object of type Oauth2Scopes if possible, returning an error if not.
+func NewOauth2Scopes(in *yaml.Node, context *compiler.Context) (*Oauth2Scopes, error) {
+ errors := make([]error, 0)
+ x := &Oauth2Scopes{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedString additional_properties = 1;
+ // MAP: string
+ x.AdditionalProperties = make([]*NamedString, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedString{}
+ pair.Name = k
+ pair.Value, _ = compiler.StringForScalarNode(v)
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewOperation creates an object of type Operation if possible, returning an error if not.
+func NewOperation(in *yaml.Node, context *compiler.Context) (*Operation, error) {
+ errors := make([]error, 0)
+ x := &Operation{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"responses"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"consumes", "deprecated", "description", "externalDocs", "operationId", "parameters", "produces", "responses", "schemes", "security", "summary", "tags"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated string tags = 1;
+ v1 := compiler.MapValueForKey(m, "tags")
+ if v1 != nil {
+ v, ok := compiler.SequenceNodeForNode(v1)
+ if ok {
+ x.Tags = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for tags: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string summary = 2;
+ v2 := compiler.MapValueForKey(m, "summary")
+ if v2 != nil {
+ x.Summary, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for summary: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExternalDocs external_docs = 4;
+ v4 := compiler.MapValueForKey(m, "externalDocs")
+ if v4 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string operation_id = 5;
+ v5 := compiler.MapValueForKey(m, "operationId")
+ if v5 != nil {
+ x.OperationId, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for operationId: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string produces = 6;
+ v6 := compiler.MapValueForKey(m, "produces")
+ if v6 != nil {
+ v, ok := compiler.SequenceNodeForNode(v6)
+ if ok {
+ x.Produces = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for produces: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string consumes = 7;
+ v7 := compiler.MapValueForKey(m, "consumes")
+ if v7 != nil {
+ v, ok := compiler.SequenceNodeForNode(v7)
+ if ok {
+ x.Consumes = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for consumes: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated ParametersItem parameters = 8;
+ v8 := compiler.MapValueForKey(m, "parameters")
+ if v8 != nil {
+ // repeated ParametersItem
+ x.Parameters = make([]*ParametersItem, 0)
+ a, ok := compiler.SequenceNodeForNode(v8)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Parameters = append(x.Parameters, y)
+ }
+ }
+ }
+ // Responses responses = 9;
+ v9 := compiler.MapValueForKey(m, "responses")
+ if v9 != nil {
+ var err error
+ x.Responses, err = NewResponses(v9, compiler.NewContext("responses", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated string schemes = 10;
+ v10 := compiler.MapValueForKey(m, "schemes")
+ if v10 != nil {
+ v, ok := compiler.SequenceNodeForNode(v10)
+ if ok {
+ x.Schemes = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [http https ws wss]
+ if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) {
+ message := fmt.Sprintf("has unexpected value for schemes: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool deprecated = 11;
+ v11 := compiler.MapValueForKey(m, "deprecated")
+ if v11 != nil {
+ x.Deprecated, ok = compiler.BoolForScalarNode(v11)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for deprecated: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated SecurityRequirement security = 12;
+ v12 := compiler.MapValueForKey(m, "security")
+ if v12 != nil {
+ // repeated SecurityRequirement
+ x.Security = make([]*SecurityRequirement, 0)
+ a, ok := compiler.SequenceNodeForNode(v12)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSecurityRequirement(item, compiler.NewContext("security", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Security = append(x.Security, y)
+ }
+ }
+ }
+ // repeated NamedAny vendor_extension = 13;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParameter creates an object of type Parameter if possible, returning an error if not.
+func NewParameter(in *yaml.Node, context *compiler.Context) (*Parameter, error) {
+ errors := make([]error, 0)
+ x := &Parameter{}
+ matched := false
+ // BodyParameter body_parameter = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewBodyParameter(m, compiler.NewContext("bodyParameter", m, context))
+ if matchingError == nil {
+ x.Oneof = &Parameter_BodyParameter{BodyParameter: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // NonBodyParameter non_body_parameter = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewNonBodyParameter(m, compiler.NewContext("nonBodyParameter", m, context))
+ if matchingError == nil {
+ x.Oneof = &Parameter_NonBodyParameter{NonBodyParameter: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid Parameter")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParameterDefinitions creates an object of type ParameterDefinitions if possible, returning an error if not.
+func NewParameterDefinitions(in *yaml.Node, context *compiler.Context) (*ParameterDefinitions, error) {
+ errors := make([]error, 0)
+ x := &ParameterDefinitions{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedParameter additional_properties = 1;
+ // MAP: Parameter
+ x.AdditionalProperties = make([]*NamedParameter, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedParameter{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewParameter(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewParametersItem creates an object of type ParametersItem if possible, returning an error if not.
+func NewParametersItem(in *yaml.Node, context *compiler.Context) (*ParametersItem, error) {
+ errors := make([]error, 0)
+ x := &ParametersItem{}
+ matched := false
+ // Parameter parameter = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewParameter(m, compiler.NewContext("parameter", m, context))
+ if matchingError == nil {
+ x.Oneof = &ParametersItem_Parameter{Parameter: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // JsonReference json_reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context))
+ if matchingError == nil {
+ x.Oneof = &ParametersItem_JsonReference{JsonReference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid ParametersItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPathItem creates an object of type PathItem if possible, returning an error if not.
+func NewPathItem(in *yaml.Node, context *compiler.Context) (*PathItem, error) {
+ errors := make([]error, 0)
+ x := &PathItem{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"$ref", "delete", "get", "head", "options", "parameters", "patch", "post", "put"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string _ref = 1;
+ v1 := compiler.MapValueForKey(m, "$ref")
+ if v1 != nil {
+ x.XRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Operation get = 2;
+ v2 := compiler.MapValueForKey(m, "get")
+ if v2 != nil {
+ var err error
+ x.Get, err = NewOperation(v2, compiler.NewContext("get", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation put = 3;
+ v3 := compiler.MapValueForKey(m, "put")
+ if v3 != nil {
+ var err error
+ x.Put, err = NewOperation(v3, compiler.NewContext("put", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation post = 4;
+ v4 := compiler.MapValueForKey(m, "post")
+ if v4 != nil {
+ var err error
+ x.Post, err = NewOperation(v4, compiler.NewContext("post", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation delete = 5;
+ v5 := compiler.MapValueForKey(m, "delete")
+ if v5 != nil {
+ var err error
+ x.Delete, err = NewOperation(v5, compiler.NewContext("delete", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation options = 6;
+ v6 := compiler.MapValueForKey(m, "options")
+ if v6 != nil {
+ var err error
+ x.Options, err = NewOperation(v6, compiler.NewContext("options", v6, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation head = 7;
+ v7 := compiler.MapValueForKey(m, "head")
+ if v7 != nil {
+ var err error
+ x.Head, err = NewOperation(v7, compiler.NewContext("head", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Operation patch = 8;
+ v8 := compiler.MapValueForKey(m, "patch")
+ if v8 != nil {
+ var err error
+ x.Patch, err = NewOperation(v8, compiler.NewContext("patch", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated ParametersItem parameters = 9;
+ v9 := compiler.MapValueForKey(m, "parameters")
+ if v9 != nil {
+ // repeated ParametersItem
+ x.Parameters = make([]*ParametersItem, 0)
+ a, ok := compiler.SequenceNodeForNode(v9)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewParametersItem(item, compiler.NewContext("parameters", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Parameters = append(x.Parameters, y)
+ }
+ }
+ }
+ // repeated NamedAny vendor_extension = 10;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPathParameterSubSchema creates an object of type PathParameterSubSchema if possible, returning an error if not.
+func NewPathParameterSubSchema(in *yaml.Node, context *compiler.Context) (*PathParameterSubSchema, error) {
+ errors := make([]error, 0)
+ x := &PathParameterSubSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"required"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool required = 1;
+ v1 := compiler.MapValueForKey(m, "required")
+ if v1 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [path]
+ if ok && !compiler.StringArrayContainsValue([]string{"path"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 4;
+ v4 := compiler.MapValueForKey(m, "name")
+ if v4 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 5;
+ v5 := compiler.MapValueForKey(m, "type")
+ if v5 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number boolean integer array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 6;
+ v6 := compiler.MapValueForKey(m, "format")
+ if v6 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 7;
+ v7 := compiler.MapValueForKey(m, "items")
+ if v7 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", v7, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 8;
+ v8 := compiler.MapValueForKey(m, "collectionFormat")
+ if v8 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 9;
+ v9 := compiler.MapValueForKey(m, "default")
+ if v9 != nil {
+ var err error
+ x.Default, err = NewAny(v9, compiler.NewContext("default", v9, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 10;
+ v10 := compiler.MapValueForKey(m, "maximum")
+ if v10 != nil {
+ v, ok := compiler.FloatForScalarNode(v10)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 11;
+ v11 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v11 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v11)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 12;
+ v12 := compiler.MapValueForKey(m, "minimum")
+ if v12 != nil {
+ v, ok := compiler.FloatForScalarNode(v12)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 13;
+ v13 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v13 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v13)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 14;
+ v14 := compiler.MapValueForKey(m, "maxLength")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 15;
+ v15 := compiler.MapValueForKey(m, "minLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 16;
+ v16 := compiler.MapValueForKey(m, "pattern")
+ if v16 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v16)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 17;
+ v17 := compiler.MapValueForKey(m, "maxItems")
+ if v17 != nil {
+ t, ok := compiler.IntForScalarNode(v17)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 18;
+ v18 := compiler.MapValueForKey(m, "minItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 19;
+ v19 := compiler.MapValueForKey(m, "uniqueItems")
+ if v19 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v19)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 20;
+ v20 := compiler.MapValueForKey(m, "enum")
+ if v20 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v20)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 21;
+ v21 := compiler.MapValueForKey(m, "multipleOf")
+ if v21 != nil {
+ v, ok := compiler.FloatForScalarNode(v21)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v21))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 22;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPaths creates an object of type Paths if possible, returning an error if not.
+func NewPaths(in *yaml.Node, context *compiler.Context) (*Paths, error) {
+ errors := make([]error, 0)
+ x := &Paths{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{}
+ allowedPatterns := []*regexp.Regexp{pattern0, pattern1}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated NamedAny vendor_extension = 1;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ // repeated NamedPathItem path = 2;
+ // MAP: PathItem ^/
+ x.Path = make([]*NamedPathItem, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "/") {
+ pair := &NamedPathItem{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewPathItem(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Path = append(x.Path, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewPrimitivesItems creates an object of type PrimitivesItems if possible, returning an error if not.
+func NewPrimitivesItems(in *yaml.Node, context *compiler.Context) (*PrimitivesItems, error) {
+ errors := make([]error, 0)
+ x := &PrimitivesItems{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"collectionFormat", "default", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string type = 1;
+ v1 := compiler.MapValueForKey(m, "type")
+ if v1 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number integer boolean array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 2;
+ v2 := compiler.MapValueForKey(m, "format")
+ if v2 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 3;
+ v3 := compiler.MapValueForKey(m, "items")
+ if v3 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 4;
+ v4 := compiler.MapValueForKey(m, "collectionFormat")
+ if v4 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 5;
+ v5 := compiler.MapValueForKey(m, "default")
+ if v5 != nil {
+ var err error
+ x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 6;
+ v6 := compiler.MapValueForKey(m, "maximum")
+ if v6 != nil {
+ v, ok := compiler.FloatForScalarNode(v6)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 7;
+ v7 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v7 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 8;
+ v8 := compiler.MapValueForKey(m, "minimum")
+ if v8 != nil {
+ v, ok := compiler.FloatForScalarNode(v8)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 9;
+ v9 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v9 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 10;
+ v10 := compiler.MapValueForKey(m, "maxLength")
+ if v10 != nil {
+ t, ok := compiler.IntForScalarNode(v10)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 11;
+ v11 := compiler.MapValueForKey(m, "minLength")
+ if v11 != nil {
+ t, ok := compiler.IntForScalarNode(v11)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 12;
+ v12 := compiler.MapValueForKey(m, "pattern")
+ if v12 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 13;
+ v13 := compiler.MapValueForKey(m, "maxItems")
+ if v13 != nil {
+ t, ok := compiler.IntForScalarNode(v13)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 14;
+ v14 := compiler.MapValueForKey(m, "minItems")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 15;
+ v15 := compiler.MapValueForKey(m, "uniqueItems")
+ if v15 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v15)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 16;
+ v16 := compiler.MapValueForKey(m, "enum")
+ if v16 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v16)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 17;
+ v17 := compiler.MapValueForKey(m, "multipleOf")
+ if v17 != nil {
+ v, ok := compiler.FloatForScalarNode(v17)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 18;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewProperties creates an object of type Properties if possible, returning an error if not.
+func NewProperties(in *yaml.Node, context *compiler.Context) (*Properties, error) {
+ errors := make([]error, 0)
+ x := &Properties{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSchema additional_properties = 1;
+ // MAP: Schema
+ x.AdditionalProperties = make([]*NamedSchema, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSchema{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSchema(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewQueryParameterSubSchema creates an object of type QueryParameterSubSchema if possible, returning an error if not.
+func NewQueryParameterSubSchema(in *yaml.Node, context *compiler.Context) (*QueryParameterSubSchema, error) {
+ errors := make([]error, 0)
+ x := &QueryParameterSubSchema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // bool required = 1;
+ v1 := compiler.MapValueForKey(m, "required")
+ if v1 != nil {
+ x.Required, ok = compiler.BoolForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string in = 2;
+ v2 := compiler.MapValueForKey(m, "in")
+ if v2 != nil {
+ x.In, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [query]
+ if ok && !compiler.StringArrayContainsValue([]string{"query"}, x.In) {
+ message := fmt.Sprintf("has unexpected value for in: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 3;
+ v3 := compiler.MapValueForKey(m, "description")
+ if v3 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string name = 4;
+ v4 := compiler.MapValueForKey(m, "name")
+ if v4 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool allow_empty_value = 5;
+ v5 := compiler.MapValueForKey(m, "allowEmptyValue")
+ if v5 != nil {
+ x.AllowEmptyValue, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for allowEmptyValue: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string type = 6;
+ v6 := compiler.MapValueForKey(m, "type")
+ if v6 != nil {
+ x.Type, ok = compiler.StringForScalarNode(v6)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [string number boolean integer array]
+ if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) {
+ message := fmt.Sprintf("has unexpected value for type: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 7;
+ v7 := compiler.MapValueForKey(m, "format")
+ if v7 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v7)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // PrimitivesItems items = 8;
+ v8 := compiler.MapValueForKey(m, "items")
+ if v8 != nil {
+ var err error
+ x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", v8, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string collection_format = 9;
+ v9 := compiler.MapValueForKey(m, "collectionFormat")
+ if v9 != nil {
+ x.CollectionFormat, ok = compiler.StringForScalarNode(v9)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // check for valid enum values
+ // [csv ssv tsv pipes multi]
+ if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) {
+ message := fmt.Sprintf("has unexpected value for collectionFormat: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 10;
+ v10 := compiler.MapValueForKey(m, "default")
+ if v10 != nil {
+ var err error
+ x.Default, err = NewAny(v10, compiler.NewContext("default", v10, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float maximum = 11;
+ v11 := compiler.MapValueForKey(m, "maximum")
+ if v11 != nil {
+ v, ok := compiler.FloatForScalarNode(v11)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 12;
+ v12 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v12 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v12)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 13;
+ v13 := compiler.MapValueForKey(m, "minimum")
+ if v13 != nil {
+ v, ok := compiler.FloatForScalarNode(v13)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 14;
+ v14 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v14 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v14)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 15;
+ v15 := compiler.MapValueForKey(m, "maxLength")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 16;
+ v16 := compiler.MapValueForKey(m, "minLength")
+ if v16 != nil {
+ t, ok := compiler.IntForScalarNode(v16)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 17;
+ v17 := compiler.MapValueForKey(m, "pattern")
+ if v17 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v17)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 18;
+ v18 := compiler.MapValueForKey(m, "maxItems")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 19;
+ v19 := compiler.MapValueForKey(m, "minItems")
+ if v19 != nil {
+ t, ok := compiler.IntForScalarNode(v19)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 20;
+ v20 := compiler.MapValueForKey(m, "uniqueItems")
+ if v20 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v20)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v20))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 21;
+ v21 := compiler.MapValueForKey(m, "enum")
+ if v21 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v21)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // float multiple_of = 22;
+ v22 := compiler.MapValueForKey(m, "multipleOf")
+ if v22 != nil {
+ v, ok := compiler.FloatForScalarNode(v22)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v22))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 23;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponse creates an object of type Response if possible, returning an error if not.
+func NewResponse(in *yaml.Node, context *compiler.Context) (*Response, error) {
+ errors := make([]error, 0)
+ x := &Response{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"description"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "examples", "headers", "schema"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string description = 1;
+ v1 := compiler.MapValueForKey(m, "description")
+ if v1 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // SchemaItem schema = 2;
+ v2 := compiler.MapValueForKey(m, "schema")
+ if v2 != nil {
+ var err error
+ x.Schema, err = NewSchemaItem(v2, compiler.NewContext("schema", v2, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Headers headers = 3;
+ v3 := compiler.MapValueForKey(m, "headers")
+ if v3 != nil {
+ var err error
+ x.Headers, err = NewHeaders(v3, compiler.NewContext("headers", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Examples examples = 4;
+ v4 := compiler.MapValueForKey(m, "examples")
+ if v4 != nil {
+ var err error
+ x.Examples, err = NewExamples(v4, compiler.NewContext("examples", v4, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 5;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponseDefinitions creates an object of type ResponseDefinitions if possible, returning an error if not.
+func NewResponseDefinitions(in *yaml.Node, context *compiler.Context) (*ResponseDefinitions, error) {
+ errors := make([]error, 0)
+ x := &ResponseDefinitions{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedResponse additional_properties = 1;
+ // MAP: Response
+ x.AdditionalProperties = make([]*NamedResponse, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedResponse{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewResponse(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponseValue creates an object of type ResponseValue if possible, returning an error if not.
+func NewResponseValue(in *yaml.Node, context *compiler.Context) (*ResponseValue, error) {
+ errors := make([]error, 0)
+ x := &ResponseValue{}
+ matched := false
+ // Response response = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewResponse(m, compiler.NewContext("response", m, context))
+ if matchingError == nil {
+ x.Oneof = &ResponseValue_Response{Response: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // JsonReference json_reference = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", m, context))
+ if matchingError == nil {
+ x.Oneof = &ResponseValue_JsonReference{JsonReference: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid ResponseValue")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewResponses creates an object of type Responses if possible, returning an error if not.
+func NewResponses(in *yaml.Node, context *compiler.Context) (*Responses, error) {
+ errors := make([]error, 0)
+ x := &Responses{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{}
+ allowedPatterns := []*regexp.Regexp{pattern2, pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // repeated NamedResponseValue response_code = 1;
+ // MAP: ResponseValue ^([0-9]{3})$|^(default)$
+ x.ResponseCode = make([]*NamedResponseValue, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if pattern2.MatchString(k) {
+ pair := &NamedResponseValue{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewResponseValue(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.ResponseCode = append(x.ResponseCode, pair)
+ }
+ }
+ }
+ // repeated NamedAny vendor_extension = 2;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSchema creates an object of type Schema if possible, returning an error if not.
+func NewSchema(in *yaml.Node, context *compiler.Context) (*Schema, error) {
+ errors := make([]error, 0)
+ x := &Schema{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"$ref", "additionalProperties", "allOf", "default", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "xml"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string _ref = 1;
+ v1 := compiler.MapValueForKey(m, "$ref")
+ if v1 != nil {
+ x.XRef, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for $ref: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string format = 2;
+ v2 := compiler.MapValueForKey(m, "format")
+ if v2 != nil {
+ x.Format, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for format: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string title = 3;
+ v3 := compiler.MapValueForKey(m, "title")
+ if v3 != nil {
+ x.Title, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for title: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 4;
+ v4 := compiler.MapValueForKey(m, "description")
+ if v4 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Any default = 5;
+ v5 := compiler.MapValueForKey(m, "default")
+ if v5 != nil {
+ var err error
+ x.Default, err = NewAny(v5, compiler.NewContext("default", v5, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // float multiple_of = 6;
+ v6 := compiler.MapValueForKey(m, "multipleOf")
+ if v6 != nil {
+ v, ok := compiler.FloatForScalarNode(v6)
+ if ok {
+ x.MultipleOf = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for multipleOf: %s", compiler.Display(v6))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float maximum = 7;
+ v7 := compiler.MapValueForKey(m, "maximum")
+ if v7 != nil {
+ v, ok := compiler.FloatForScalarNode(v7)
+ if ok {
+ x.Maximum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for maximum: %s", compiler.Display(v7))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_maximum = 8;
+ v8 := compiler.MapValueForKey(m, "exclusiveMaximum")
+ if v8 != nil {
+ x.ExclusiveMaximum, ok = compiler.BoolForScalarNode(v8)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %s", compiler.Display(v8))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // float minimum = 9;
+ v9 := compiler.MapValueForKey(m, "minimum")
+ if v9 != nil {
+ v, ok := compiler.FloatForScalarNode(v9)
+ if ok {
+ x.Minimum = v
+ } else {
+ message := fmt.Sprintf("has unexpected value for minimum: %s", compiler.Display(v9))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool exclusive_minimum = 10;
+ v10 := compiler.MapValueForKey(m, "exclusiveMinimum")
+ if v10 != nil {
+ x.ExclusiveMinimum, ok = compiler.BoolForScalarNode(v10)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %s", compiler.Display(v10))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_length = 11;
+ v11 := compiler.MapValueForKey(m, "maxLength")
+ if v11 != nil {
+ t, ok := compiler.IntForScalarNode(v11)
+ if ok {
+ x.MaxLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxLength: %s", compiler.Display(v11))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_length = 12;
+ v12 := compiler.MapValueForKey(m, "minLength")
+ if v12 != nil {
+ t, ok := compiler.IntForScalarNode(v12)
+ if ok {
+ x.MinLength = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minLength: %s", compiler.Display(v12))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string pattern = 13;
+ v13 := compiler.MapValueForKey(m, "pattern")
+ if v13 != nil {
+ x.Pattern, ok = compiler.StringForScalarNode(v13)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for pattern: %s", compiler.Display(v13))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_items = 14;
+ v14 := compiler.MapValueForKey(m, "maxItems")
+ if v14 != nil {
+ t, ok := compiler.IntForScalarNode(v14)
+ if ok {
+ x.MaxItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxItems: %s", compiler.Display(v14))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_items = 15;
+ v15 := compiler.MapValueForKey(m, "minItems")
+ if v15 != nil {
+ t, ok := compiler.IntForScalarNode(v15)
+ if ok {
+ x.MinItems = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minItems: %s", compiler.Display(v15))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool unique_items = 16;
+ v16 := compiler.MapValueForKey(m, "uniqueItems")
+ if v16 != nil {
+ x.UniqueItems, ok = compiler.BoolForScalarNode(v16)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for uniqueItems: %s", compiler.Display(v16))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 max_properties = 17;
+ v17 := compiler.MapValueForKey(m, "maxProperties")
+ if v17 != nil {
+ t, ok := compiler.IntForScalarNode(v17)
+ if ok {
+ x.MaxProperties = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for maxProperties: %s", compiler.Display(v17))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // int64 min_properties = 18;
+ v18 := compiler.MapValueForKey(m, "minProperties")
+ if v18 != nil {
+ t, ok := compiler.IntForScalarNode(v18)
+ if ok {
+ x.MinProperties = int64(t)
+ } else {
+ message := fmt.Sprintf("has unexpected value for minProperties: %s", compiler.Display(v18))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated string required = 19;
+ v19 := compiler.MapValueForKey(m, "required")
+ if v19 != nil {
+ v, ok := compiler.SequenceNodeForNode(v19)
+ if ok {
+ x.Required = compiler.StringArrayForSequenceNode(v)
+ } else {
+ message := fmt.Sprintf("has unexpected value for required: %s", compiler.Display(v19))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated Any enum = 20;
+ v20 := compiler.MapValueForKey(m, "enum")
+ if v20 != nil {
+ // repeated Any
+ x.Enum = make([]*Any, 0)
+ a, ok := compiler.SequenceNodeForNode(v20)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewAny(item, compiler.NewContext("enum", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.Enum = append(x.Enum, y)
+ }
+ }
+ }
+ // AdditionalPropertiesItem additional_properties = 21;
+ v21 := compiler.MapValueForKey(m, "additionalProperties")
+ if v21 != nil {
+ var err error
+ x.AdditionalProperties, err = NewAdditionalPropertiesItem(v21, compiler.NewContext("additionalProperties", v21, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // TypeItem type = 22;
+ v22 := compiler.MapValueForKey(m, "type")
+ if v22 != nil {
+ var err error
+ x.Type, err = NewTypeItem(v22, compiler.NewContext("type", v22, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ItemsItem items = 23;
+ v23 := compiler.MapValueForKey(m, "items")
+ if v23 != nil {
+ var err error
+ x.Items, err = NewItemsItem(v23, compiler.NewContext("items", v23, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated Schema all_of = 24;
+ v24 := compiler.MapValueForKey(m, "allOf")
+ if v24 != nil {
+ // repeated Schema
+ x.AllOf = make([]*Schema, 0)
+ a, ok := compiler.SequenceNodeForNode(v24)
+ if ok {
+ for _, item := range a.Content {
+ y, err := NewSchema(item, compiler.NewContext("allOf", item, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AllOf = append(x.AllOf, y)
+ }
+ }
+ }
+ // Properties properties = 25;
+ v25 := compiler.MapValueForKey(m, "properties")
+ if v25 != nil {
+ var err error
+ x.Properties, err = NewProperties(v25, compiler.NewContext("properties", v25, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // string discriminator = 26;
+ v26 := compiler.MapValueForKey(m, "discriminator")
+ if v26 != nil {
+ x.Discriminator, ok = compiler.StringForScalarNode(v26)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for discriminator: %s", compiler.Display(v26))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool read_only = 27;
+ v27 := compiler.MapValueForKey(m, "readOnly")
+ if v27 != nil {
+ x.ReadOnly, ok = compiler.BoolForScalarNode(v27)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for readOnly: %s", compiler.Display(v27))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // Xml xml = 28;
+ v28 := compiler.MapValueForKey(m, "xml")
+ if v28 != nil {
+ var err error
+ x.Xml, err = NewXml(v28, compiler.NewContext("xml", v28, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // ExternalDocs external_docs = 29;
+ v29 := compiler.MapValueForKey(m, "externalDocs")
+ if v29 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v29, compiler.NewContext("externalDocs", v29, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // Any example = 30;
+ v30 := compiler.MapValueForKey(m, "example")
+ if v30 != nil {
+ var err error
+ x.Example, err = NewAny(v30, compiler.NewContext("example", v30, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 31;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSchemaItem creates an object of type SchemaItem if possible, returning an error if not.
+func NewSchemaItem(in *yaml.Node, context *compiler.Context) (*SchemaItem, error) {
+ errors := make([]error, 0)
+ x := &SchemaItem{}
+ matched := false
+ // Schema schema = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewSchema(m, compiler.NewContext("schema", m, context))
+ if matchingError == nil {
+ x.Oneof = &SchemaItem_Schema{Schema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // FileSchema file_schema = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewFileSchema(m, compiler.NewContext("fileSchema", m, context))
+ if matchingError == nil {
+ x.Oneof = &SchemaItem_FileSchema{FileSchema: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid SchemaItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecurityDefinitions creates an object of type SecurityDefinitions if possible, returning an error if not.
+func NewSecurityDefinitions(in *yaml.Node, context *compiler.Context) (*SecurityDefinitions, error) {
+ errors := make([]error, 0)
+ x := &SecurityDefinitions{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedSecurityDefinitionsItem additional_properties = 1;
+ // MAP: SecurityDefinitionsItem
+ x.AdditionalProperties = make([]*NamedSecurityDefinitionsItem, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedSecurityDefinitionsItem{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewSecurityDefinitionsItem(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecurityDefinitionsItem creates an object of type SecurityDefinitionsItem if possible, returning an error if not.
+func NewSecurityDefinitionsItem(in *yaml.Node, context *compiler.Context) (*SecurityDefinitionsItem, error) {
+ errors := make([]error, 0)
+ x := &SecurityDefinitionsItem{}
+ matched := false
+ // BasicAuthenticationSecurity basic_authentication_security = 1;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewBasicAuthenticationSecurity(m, compiler.NewContext("basicAuthenticationSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{BasicAuthenticationSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // ApiKeySecurity api_key_security = 2;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewApiKeySecurity(m, compiler.NewContext("apiKeySecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{ApiKeySecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Oauth2ImplicitSecurity oauth2_implicit_security = 3;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewOauth2ImplicitSecurity(m, compiler.NewContext("oauth2ImplicitSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{Oauth2ImplicitSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Oauth2PasswordSecurity oauth2_password_security = 4;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewOauth2PasswordSecurity(m, compiler.NewContext("oauth2PasswordSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{Oauth2PasswordSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Oauth2ApplicationSecurity oauth2_application_security = 5;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewOauth2ApplicationSecurity(m, compiler.NewContext("oauth2ApplicationSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{Oauth2ApplicationSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ // Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
+ {
+ m, ok := compiler.UnpackMap(in)
+ if ok {
+ // errors might be ok here, they mean we just don't have the right subtype
+ t, matchingError := NewOauth2AccessCodeSecurity(m, compiler.NewContext("oauth2AccessCodeSecurity", m, context))
+ if matchingError == nil {
+ x.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{Oauth2AccessCodeSecurity: t}
+ matched = true
+ } else {
+ errors = append(errors, matchingError)
+ }
+ }
+ }
+ if matched {
+ // since the oneof matched one of its possibilities, discard any matching errors
+ errors = make([]error, 0)
+ } else {
+ message := fmt.Sprintf("contains an invalid SecurityDefinitionsItem")
+ err := compiler.NewError(context, message)
+ errors = []error{err}
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not.
+func NewSecurityRequirement(in *yaml.Node, context *compiler.Context) (*SecurityRequirement, error) {
+ errors := make([]error, 0)
+ x := &SecurityRequirement{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedStringArray additional_properties = 1;
+ // MAP: StringArray
+ x.AdditionalProperties = make([]*NamedStringArray, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedStringArray{}
+ pair.Name = k
+ var err error
+ pair.Value, err = NewStringArray(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewStringArray creates an object of type StringArray if possible, returning an error if not.
+func NewStringArray(in *yaml.Node, context *compiler.Context) (*StringArray, error) {
+ errors := make([]error, 0)
+ x := &StringArray{}
+ x.Value = make([]string, 0)
+ for _, node := range in.Content {
+ s, _ := compiler.StringForScalarNode(node)
+ x.Value = append(x.Value, s)
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewTag creates an object of type Tag if possible, returning an error if not.
+func NewTag(in *yaml.Node, context *compiler.Context) (*Tag, error) {
+ errors := make([]error, 0)
+ x := &Tag{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ requiredKeys := []string{"name"}
+ missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
+ if len(missingKeys) > 0 {
+ message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ allowedKeys := []string{"description", "externalDocs", "name"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string description = 2;
+ v2 := compiler.MapValueForKey(m, "description")
+ if v2 != nil {
+ x.Description, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for description: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // ExternalDocs external_docs = 3;
+ v3 := compiler.MapValueForKey(m, "externalDocs")
+ if v3 != nil {
+ var err error
+ x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", v3, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ // repeated NamedAny vendor_extension = 4;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewTypeItem creates an object of type TypeItem if possible, returning an error if not.
+func NewTypeItem(in *yaml.Node, context *compiler.Context) (*TypeItem, error) {
+ errors := make([]error, 0)
+ x := &TypeItem{}
+ v1 := in
+ switch v1.Kind {
+ case yaml.ScalarNode:
+ x.Value = make([]string, 0)
+ x.Value = append(x.Value, v1.Value)
+ case yaml.SequenceNode:
+ x.Value = make([]string, 0)
+ for _, v := range v1.Content {
+ value := v.Value
+ ok := v.Kind == yaml.ScalarNode
+ if ok {
+ x.Value = append(x.Value, value)
+ } else {
+ message := fmt.Sprintf("has unexpected value for string array element: %+v (%T)", value, value)
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ default:
+ message := fmt.Sprintf("has unexpected value for string array: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewVendorExtension creates an object of type VendorExtension if possible, returning an error if not.
+func NewVendorExtension(in *yaml.Node, context *compiler.Context) (*VendorExtension, error) {
+ errors := make([]error, 0)
+ x := &VendorExtension{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ // repeated NamedAny additional_properties = 1;
+ // MAP: Any
+ x.AdditionalProperties = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.AdditionalProperties = append(x.AdditionalProperties, pair)
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// NewXml creates an object of type Xml if possible, returning an error if not.
+func NewXml(in *yaml.Node, context *compiler.Context) (*Xml, error) {
+ errors := make([]error, 0)
+ x := &Xml{}
+ m, ok := compiler.UnpackMap(in)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
+ errors = append(errors, compiler.NewError(context, message))
+ } else {
+ allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"}
+ allowedPatterns := []*regexp.Regexp{pattern0}
+ invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
+ if len(invalidKeys) > 0 {
+ message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ // string name = 1;
+ v1 := compiler.MapValueForKey(m, "name")
+ if v1 != nil {
+ x.Name, ok = compiler.StringForScalarNode(v1)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for name: %s", compiler.Display(v1))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string namespace = 2;
+ v2 := compiler.MapValueForKey(m, "namespace")
+ if v2 != nil {
+ x.Namespace, ok = compiler.StringForScalarNode(v2)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for namespace: %s", compiler.Display(v2))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // string prefix = 3;
+ v3 := compiler.MapValueForKey(m, "prefix")
+ if v3 != nil {
+ x.Prefix, ok = compiler.StringForScalarNode(v3)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for prefix: %s", compiler.Display(v3))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool attribute = 4;
+ v4 := compiler.MapValueForKey(m, "attribute")
+ if v4 != nil {
+ x.Attribute, ok = compiler.BoolForScalarNode(v4)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for attribute: %s", compiler.Display(v4))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // bool wrapped = 5;
+ v5 := compiler.MapValueForKey(m, "wrapped")
+ if v5 != nil {
+ x.Wrapped, ok = compiler.BoolForScalarNode(v5)
+ if !ok {
+ message := fmt.Sprintf("has unexpected value for wrapped: %s", compiler.Display(v5))
+ errors = append(errors, compiler.NewError(context, message))
+ }
+ }
+ // repeated NamedAny vendor_extension = 6;
+ // MAP: Any ^x-
+ x.VendorExtension = make([]*NamedAny, 0)
+ for i := 0; i < len(m.Content); i += 2 {
+ k, ok := compiler.StringForScalarNode(m.Content[i])
+ if ok {
+ v := m.Content[i+1]
+ if strings.HasPrefix(k, "x-") {
+ pair := &NamedAny{}
+ pair.Name = k
+ result := &Any{}
+ handled, resultFromExt, err := compiler.CallExtension(context, v, k)
+ if handled {
+ if err != nil {
+ errors = append(errors, err)
+ } else {
+ bytes := compiler.Marshal(v)
+ result.Yaml = string(bytes)
+ result.Value = resultFromExt
+ pair.Value = result
+ }
+ } else {
+ pair.Value, err = NewAny(v, compiler.NewContext(k, v, context))
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ x.VendorExtension = append(x.VendorExtension, pair)
+ }
+ }
+ }
+ }
+ return x, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside AdditionalPropertiesItem objects.
+func (m *AdditionalPropertiesItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*AdditionalPropertiesItem_Schema)
+ if ok {
+ _, err := p.Schema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Any objects.
+func (m *Any) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ApiKeySecurity objects.
+func (m *ApiKeySecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside BasicAuthenticationSecurity objects.
+func (m *BasicAuthenticationSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside BodyParameter objects.
+func (m *BodyParameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Schema != nil {
+ _, err := m.Schema.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Contact objects.
+func (m *Contact) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Default objects.
+func (m *Default) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Definitions objects.
+func (m *Definitions) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Document objects.
+func (m *Document) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Info != nil {
+ _, err := m.Info.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Paths != nil {
+ _, err := m.Paths.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Definitions != nil {
+ _, err := m.Definitions.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Parameters != nil {
+ _, err := m.Parameters.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Responses != nil {
+ _, err := m.Responses.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Security {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.SecurityDefinitions != nil {
+ _, err := m.SecurityDefinitions.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Tags {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Examples objects.
+func (m *Examples) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ExternalDocs objects.
+func (m *ExternalDocs) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside FileSchema objects.
+func (m *FileSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Example != nil {
+ _, err := m.Example.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside FormDataParameterSubSchema objects.
+func (m *FormDataParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Header objects.
+func (m *Header) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside HeaderParameterSubSchema objects.
+func (m *HeaderParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Headers objects.
+func (m *Headers) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Info objects.
+func (m *Info) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Contact != nil {
+ _, err := m.Contact.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.License != nil {
+ _, err := m.License.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ItemsItem objects.
+func (m *ItemsItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.Schema {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside JsonReference objects.
+func (m *JsonReference) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.XRef != "" {
+ info, err := compiler.ReadInfoForRef(root, m.XRef)
+ if err != nil {
+ return nil, err
+ }
+ if info != nil {
+ replacement, err := NewJsonReference(info, nil)
+ if err == nil {
+ *m = *replacement
+ return m.ResolveReferences(root)
+ }
+ }
+ return info, nil
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside License objects.
+func (m *License) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedAny objects.
+func (m *NamedAny) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedHeader objects.
+func (m *NamedHeader) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedParameter objects.
+func (m *NamedParameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedPathItem objects.
+func (m *NamedPathItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedResponse objects.
+func (m *NamedResponse) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedResponseValue objects.
+func (m *NamedResponseValue) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedSchema objects.
+func (m *NamedSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedSecurityDefinitionsItem objects.
+func (m *NamedSecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedString objects.
+func (m *NamedString) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NamedStringArray objects.
+func (m *NamedStringArray) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Value != nil {
+ _, err := m.Value.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside NonBodyParameter objects.
+func (m *NonBodyParameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*NonBodyParameter_HeaderParameterSubSchema)
+ if ok {
+ _, err := p.HeaderParameterSubSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*NonBodyParameter_FormDataParameterSubSchema)
+ if ok {
+ _, err := p.FormDataParameterSubSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*NonBodyParameter_QueryParameterSubSchema)
+ if ok {
+ _, err := p.QueryParameterSubSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*NonBodyParameter_PathParameterSubSchema)
+ if ok {
+ _, err := p.PathParameterSubSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2AccessCodeSecurity objects.
+func (m *Oauth2AccessCodeSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2ApplicationSecurity objects.
+func (m *Oauth2ApplicationSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2ImplicitSecurity objects.
+func (m *Oauth2ImplicitSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2PasswordSecurity objects.
+func (m *Oauth2PasswordSecurity) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Scopes != nil {
+ _, err := m.Scopes.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Oauth2Scopes objects.
+func (m *Oauth2Scopes) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Operation objects.
+func (m *Operation) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Parameters {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.Responses != nil {
+ _, err := m.Responses.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Security {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Parameter objects.
+func (m *Parameter) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*Parameter_BodyParameter)
+ if ok {
+ _, err := p.BodyParameter.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*Parameter_NonBodyParameter)
+ if ok {
+ _, err := p.NonBodyParameter.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ParameterDefinitions objects.
+func (m *ParameterDefinitions) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ParametersItem objects.
+func (m *ParametersItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*ParametersItem_Parameter)
+ if ok {
+ _, err := p.Parameter.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*ParametersItem_JsonReference)
+ if ok {
+ info, err := p.JsonReference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ } else if info != nil {
+ n, err := NewParametersItem(info, nil)
+ if err != nil {
+ return nil, err
+ } else if n != nil {
+ *m = *n
+ return nil, nil
+ }
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside PathItem objects.
+func (m *PathItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.XRef != "" {
+ info, err := compiler.ReadInfoForRef(root, m.XRef)
+ if err != nil {
+ return nil, err
+ }
+ if info != nil {
+ replacement, err := NewPathItem(info, nil)
+ if err == nil {
+ *m = *replacement
+ return m.ResolveReferences(root)
+ }
+ }
+ return info, nil
+ }
+ if m.Get != nil {
+ _, err := m.Get.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Put != nil {
+ _, err := m.Put.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Post != nil {
+ _, err := m.Post.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Delete != nil {
+ _, err := m.Delete.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Options != nil {
+ _, err := m.Options.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Head != nil {
+ _, err := m.Head.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Patch != nil {
+ _, err := m.Patch.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Parameters {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside PathParameterSubSchema objects.
+func (m *PathParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Paths objects.
+func (m *Paths) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.Path {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside PrimitivesItems objects.
+func (m *PrimitivesItems) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Properties objects.
+func (m *Properties) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside QueryParameterSubSchema objects.
+func (m *QueryParameterSubSchema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Response objects.
+func (m *Response) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.Schema != nil {
+ _, err := m.Schema.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Headers != nil {
+ _, err := m.Headers.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Examples != nil {
+ _, err := m.Examples.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ResponseDefinitions objects.
+func (m *ResponseDefinitions) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside ResponseValue objects.
+func (m *ResponseValue) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*ResponseValue_Response)
+ if ok {
+ _, err := p.Response.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*ResponseValue_JsonReference)
+ if ok {
+ info, err := p.JsonReference.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ } else if info != nil {
+ n, err := NewResponseValue(info, nil)
+ if err != nil {
+ return nil, err
+ } else if n != nil {
+ *m = *n
+ return nil, nil
+ }
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Responses objects.
+func (m *Responses) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.ResponseCode {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Schema objects.
+func (m *Schema) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.XRef != "" {
+ info, err := compiler.ReadInfoForRef(root, m.XRef)
+ if err != nil {
+ return nil, err
+ }
+ if info != nil {
+ replacement, err := NewSchema(info, nil)
+ if err == nil {
+ *m = *replacement
+ return m.ResolveReferences(root)
+ }
+ }
+ return info, nil
+ }
+ if m.Default != nil {
+ _, err := m.Default.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.Enum {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.AdditionalProperties != nil {
+ _, err := m.AdditionalProperties.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Type != nil {
+ _, err := m.Type.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Items != nil {
+ _, err := m.Items.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.AllOf {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ if m.Properties != nil {
+ _, err := m.Properties.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Xml != nil {
+ _, err := m.Xml.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ if m.Example != nil {
+ _, err := m.Example.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SchemaItem objects.
+func (m *SchemaItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*SchemaItem_Schema)
+ if ok {
+ _, err := p.Schema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SchemaItem_FileSchema)
+ if ok {
+ _, err := p.FileSchema.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecurityDefinitions objects.
+func (m *SecurityDefinitions) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecurityDefinitionsItem objects.
+func (m *SecurityDefinitionsItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_BasicAuthenticationSecurity)
+ if ok {
+ _, err := p.BasicAuthenticationSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_ApiKeySecurity)
+ if ok {
+ _, err := p.ApiKeySecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ImplicitSecurity)
+ if ok {
+ _, err := p.Oauth2ImplicitSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2PasswordSecurity)
+ if ok {
+ _, err := p.Oauth2PasswordSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ApplicationSecurity)
+ if ok {
+ _, err := p.Oauth2ApplicationSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ {
+ p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)
+ if ok {
+ _, err := p.Oauth2AccessCodeSecurity.ResolveReferences(root)
+ if err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside SecurityRequirement objects.
+func (m *SecurityRequirement) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside StringArray objects.
+func (m *StringArray) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Tag objects.
+func (m *Tag) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ if m.ExternalDocs != nil {
+ _, err := m.ExternalDocs.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside TypeItem objects.
+func (m *TypeItem) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside VendorExtension objects.
+func (m *VendorExtension) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.AdditionalProperties {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ResolveReferences resolves references found inside Xml objects.
+func (m *Xml) ResolveReferences(root string) (*yaml.Node, error) {
+ errors := make([]error, 0)
+ for _, item := range m.VendorExtension {
+ if item != nil {
+ _, err := item.ResolveReferences(root)
+ if err != nil {
+ errors = append(errors, err)
+ }
+ }
+ }
+ return nil, compiler.NewErrorGroupOrNil(errors)
+}
+
+// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export.
+func (m *AdditionalPropertiesItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // AdditionalPropertiesItem
+ // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetSchema()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
+ return compiler.NewScalarNodeForBool(v1.Boolean)
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Any suitable for JSON or YAML export.
+func (m *Any) ToRawInfo() *yaml.Node {
+ var err error
+ var node yaml.Node
+ err = yaml.Unmarshal([]byte(m.Yaml), &node)
+ if err == nil {
+ if node.Kind == yaml.DocumentNode {
+ return node.Content[0]
+ }
+ return &node
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of ApiKeySecurity suitable for JSON or YAML export.
+func (m *ApiKeySecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of BasicAuthenticationSecurity suitable for JSON or YAML export.
+func (m *BasicAuthenticationSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of BodyParameter suitable for JSON or YAML export.
+func (m *BodyParameter) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, m.Schema.ToRawInfo())
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Contact suitable for JSON or YAML export.
+func (m *Contact) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Url != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ }
+ if m.Email != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("email"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Email))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Default suitable for JSON or YAML export.
+func (m *Default) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Definitions suitable for JSON or YAML export.
+func (m *Definitions) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Document suitable for JSON or YAML export.
+func (m *Document) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("swagger"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Swagger))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("info"))
+ info.Content = append(info.Content, m.Info.ToRawInfo())
+ if m.Host != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("host"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Host))
+ }
+ if m.BasePath != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("basePath"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.BasePath))
+ }
+ if len(m.Schemes) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes))
+ }
+ if len(m.Consumes) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes))
+ }
+ if len(m.Produces) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("produces"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("paths"))
+ info.Content = append(info.Content, m.Paths.ToRawInfo())
+ if m.Definitions != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("definitions"))
+ info.Content = append(info.Content, m.Definitions.ToRawInfo())
+ }
+ if m.Parameters != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, m.Parameters.ToRawInfo())
+ }
+ if m.Responses != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("responses"))
+ info.Content = append(info.Content, m.Responses.ToRawInfo())
+ }
+ if len(m.Security) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Security {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("security"))
+ info.Content = append(info.Content, items)
+ }
+ if m.SecurityDefinitions != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("securityDefinitions"))
+ info.Content = append(info.Content, m.SecurityDefinitions.ToRawInfo())
+ }
+ if len(m.Tags) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Tags {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tags"))
+ info.Content = append(info.Content, items)
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Examples suitable for JSON or YAML export.
+func (m *Examples) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export.
+func (m *ExternalDocs) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of FileSchema suitable for JSON or YAML export.
+func (m *FileSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Title != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("title"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if len(m.Required) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required))
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ if m.ReadOnly != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly))
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.Example != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("example"))
+ info.Content = append(info.Content, m.Example.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of FormDataParameterSubSchema suitable for JSON or YAML export.
+func (m *FormDataParameterSubSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.AllowEmptyValue != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue))
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Header suitable for JSON or YAML export.
+func (m *Header) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of HeaderParameterSubSchema suitable for JSON or YAML export.
+func (m *HeaderParameterSubSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Headers suitable for JSON or YAML export.
+func (m *Headers) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Info suitable for JSON or YAML export.
+func (m *Info) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("title"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("version"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Version))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.TermsOfService != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("termsOfService"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TermsOfService))
+ }
+ if m.Contact != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("contact"))
+ info.Content = append(info.Content, m.Contact.ToRawInfo())
+ }
+ if m.License != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("license"))
+ info.Content = append(info.Content, m.License.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export.
+func (m *ItemsItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.Schema) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Schema {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, items)
+ }
+ return info
+}
+
+// ToRawInfo returns a description of JsonReference suitable for JSON or YAML export.
+func (m *JsonReference) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ return info
+}
+
+// ToRawInfo returns a description of License suitable for JSON or YAML export.
+func (m *License) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ if m.Url != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("url"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Url))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export.
+func (m *NamedAny) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Value != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, m.Value.ToRawInfo())
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedHeader suitable for JSON or YAML export.
+func (m *NamedHeader) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedParameter suitable for JSON or YAML export.
+func (m *NamedParameter) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export.
+func (m *NamedPathItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedResponse suitable for JSON or YAML export.
+func (m *NamedResponse) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedResponseValue suitable for JSON or YAML export.
+func (m *NamedResponseValue) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:ResponseValue StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedSchema suitable for JSON or YAML export.
+func (m *NamedSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedSecurityDefinitionsItem suitable for JSON or YAML export.
+func (m *NamedSecurityDefinitionsItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:SecurityDefinitionsItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NamedString suitable for JSON or YAML export.
+func (m *NamedString) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Value != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Value))
+ }
+ return info
+}
+
+// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export.
+func (m *NamedStringArray) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
+ return info
+}
+
+// ToRawInfo returns a description of NonBodyParameter suitable for JSON or YAML export.
+func (m *NonBodyParameter) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // NonBodyParameter
+ // {Name:headerParameterSubSchema Type:HeaderParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetHeaderParameterSubSchema()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetFormDataParameterSubSchema()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ // {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v2 := m.GetQueryParameterSubSchema()
+ if v2 != nil {
+ return v2.ToRawInfo()
+ }
+ // {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v3 := m.GetPathParameterSubSchema()
+ if v3 != nil {
+ return v3.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Oauth2AccessCodeSecurity suitable for JSON or YAML export.
+func (m *Oauth2AccessCodeSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flow"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow))
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Oauth2ApplicationSecurity suitable for JSON or YAML export.
+func (m *Oauth2ApplicationSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flow"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow))
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Oauth2ImplicitSecurity suitable for JSON or YAML export.
+func (m *Oauth2ImplicitSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flow"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow))
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("authorizationUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.AuthorizationUrl))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Oauth2PasswordSecurity suitable for JSON or YAML export.
+func (m *Oauth2PasswordSecurity) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("flow"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Flow))
+ if m.Scopes != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("scopes"))
+ info.Content = append(info.Content, m.Scopes.ToRawInfo())
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tokenUrl"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.TokenUrl))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Oauth2Scopes suitable for JSON or YAML export.
+func (m *Oauth2Scopes) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}
+ return info
+}
+
+// ToRawInfo returns a description of Operation suitable for JSON or YAML export.
+func (m *Operation) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.Tags) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("tags"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Tags))
+ }
+ if m.Summary != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("summary"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Summary))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.OperationId != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("operationId"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.OperationId))
+ }
+ if len(m.Produces) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("produces"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Produces))
+ }
+ if len(m.Consumes) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("consumes"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Consumes))
+ }
+ if len(m.Parameters) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Parameters {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, items)
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("responses"))
+ info.Content = append(info.Content, m.Responses.ToRawInfo())
+ if len(m.Schemes) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schemes"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Schemes))
+ }
+ if m.Deprecated != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("deprecated"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Deprecated))
+ }
+ if len(m.Security) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Security {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("security"))
+ info.Content = append(info.Content, items)
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Parameter suitable for JSON or YAML export.
+func (m *Parameter) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // Parameter
+ // {Name:bodyParameter Type:BodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetBodyParameter()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:nonBodyParameter Type:NonBodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetNonBodyParameter()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of ParameterDefinitions suitable for JSON or YAML export.
+func (m *ParameterDefinitions) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ParametersItem suitable for JSON or YAML export.
+func (m *ParametersItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // ParametersItem
+ // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetParameter()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetJsonReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of PathItem suitable for JSON or YAML export.
+func (m *PathItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.XRef != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef))
+ }
+ if m.Get != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("get"))
+ info.Content = append(info.Content, m.Get.ToRawInfo())
+ }
+ if m.Put != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("put"))
+ info.Content = append(info.Content, m.Put.ToRawInfo())
+ }
+ if m.Post != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("post"))
+ info.Content = append(info.Content, m.Post.ToRawInfo())
+ }
+ if m.Delete != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("delete"))
+ info.Content = append(info.Content, m.Delete.ToRawInfo())
+ }
+ if m.Options != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("options"))
+ info.Content = append(info.Content, m.Options.ToRawInfo())
+ }
+ if m.Head != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("head"))
+ info.Content = append(info.Content, m.Head.ToRawInfo())
+ }
+ if m.Patch != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("patch"))
+ info.Content = append(info.Content, m.Patch.ToRawInfo())
+ }
+ if len(m.Parameters) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Parameters {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("parameters"))
+ info.Content = append(info.Content, items)
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of PathParameterSubSchema suitable for JSON or YAML export.
+func (m *PathParameterSubSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Paths suitable for JSON or YAML export.
+func (m *Paths) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ if m.Path != nil {
+ for _, item := range m.Path {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of PrimitivesItems suitable for JSON or YAML export.
+func (m *PrimitivesItems) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Properties suitable for JSON or YAML export.
+func (m *Properties) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of QueryParameterSubSchema suitable for JSON or YAML export.
+func (m *QueryParameterSubSchema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Required != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Required))
+ }
+ if m.In != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("in"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.In))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.AllowEmptyValue != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allowEmptyValue"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.AllowEmptyValue))
+ }
+ if m.Type != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Items != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, m.Items.ToRawInfo())
+ }
+ if m.CollectionFormat != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("collectionFormat"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.CollectionFormat))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Response suitable for JSON or YAML export.
+func (m *Response) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ if m.Schema != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("schema"))
+ info.Content = append(info.Content, m.Schema.ToRawInfo())
+ }
+ if m.Headers != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("headers"))
+ info.Content = append(info.Content, m.Headers.ToRawInfo())
+ }
+ if m.Examples != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("examples"))
+ info.Content = append(info.Content, m.Examples.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ResponseDefinitions suitable for JSON or YAML export.
+func (m *ResponseDefinitions) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of ResponseValue suitable for JSON or YAML export.
+func (m *ResponseValue) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // ResponseValue
+ // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetResponse()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetJsonReference()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of Responses suitable for JSON or YAML export.
+func (m *Responses) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.ResponseCode != nil {
+ for _, item := range m.ResponseCode {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Schema suitable for JSON or YAML export.
+func (m *Schema) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.XRef != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("$ref"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.XRef))
+ }
+ if m.Format != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("format"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Format))
+ }
+ if m.Title != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("title"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Title))
+ }
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.Default != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("default"))
+ info.Content = append(info.Content, m.Default.ToRawInfo())
+ }
+ if m.MultipleOf != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("multipleOf"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.MultipleOf))
+ }
+ if m.Maximum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Maximum))
+ }
+ if m.ExclusiveMaximum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMaximum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMaximum))
+ }
+ if m.Minimum != 0.0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForFloat(m.Minimum))
+ }
+ if m.ExclusiveMinimum != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("exclusiveMinimum"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ExclusiveMinimum))
+ }
+ if m.MaxLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxLength))
+ }
+ if m.MinLength != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minLength"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinLength))
+ }
+ if m.Pattern != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("pattern"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Pattern))
+ }
+ if m.MaxItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxItems))
+ }
+ if m.MinItems != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinItems))
+ }
+ if m.UniqueItems != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("uniqueItems"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.UniqueItems))
+ }
+ if m.MaxProperties != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("maxProperties"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MaxProperties))
+ }
+ if m.MinProperties != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("minProperties"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForInt(m.MinProperties))
+ }
+ if len(m.Required) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("required"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Required))
+ }
+ if len(m.Enum) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Enum {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("enum"))
+ info.Content = append(info.Content, items)
+ }
+ if m.AdditionalProperties != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("additionalProperties"))
+ info.Content = append(info.Content, m.AdditionalProperties.ToRawInfo())
+ }
+ if m.Type != nil {
+ if len(m.Type.Value) == 1 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Type.Value[0]))
+ } else {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("type"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Type.Value))
+ }
+ }
+ if m.Items != nil {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.Items.Schema {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ if len(items.Content) == 1 {
+ items = items.Content[0]
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("items"))
+ info.Content = append(info.Content, items)
+ }
+ if len(m.AllOf) != 0 {
+ items := compiler.NewSequenceNode()
+ for _, item := range m.AllOf {
+ items.Content = append(items.Content, item.ToRawInfo())
+ }
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("allOf"))
+ info.Content = append(info.Content, items)
+ }
+ if m.Properties != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("properties"))
+ info.Content = append(info.Content, m.Properties.ToRawInfo())
+ }
+ if m.Discriminator != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("discriminator"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Discriminator))
+ }
+ if m.ReadOnly != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("readOnly"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.ReadOnly))
+ }
+ if m.Xml != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("xml"))
+ info.Content = append(info.Content, m.Xml.ToRawInfo())
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.Example != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("example"))
+ info.Content = append(info.Content, m.Example.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SchemaItem suitable for JSON or YAML export.
+func (m *SchemaItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // SchemaItem
+ // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetSchema()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetFileSchema()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of SecurityDefinitions suitable for JSON or YAML export.
+func (m *SecurityDefinitions) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of SecurityDefinitionsItem suitable for JSON or YAML export.
+func (m *SecurityDefinitionsItem) ToRawInfo() *yaml.Node {
+ // ONE OF WRAPPER
+ // SecurityDefinitionsItem
+ // {Name:basicAuthenticationSecurity Type:BasicAuthenticationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v0 := m.GetBasicAuthenticationSecurity()
+ if v0 != nil {
+ return v0.ToRawInfo()
+ }
+ // {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v1 := m.GetApiKeySecurity()
+ if v1 != nil {
+ return v1.ToRawInfo()
+ }
+ // {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v2 := m.GetOauth2ImplicitSecurity()
+ if v2 != nil {
+ return v2.ToRawInfo()
+ }
+ // {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v3 := m.GetOauth2PasswordSecurity()
+ if v3 != nil {
+ return v3.ToRawInfo()
+ }
+ // {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v4 := m.GetOauth2ApplicationSecurity()
+ if v4 != nil {
+ return v4.ToRawInfo()
+ }
+ // {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
+ v5 := m.GetOauth2AccessCodeSecurity()
+ if v5 != nil {
+ return v5.ToRawInfo()
+ }
+ return compiler.NewNullNode()
+}
+
+// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export.
+func (m *SecurityRequirement) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of StringArray suitable for JSON or YAML export.
+func (m *StringArray) ToRawInfo() *yaml.Node {
+ return compiler.NewSequenceNodeForStringArray(m.Value)
+}
+
+// ToRawInfo returns a description of Tag suitable for JSON or YAML export.
+func (m *Tag) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ // always include this required field.
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ if m.Description != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("description"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Description))
+ }
+ if m.ExternalDocs != nil {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("externalDocs"))
+ info.Content = append(info.Content, m.ExternalDocs.ToRawInfo())
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of TypeItem suitable for JSON or YAML export.
+func (m *TypeItem) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if len(m.Value) != 0 {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("value"))
+ info.Content = append(info.Content, compiler.NewSequenceNodeForStringArray(m.Value))
+ }
+ return info
+}
+
+// ToRawInfo returns a description of VendorExtension suitable for JSON or YAML export.
+func (m *VendorExtension) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.AdditionalProperties != nil {
+ for _, item := range m.AdditionalProperties {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+// ToRawInfo returns a description of Xml suitable for JSON or YAML export.
+func (m *Xml) ToRawInfo() *yaml.Node {
+ info := compiler.NewMappingNode()
+ if m == nil {
+ return info
+ }
+ if m.Name != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("name"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Name))
+ }
+ if m.Namespace != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("namespace"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Namespace))
+ }
+ if m.Prefix != "" {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("prefix"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(m.Prefix))
+ }
+ if m.Attribute != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("attribute"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Attribute))
+ }
+ if m.Wrapped != false {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString("wrapped"))
+ info.Content = append(info.Content, compiler.NewScalarNodeForBool(m.Wrapped))
+ }
+ if m.VendorExtension != nil {
+ for _, item := range m.VendorExtension {
+ info.Content = append(info.Content, compiler.NewScalarNodeForString(item.Name))
+ info.Content = append(info.Content, item.Value.ToRawInfo())
+ }
+ }
+ return info
+}
+
+var (
+ pattern0 = regexp.MustCompile("^x-")
+ pattern1 = regexp.MustCompile("^/")
+ pattern2 = regexp.MustCompile("^([0-9]{3})$|^(default)$")
+)
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go
new file mode 100644
index 000000000..65c4c913c
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.pb.go
@@ -0,0 +1,7342 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.27.1
+// protoc v3.19.3
+// source: openapiv2/OpenAPIv2.proto
+
+package openapi_v2
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ anypb "google.golang.org/protobuf/types/known/anypb"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type AdditionalPropertiesItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *AdditionalPropertiesItem_Schema
+ // *AdditionalPropertiesItem_Boolean
+ Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *AdditionalPropertiesItem) Reset() {
+ *x = AdditionalPropertiesItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *AdditionalPropertiesItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AdditionalPropertiesItem) ProtoMessage() {}
+
+func (x *AdditionalPropertiesItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AdditionalPropertiesItem.ProtoReflect.Descriptor instead.
+func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{0}
+}
+
+func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *AdditionalPropertiesItem) GetSchema() *Schema {
+ if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Schema); ok {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *AdditionalPropertiesItem) GetBoolean() bool {
+ if x, ok := x.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
+ return x.Boolean
+ }
+ return false
+}
+
+type isAdditionalPropertiesItem_Oneof interface {
+ isAdditionalPropertiesItem_Oneof()
+}
+
+type AdditionalPropertiesItem_Schema struct {
+ Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"`
+}
+
+type AdditionalPropertiesItem_Boolean struct {
+ Boolean bool `protobuf:"varint,2,opt,name=boolean,proto3,oneof"`
+}
+
+func (*AdditionalPropertiesItem_Schema) isAdditionalPropertiesItem_Oneof() {}
+
+func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {}
+
+type Any struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Value *anypb.Any `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
+ Yaml string `protobuf:"bytes,2,opt,name=yaml,proto3" json:"yaml,omitempty"`
+}
+
+func (x *Any) Reset() {
+ *x = Any{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Any) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Any) ProtoMessage() {}
+
+func (x *Any) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Any.ProtoReflect.Descriptor instead.
+func (*Any) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *Any) GetValue() *anypb.Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+func (x *Any) GetYaml() string {
+ if x != nil {
+ return x.Yaml
+ }
+ return ""
+}
+
+type ApiKeySecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"`
+ Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *ApiKeySecurity) Reset() {
+ *x = ApiKeySecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ApiKeySecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ApiKeySecurity) ProtoMessage() {}
+
+func (x *ApiKeySecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ApiKeySecurity.ProtoReflect.Descriptor instead.
+func (*ApiKeySecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *ApiKeySecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *ApiKeySecurity) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *ApiKeySecurity) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *ApiKeySecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *ApiKeySecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type BasicAuthenticationSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *BasicAuthenticationSecurity) Reset() {
+ *x = BasicAuthenticationSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BasicAuthenticationSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BasicAuthenticationSecurity) ProtoMessage() {}
+
+func (x *BasicAuthenticationSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BasicAuthenticationSecurity.ProtoReflect.Descriptor instead.
+func (*BasicAuthenticationSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *BasicAuthenticationSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *BasicAuthenticationSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *BasicAuthenticationSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type BodyParameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"`
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"`
+ Schema *Schema `protobuf:"bytes,5,opt,name=schema,proto3" json:"schema,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *BodyParameter) Reset() {
+ *x = BodyParameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *BodyParameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*BodyParameter) ProtoMessage() {}
+
+func (x *BodyParameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use BodyParameter.ProtoReflect.Descriptor instead.
+func (*BodyParameter) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *BodyParameter) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *BodyParameter) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *BodyParameter) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *BodyParameter) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *BodyParameter) GetSchema() *Schema {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *BodyParameter) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// Contact information for the owners of the API.
+type Contact struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The identifying name of the contact person/organization.
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // The URL pointing to the contact information.
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ // The email address of the contact person/organization.
+ Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Contact) Reset() {
+ *x = Contact{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Contact) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Contact) ProtoMessage() {}
+
+func (x *Contact) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Contact.ProtoReflect.Descriptor instead.
+func (*Contact) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *Contact) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Contact) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *Contact) GetEmail() string {
+ if x != nil {
+ return x.Email
+ }
+ return ""
+}
+
+func (x *Contact) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Default struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Default) Reset() {
+ *x = Default{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Default) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Default) ProtoMessage() {}
+
+func (x *Default) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Default.ProtoReflect.Descriptor instead.
+func (*Default) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *Default) GetAdditionalProperties() []*NamedAny {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// One or more JSON objects describing the schemas being consumed and produced by the API.
+type Definitions struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Definitions) Reset() {
+ *x = Definitions{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Definitions) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Definitions) ProtoMessage() {}
+
+func (x *Definitions) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Definitions.ProtoReflect.Descriptor instead.
+func (*Definitions) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *Definitions) GetAdditionalProperties() []*NamedSchema {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type Document struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The Swagger version of this document.
+ Swagger string `protobuf:"bytes,1,opt,name=swagger,proto3" json:"swagger,omitempty"`
+ Info *Info `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"`
+ // The host (name or ip) of the API. Example: 'swagger.io'
+ Host string `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"`
+ // The base path to the API. Example: '/api'.
+ BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"`
+ // The transfer protocol of the API.
+ Schemes []string `protobuf:"bytes,5,rep,name=schemes,proto3" json:"schemes,omitempty"`
+ // A list of MIME types accepted by the API.
+ Consumes []string `protobuf:"bytes,6,rep,name=consumes,proto3" json:"consumes,omitempty"`
+ // A list of MIME types the API can produce.
+ Produces []string `protobuf:"bytes,7,rep,name=produces,proto3" json:"produces,omitempty"`
+ Paths *Paths `protobuf:"bytes,8,opt,name=paths,proto3" json:"paths,omitempty"`
+ Definitions *Definitions `protobuf:"bytes,9,opt,name=definitions,proto3" json:"definitions,omitempty"`
+ Parameters *ParameterDefinitions `protobuf:"bytes,10,opt,name=parameters,proto3" json:"parameters,omitempty"`
+ Responses *ResponseDefinitions `protobuf:"bytes,11,opt,name=responses,proto3" json:"responses,omitempty"`
+ Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"`
+ SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,13,opt,name=security_definitions,json=securityDefinitions,proto3" json:"security_definitions,omitempty"`
+ Tags []*Tag `protobuf:"bytes,14,rep,name=tags,proto3" json:"tags,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,15,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,16,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Document) Reset() {
+ *x = Document{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Document) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Document) ProtoMessage() {}
+
+func (x *Document) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Document.ProtoReflect.Descriptor instead.
+func (*Document) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *Document) GetSwagger() string {
+ if x != nil {
+ return x.Swagger
+ }
+ return ""
+}
+
+func (x *Document) GetInfo() *Info {
+ if x != nil {
+ return x.Info
+ }
+ return nil
+}
+
+func (x *Document) GetHost() string {
+ if x != nil {
+ return x.Host
+ }
+ return ""
+}
+
+func (x *Document) GetBasePath() string {
+ if x != nil {
+ return x.BasePath
+ }
+ return ""
+}
+
+func (x *Document) GetSchemes() []string {
+ if x != nil {
+ return x.Schemes
+ }
+ return nil
+}
+
+func (x *Document) GetConsumes() []string {
+ if x != nil {
+ return x.Consumes
+ }
+ return nil
+}
+
+func (x *Document) GetProduces() []string {
+ if x != nil {
+ return x.Produces
+ }
+ return nil
+}
+
+func (x *Document) GetPaths() *Paths {
+ if x != nil {
+ return x.Paths
+ }
+ return nil
+}
+
+func (x *Document) GetDefinitions() *Definitions {
+ if x != nil {
+ return x.Definitions
+ }
+ return nil
+}
+
+func (x *Document) GetParameters() *ParameterDefinitions {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *Document) GetResponses() *ResponseDefinitions {
+ if x != nil {
+ return x.Responses
+ }
+ return nil
+}
+
+func (x *Document) GetSecurity() []*SecurityRequirement {
+ if x != nil {
+ return x.Security
+ }
+ return nil
+}
+
+func (x *Document) GetSecurityDefinitions() *SecurityDefinitions {
+ if x != nil {
+ return x.SecurityDefinitions
+ }
+ return nil
+}
+
+func (x *Document) GetTags() []*Tag {
+ if x != nil {
+ return x.Tags
+ }
+ return nil
+}
+
+func (x *Document) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Document) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Examples struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Examples) Reset() {
+ *x = Examples{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Examples) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Examples) ProtoMessage() {}
+
+func (x *Examples) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Examples.ProtoReflect.Descriptor instead.
+func (*Examples) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *Examples) GetAdditionalProperties() []*NamedAny {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// information about external documentation
+type ExternalDocs struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *ExternalDocs) Reset() {
+ *x = ExternalDocs{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExternalDocs) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExternalDocs) ProtoMessage() {}
+
+func (x *ExternalDocs) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExternalDocs.ProtoReflect.Descriptor instead.
+func (*ExternalDocs) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *ExternalDocs) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *ExternalDocs) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *ExternalDocs) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// A deterministic version of a JSON Schema object.
+type FileSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Format string `protobuf:"bytes,1,opt,name=format,proto3" json:"format,omitempty"`
+ Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ Default *Any `protobuf:"bytes,4,opt,name=default,proto3" json:"default,omitempty"`
+ Required []string `protobuf:"bytes,5,rep,name=required,proto3" json:"required,omitempty"`
+ Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
+ ReadOnly bool `protobuf:"varint,7,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ Example *Any `protobuf:"bytes,9,opt,name=example,proto3" json:"example,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *FileSchema) Reset() {
+ *x = FileSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FileSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FileSchema) ProtoMessage() {}
+
+func (x *FileSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FileSchema.ProtoReflect.Descriptor instead.
+func (*FileSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *FileSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *FileSchema) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *FileSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *FileSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *FileSchema) GetRequired() []string {
+ if x != nil {
+ return x.Required
+ }
+ return nil
+}
+
+func (x *FileSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *FileSchema) GetReadOnly() bool {
+ if x != nil {
+ return x.ReadOnly
+ }
+ return false
+}
+
+func (x *FileSchema) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *FileSchema) GetExample() *Any {
+ if x != nil {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *FileSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type FormDataParameterSubSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ // allows sending a parameter by name only or with an empty value.
+ AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"`
+ Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *FormDataParameterSubSchema) Reset() {
+ *x = FormDataParameterSubSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FormDataParameterSubSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FormDataParameterSubSchema) ProtoMessage() {}
+
+func (x *FormDataParameterSubSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FormDataParameterSubSchema.ProtoReflect.Descriptor instead.
+func (*FormDataParameterSubSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *FormDataParameterSubSchema) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetAllowEmptyValue() bool {
+ if x != nil {
+ return x.AllowEmptyValue
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *FormDataParameterSubSchema) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *FormDataParameterSubSchema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *FormDataParameterSubSchema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *FormDataParameterSubSchema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *FormDataParameterSubSchema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *FormDataParameterSubSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Header struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ Description string `protobuf:"bytes,18,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,19,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Header) Reset() {
+ *x = Header{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Header) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Header) ProtoMessage() {}
+
+func (x *Header) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Header.ProtoReflect.Descriptor instead.
+func (*Header) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *Header) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Header) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *Header) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *Header) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *Header) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *Header) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *Header) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *Header) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *Header) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *Header) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *Header) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *Header) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *Header) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *Header) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *Header) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *Header) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *Header) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *Header) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Header) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type HeaderParameterSubSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *HeaderParameterSubSchema) Reset() {
+ *x = HeaderParameterSubSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *HeaderParameterSubSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HeaderParameterSubSchema) ProtoMessage() {}
+
+func (x *HeaderParameterSubSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[14]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HeaderParameterSubSchema.ProtoReflect.Descriptor instead.
+func (*HeaderParameterSubSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *HeaderParameterSubSchema) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *HeaderParameterSubSchema) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *HeaderParameterSubSchema) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *HeaderParameterSubSchema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *HeaderParameterSubSchema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *HeaderParameterSubSchema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *HeaderParameterSubSchema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *HeaderParameterSubSchema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *HeaderParameterSubSchema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *HeaderParameterSubSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Headers struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedHeader `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Headers) Reset() {
+ *x = Headers{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Headers) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Headers) ProtoMessage() {}
+
+func (x *Headers) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[15]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Headers.ProtoReflect.Descriptor instead.
+func (*Headers) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *Headers) GetAdditionalProperties() []*NamedHeader {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+// General information about the API.
+type Info struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // A unique and precise title of the API.
+ Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
+ // A semantic version number of the API.
+ Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
+ // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The terms of service for the API.
+ TermsOfService string `protobuf:"bytes,4,opt,name=terms_of_service,json=termsOfService,proto3" json:"terms_of_service,omitempty"`
+ Contact *Contact `protobuf:"bytes,5,opt,name=contact,proto3" json:"contact,omitempty"`
+ License *License `protobuf:"bytes,6,opt,name=license,proto3" json:"license,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Info) Reset() {
+ *x = Info{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Info) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Info) ProtoMessage() {}
+
+func (x *Info) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[16]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Info.ProtoReflect.Descriptor instead.
+func (*Info) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{16}
+}
+
+func (x *Info) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *Info) GetVersion() string {
+ if x != nil {
+ return x.Version
+ }
+ return ""
+}
+
+func (x *Info) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Info) GetTermsOfService() string {
+ if x != nil {
+ return x.TermsOfService
+ }
+ return ""
+}
+
+func (x *Info) GetContact() *Contact {
+ if x != nil {
+ return x.Contact
+ }
+ return nil
+}
+
+func (x *Info) GetLicense() *License {
+ if x != nil {
+ return x.License
+ }
+ return nil
+}
+
+func (x *Info) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type ItemsItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Schema []*Schema `protobuf:"bytes,1,rep,name=schema,proto3" json:"schema,omitempty"`
+}
+
+func (x *ItemsItem) Reset() {
+ *x = ItemsItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ItemsItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ItemsItem) ProtoMessage() {}
+
+func (x *ItemsItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[17]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ItemsItem.ProtoReflect.Descriptor instead.
+func (*ItemsItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{17}
+}
+
+func (x *ItemsItem) GetSchema() []*Schema {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+type JsonReference struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+}
+
+func (x *JsonReference) Reset() {
+ *x = JsonReference{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *JsonReference) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*JsonReference) ProtoMessage() {}
+
+func (x *JsonReference) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[18]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use JsonReference.ProtoReflect.Descriptor instead.
+func (*JsonReference) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{18}
+}
+
+func (x *JsonReference) GetXRef() string {
+ if x != nil {
+ return x.XRef
+ }
+ return ""
+}
+
+func (x *JsonReference) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+type License struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the license type. It's encouraged to use an OSI compatible license.
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // The URL pointing to the license.
+ Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *License) Reset() {
+ *x = License{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *License) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*License) ProtoMessage() {}
+
+func (x *License) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[19]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use License.ProtoReflect.Descriptor instead.
+func (*License) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{19}
+}
+
+func (x *License) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *License) GetUrl() string {
+ if x != nil {
+ return x.Url
+ }
+ return ""
+}
+
+func (x *License) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
+type NamedAny struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Any `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedAny) Reset() {
+ *x = NamedAny{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedAny) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedAny) ProtoMessage() {}
+
+func (x *NamedAny) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[20]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedAny.ProtoReflect.Descriptor instead.
+func (*NamedAny) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{20}
+}
+
+func (x *NamedAny) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedAny) GetValue() *Any {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs.
+type NamedHeader struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Header `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedHeader) Reset() {
+ *x = NamedHeader{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedHeader) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedHeader) ProtoMessage() {}
+
+func (x *NamedHeader) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[21]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedHeader.ProtoReflect.Descriptor instead.
+func (*NamedHeader) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{21}
+}
+
+func (x *NamedHeader) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedHeader) GetValue() *Header {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs.
+type NamedParameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Parameter `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedParameter) Reset() {
+ *x = NamedParameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedParameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedParameter) ProtoMessage() {}
+
+func (x *NamedParameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[22]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedParameter.ProtoReflect.Descriptor instead.
+func (*NamedParameter) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{22}
+}
+
+func (x *NamedParameter) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedParameter) GetValue() *Parameter {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
+type NamedPathItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *PathItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedPathItem) Reset() {
+ *x = NamedPathItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedPathItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedPathItem) ProtoMessage() {}
+
+func (x *NamedPathItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[23]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedPathItem.ProtoReflect.Descriptor instead.
+func (*NamedPathItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{23}
+}
+
+func (x *NamedPathItem) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedPathItem) GetValue() *PathItem {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs.
+type NamedResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Response `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedResponse) Reset() {
+ *x = NamedResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedResponse) ProtoMessage() {}
+
+func (x *NamedResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[24]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedResponse.ProtoReflect.Descriptor instead.
+func (*NamedResponse) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{24}
+}
+
+func (x *NamedResponse) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedResponse) GetValue() *Response {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs.
+type NamedResponseValue struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *ResponseValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedResponseValue) Reset() {
+ *x = NamedResponseValue{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedResponseValue) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedResponseValue) ProtoMessage() {}
+
+func (x *NamedResponseValue) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[25]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedResponseValue.ProtoReflect.Descriptor instead.
+func (*NamedResponseValue) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{25}
+}
+
+func (x *NamedResponseValue) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedResponseValue) GetValue() *ResponseValue {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs.
+type NamedSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *Schema `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedSchema) Reset() {
+ *x = NamedSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedSchema) ProtoMessage() {}
+
+func (x *NamedSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[26]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedSchema.ProtoReflect.Descriptor instead.
+func (*NamedSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{26}
+}
+
+func (x *NamedSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedSchema) GetValue() *Schema {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs.
+type NamedSecurityDefinitionsItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *SecurityDefinitionsItem `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedSecurityDefinitionsItem) Reset() {
+ *x = NamedSecurityDefinitionsItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedSecurityDefinitionsItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedSecurityDefinitionsItem) ProtoMessage() {}
+
+func (x *NamedSecurityDefinitionsItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[27]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedSecurityDefinitionsItem.ProtoReflect.Descriptor instead.
+func (*NamedSecurityDefinitionsItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{27}
+}
+
+func (x *NamedSecurityDefinitionsItem) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedSecurityDefinitionsItem) GetValue() *SecurityDefinitionsItem {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
+type NamedString struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedString) Reset() {
+ *x = NamedString{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedString) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedString) ProtoMessage() {}
+
+func (x *NamedString) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[28]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedString.ProtoReflect.Descriptor instead.
+func (*NamedString) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{28}
+}
+
+func (x *NamedString) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedString) GetValue() string {
+ if x != nil {
+ return x.Value
+ }
+ return ""
+}
+
+// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
+type NamedStringArray struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Map key
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ // Mapped value
+ Value *StringArray `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *NamedStringArray) Reset() {
+ *x = NamedStringArray{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NamedStringArray) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NamedStringArray) ProtoMessage() {}
+
+func (x *NamedStringArray) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[29]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NamedStringArray.ProtoReflect.Descriptor instead.
+func (*NamedStringArray) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{29}
+}
+
+func (x *NamedStringArray) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *NamedStringArray) GetValue() *StringArray {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+type NonBodyParameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *NonBodyParameter_HeaderParameterSubSchema
+ // *NonBodyParameter_FormDataParameterSubSchema
+ // *NonBodyParameter_QueryParameterSubSchema
+ // *NonBodyParameter_PathParameterSubSchema
+ Oneof isNonBodyParameter_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *NonBodyParameter) Reset() {
+ *x = NonBodyParameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *NonBodyParameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*NonBodyParameter) ProtoMessage() {}
+
+func (x *NonBodyParameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[30]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use NonBodyParameter.ProtoReflect.Descriptor instead.
+func (*NonBodyParameter) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{30}
+}
+
+func (m *NonBodyParameter) GetOneof() isNonBodyParameter_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *NonBodyParameter) GetHeaderParameterSubSchema() *HeaderParameterSubSchema {
+ if x, ok := x.GetOneof().(*NonBodyParameter_HeaderParameterSubSchema); ok {
+ return x.HeaderParameterSubSchema
+ }
+ return nil
+}
+
+func (x *NonBodyParameter) GetFormDataParameterSubSchema() *FormDataParameterSubSchema {
+ if x, ok := x.GetOneof().(*NonBodyParameter_FormDataParameterSubSchema); ok {
+ return x.FormDataParameterSubSchema
+ }
+ return nil
+}
+
+func (x *NonBodyParameter) GetQueryParameterSubSchema() *QueryParameterSubSchema {
+ if x, ok := x.GetOneof().(*NonBodyParameter_QueryParameterSubSchema); ok {
+ return x.QueryParameterSubSchema
+ }
+ return nil
+}
+
+func (x *NonBodyParameter) GetPathParameterSubSchema() *PathParameterSubSchema {
+ if x, ok := x.GetOneof().(*NonBodyParameter_PathParameterSubSchema); ok {
+ return x.PathParameterSubSchema
+ }
+ return nil
+}
+
+type isNonBodyParameter_Oneof interface {
+ isNonBodyParameter_Oneof()
+}
+
+type NonBodyParameter_HeaderParameterSubSchema struct {
+ HeaderParameterSubSchema *HeaderParameterSubSchema `protobuf:"bytes,1,opt,name=header_parameter_sub_schema,json=headerParameterSubSchema,proto3,oneof"`
+}
+
+type NonBodyParameter_FormDataParameterSubSchema struct {
+ FormDataParameterSubSchema *FormDataParameterSubSchema `protobuf:"bytes,2,opt,name=form_data_parameter_sub_schema,json=formDataParameterSubSchema,proto3,oneof"`
+}
+
+type NonBodyParameter_QueryParameterSubSchema struct {
+ QueryParameterSubSchema *QueryParameterSubSchema `protobuf:"bytes,3,opt,name=query_parameter_sub_schema,json=queryParameterSubSchema,proto3,oneof"`
+}
+
+type NonBodyParameter_PathParameterSubSchema struct {
+ PathParameterSubSchema *PathParameterSubSchema `protobuf:"bytes,4,opt,name=path_parameter_sub_schema,json=pathParameterSubSchema,proto3,oneof"`
+}
+
+func (*NonBodyParameter_HeaderParameterSubSchema) isNonBodyParameter_Oneof() {}
+
+func (*NonBodyParameter_FormDataParameterSubSchema) isNonBodyParameter_Oneof() {}
+
+func (*NonBodyParameter_QueryParameterSubSchema) isNonBodyParameter_Oneof() {}
+
+func (*NonBodyParameter_PathParameterSubSchema) isNonBodyParameter_Oneof() {}
+
+type Oauth2AccessCodeSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
+ Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"`
+ TokenUrl string `protobuf:"bytes,5,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"`
+ Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Oauth2AccessCodeSecurity) Reset() {
+ *x = Oauth2AccessCodeSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2AccessCodeSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2AccessCodeSecurity) ProtoMessage() {}
+
+func (x *Oauth2AccessCodeSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[31]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2AccessCodeSecurity.ProtoReflect.Descriptor instead.
+func (*Oauth2AccessCodeSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{31}
+}
+
+func (x *Oauth2AccessCodeSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetFlow() string {
+ if x != nil {
+ return x.Flow
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetScopes() *Oauth2Scopes {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *Oauth2AccessCodeSecurity) GetAuthorizationUrl() string {
+ if x != nil {
+ return x.AuthorizationUrl
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetTokenUrl() string {
+ if x != nil {
+ return x.TokenUrl
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Oauth2AccessCodeSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Oauth2ApplicationSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
+ Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"`
+ Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Oauth2ApplicationSecurity) Reset() {
+ *x = Oauth2ApplicationSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2ApplicationSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2ApplicationSecurity) ProtoMessage() {}
+
+func (x *Oauth2ApplicationSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[32]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2ApplicationSecurity.ProtoReflect.Descriptor instead.
+func (*Oauth2ApplicationSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{32}
+}
+
+func (x *Oauth2ApplicationSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Oauth2ApplicationSecurity) GetFlow() string {
+ if x != nil {
+ return x.Flow
+ }
+ return ""
+}
+
+func (x *Oauth2ApplicationSecurity) GetScopes() *Oauth2Scopes {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *Oauth2ApplicationSecurity) GetTokenUrl() string {
+ if x != nil {
+ return x.TokenUrl
+ }
+ return ""
+}
+
+func (x *Oauth2ApplicationSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Oauth2ApplicationSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Oauth2ImplicitSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
+ Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl,proto3" json:"authorization_url,omitempty"`
+ Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Oauth2ImplicitSecurity) Reset() {
+ *x = Oauth2ImplicitSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2ImplicitSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2ImplicitSecurity) ProtoMessage() {}
+
+func (x *Oauth2ImplicitSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[33]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2ImplicitSecurity.ProtoReflect.Descriptor instead.
+func (*Oauth2ImplicitSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{33}
+}
+
+func (x *Oauth2ImplicitSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Oauth2ImplicitSecurity) GetFlow() string {
+ if x != nil {
+ return x.Flow
+ }
+ return ""
+}
+
+func (x *Oauth2ImplicitSecurity) GetScopes() *Oauth2Scopes {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *Oauth2ImplicitSecurity) GetAuthorizationUrl() string {
+ if x != nil {
+ return x.AuthorizationUrl
+ }
+ return ""
+}
+
+func (x *Oauth2ImplicitSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Oauth2ImplicitSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Oauth2PasswordSecurity struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
+ Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes,proto3" json:"scopes,omitempty"`
+ TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl,proto3" json:"token_url,omitempty"`
+ Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Oauth2PasswordSecurity) Reset() {
+ *x = Oauth2PasswordSecurity{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2PasswordSecurity) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2PasswordSecurity) ProtoMessage() {}
+
+func (x *Oauth2PasswordSecurity) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[34]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2PasswordSecurity.ProtoReflect.Descriptor instead.
+func (*Oauth2PasswordSecurity) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{34}
+}
+
+func (x *Oauth2PasswordSecurity) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *Oauth2PasswordSecurity) GetFlow() string {
+ if x != nil {
+ return x.Flow
+ }
+ return ""
+}
+
+func (x *Oauth2PasswordSecurity) GetScopes() *Oauth2Scopes {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
+func (x *Oauth2PasswordSecurity) GetTokenUrl() string {
+ if x != nil {
+ return x.TokenUrl
+ }
+ return ""
+}
+
+func (x *Oauth2PasswordSecurity) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Oauth2PasswordSecurity) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Oauth2Scopes struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Oauth2Scopes) Reset() {
+ *x = Oauth2Scopes{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Oauth2Scopes) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Oauth2Scopes) ProtoMessage() {}
+
+func (x *Oauth2Scopes) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[35]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Oauth2Scopes.ProtoReflect.Descriptor instead.
+func (*Oauth2Scopes) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{35}
+}
+
+func (x *Oauth2Scopes) GetAdditionalProperties() []*NamedString {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type Operation struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Tags []string `protobuf:"bytes,1,rep,name=tags,proto3" json:"tags,omitempty"`
+ // A brief summary of the operation.
+ Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"`
+ // A longer description of the operation, GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ // A unique identifier of the operation.
+ OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId,proto3" json:"operation_id,omitempty"`
+ // A list of MIME types the API can produce.
+ Produces []string `protobuf:"bytes,6,rep,name=produces,proto3" json:"produces,omitempty"`
+ // A list of MIME types the API can consume.
+ Consumes []string `protobuf:"bytes,7,rep,name=consumes,proto3" json:"consumes,omitempty"`
+ // The parameters needed to send a valid API call.
+ Parameters []*ParametersItem `protobuf:"bytes,8,rep,name=parameters,proto3" json:"parameters,omitempty"`
+ Responses *Responses `protobuf:"bytes,9,opt,name=responses,proto3" json:"responses,omitempty"`
+ // The transfer protocol of the API.
+ Schemes []string `protobuf:"bytes,10,rep,name=schemes,proto3" json:"schemes,omitempty"`
+ Deprecated bool `protobuf:"varint,11,opt,name=deprecated,proto3" json:"deprecated,omitempty"`
+ Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security,proto3" json:"security,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,13,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Operation) Reset() {
+ *x = Operation{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Operation) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Operation) ProtoMessage() {}
+
+func (x *Operation) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[36]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Operation.ProtoReflect.Descriptor instead.
+func (*Operation) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{36}
+}
+
+func (x *Operation) GetTags() []string {
+ if x != nil {
+ return x.Tags
+ }
+ return nil
+}
+
+func (x *Operation) GetSummary() string {
+ if x != nil {
+ return x.Summary
+ }
+ return ""
+}
+
+func (x *Operation) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Operation) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Operation) GetOperationId() string {
+ if x != nil {
+ return x.OperationId
+ }
+ return ""
+}
+
+func (x *Operation) GetProduces() []string {
+ if x != nil {
+ return x.Produces
+ }
+ return nil
+}
+
+func (x *Operation) GetConsumes() []string {
+ if x != nil {
+ return x.Consumes
+ }
+ return nil
+}
+
+func (x *Operation) GetParameters() []*ParametersItem {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *Operation) GetResponses() *Responses {
+ if x != nil {
+ return x.Responses
+ }
+ return nil
+}
+
+func (x *Operation) GetSchemes() []string {
+ if x != nil {
+ return x.Schemes
+ }
+ return nil
+}
+
+func (x *Operation) GetDeprecated() bool {
+ if x != nil {
+ return x.Deprecated
+ }
+ return false
+}
+
+func (x *Operation) GetSecurity() []*SecurityRequirement {
+ if x != nil {
+ return x.Security
+ }
+ return nil
+}
+
+func (x *Operation) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Parameter struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *Parameter_BodyParameter
+ // *Parameter_NonBodyParameter
+ Oneof isParameter_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *Parameter) Reset() {
+ *x = Parameter{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Parameter) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Parameter) ProtoMessage() {}
+
+func (x *Parameter) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[37]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Parameter.ProtoReflect.Descriptor instead.
+func (*Parameter) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{37}
+}
+
+func (m *Parameter) GetOneof() isParameter_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *Parameter) GetBodyParameter() *BodyParameter {
+ if x, ok := x.GetOneof().(*Parameter_BodyParameter); ok {
+ return x.BodyParameter
+ }
+ return nil
+}
+
+func (x *Parameter) GetNonBodyParameter() *NonBodyParameter {
+ if x, ok := x.GetOneof().(*Parameter_NonBodyParameter); ok {
+ return x.NonBodyParameter
+ }
+ return nil
+}
+
+type isParameter_Oneof interface {
+ isParameter_Oneof()
+}
+
+type Parameter_BodyParameter struct {
+ BodyParameter *BodyParameter `protobuf:"bytes,1,opt,name=body_parameter,json=bodyParameter,proto3,oneof"`
+}
+
+type Parameter_NonBodyParameter struct {
+ NonBodyParameter *NonBodyParameter `protobuf:"bytes,2,opt,name=non_body_parameter,json=nonBodyParameter,proto3,oneof"`
+}
+
+func (*Parameter_BodyParameter) isParameter_Oneof() {}
+
+func (*Parameter_NonBodyParameter) isParameter_Oneof() {}
+
+// One or more JSON representations for parameters
+type ParameterDefinitions struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedParameter `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *ParameterDefinitions) Reset() {
+ *x = ParameterDefinitions{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParameterDefinitions) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParameterDefinitions) ProtoMessage() {}
+
+func (x *ParameterDefinitions) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[38]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ParameterDefinitions.ProtoReflect.Descriptor instead.
+func (*ParameterDefinitions) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{38}
+}
+
+func (x *ParameterDefinitions) GetAdditionalProperties() []*NamedParameter {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type ParametersItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *ParametersItem_Parameter
+ // *ParametersItem_JsonReference
+ Oneof isParametersItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *ParametersItem) Reset() {
+ *x = ParametersItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ParametersItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ParametersItem) ProtoMessage() {}
+
+func (x *ParametersItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[39]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ParametersItem.ProtoReflect.Descriptor instead.
+func (*ParametersItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{39}
+}
+
+func (m *ParametersItem) GetOneof() isParametersItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *ParametersItem) GetParameter() *Parameter {
+ if x, ok := x.GetOneof().(*ParametersItem_Parameter); ok {
+ return x.Parameter
+ }
+ return nil
+}
+
+func (x *ParametersItem) GetJsonReference() *JsonReference {
+ if x, ok := x.GetOneof().(*ParametersItem_JsonReference); ok {
+ return x.JsonReference
+ }
+ return nil
+}
+
+type isParametersItem_Oneof interface {
+ isParametersItem_Oneof()
+}
+
+type ParametersItem_Parameter struct {
+ Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,proto3,oneof"`
+}
+
+type ParametersItem_JsonReference struct {
+ JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"`
+}
+
+func (*ParametersItem_Parameter) isParametersItem_Oneof() {}
+
+func (*ParametersItem_JsonReference) isParametersItem_Oneof() {}
+
+type PathItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"`
+ Get *Operation `protobuf:"bytes,2,opt,name=get,proto3" json:"get,omitempty"`
+ Put *Operation `protobuf:"bytes,3,opt,name=put,proto3" json:"put,omitempty"`
+ Post *Operation `protobuf:"bytes,4,opt,name=post,proto3" json:"post,omitempty"`
+ Delete *Operation `protobuf:"bytes,5,opt,name=delete,proto3" json:"delete,omitempty"`
+ Options *Operation `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"`
+ Head *Operation `protobuf:"bytes,7,opt,name=head,proto3" json:"head,omitempty"`
+ Patch *Operation `protobuf:"bytes,8,opt,name=patch,proto3" json:"patch,omitempty"`
+ // The parameters needed to send a valid API call.
+ Parameters []*ParametersItem `protobuf:"bytes,9,rep,name=parameters,proto3" json:"parameters,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *PathItem) Reset() {
+ *x = PathItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PathItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PathItem) ProtoMessage() {}
+
+func (x *PathItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[40]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PathItem.ProtoReflect.Descriptor instead.
+func (*PathItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{40}
+}
+
+func (x *PathItem) GetXRef() string {
+ if x != nil {
+ return x.XRef
+ }
+ return ""
+}
+
+func (x *PathItem) GetGet() *Operation {
+ if x != nil {
+ return x.Get
+ }
+ return nil
+}
+
+func (x *PathItem) GetPut() *Operation {
+ if x != nil {
+ return x.Put
+ }
+ return nil
+}
+
+func (x *PathItem) GetPost() *Operation {
+ if x != nil {
+ return x.Post
+ }
+ return nil
+}
+
+func (x *PathItem) GetDelete() *Operation {
+ if x != nil {
+ return x.Delete
+ }
+ return nil
+}
+
+func (x *PathItem) GetOptions() *Operation {
+ if x != nil {
+ return x.Options
+ }
+ return nil
+}
+
+func (x *PathItem) GetHead() *Operation {
+ if x != nil {
+ return x.Head
+ }
+ return nil
+}
+
+func (x *PathItem) GetPatch() *Operation {
+ if x != nil {
+ return x.Patch
+ }
+ return nil
+}
+
+func (x *PathItem) GetParameters() []*ParametersItem {
+ if x != nil {
+ return x.Parameters
+ }
+ return nil
+}
+
+func (x *PathItem) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type PathParameterSubSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,6,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,9,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,10,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,12,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,16,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *PathParameterSubSchema) Reset() {
+ *x = PathParameterSubSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PathParameterSubSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PathParameterSubSchema) ProtoMessage() {}
+
+func (x *PathParameterSubSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[41]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PathParameterSubSchema.ProtoReflect.Descriptor instead.
+func (*PathParameterSubSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{41}
+}
+
+func (x *PathParameterSubSchema) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *PathParameterSubSchema) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *PathParameterSubSchema) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *PathParameterSubSchema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *PathParameterSubSchema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *PathParameterSubSchema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *PathParameterSubSchema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *PathParameterSubSchema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *PathParameterSubSchema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *PathParameterSubSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// Relative paths to the individual endpoints. They must be relative to the 'basePath'.
+type Paths struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ VendorExtension []*NamedAny `protobuf:"bytes,1,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+ Path []*NamedPathItem `protobuf:"bytes,2,rep,name=path,proto3" json:"path,omitempty"`
+}
+
+func (x *Paths) Reset() {
+ *x = Paths{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Paths) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Paths) ProtoMessage() {}
+
+func (x *Paths) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[42]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Paths.ProtoReflect.Descriptor instead.
+func (*Paths) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{42}
+}
+
+func (x *Paths) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+func (x *Paths) GetPath() []*NamedPathItem {
+ if x != nil {
+ return x.Path
+ }
+ return nil
+}
+
+type PrimitivesItems struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,6,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,8,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,12,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,16,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,18,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *PrimitivesItems) Reset() {
+ *x = PrimitivesItems{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PrimitivesItems) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PrimitivesItems) ProtoMessage() {}
+
+func (x *PrimitivesItems) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[43]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PrimitivesItems.ProtoReflect.Descriptor instead.
+func (*PrimitivesItems) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{43}
+}
+
+func (x *PrimitivesItems) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *PrimitivesItems) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *PrimitivesItems) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *PrimitivesItems) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *PrimitivesItems) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *PrimitivesItems) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *PrimitivesItems) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *PrimitivesItems) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *PrimitivesItems) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *PrimitivesItems) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *PrimitivesItems) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *PrimitivesItems) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Properties struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *Properties) Reset() {
+ *x = Properties{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Properties) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Properties) ProtoMessage() {}
+
+func (x *Properties) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[44]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Properties.ProtoReflect.Descriptor instead.
+func (*Properties) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{44}
+}
+
+func (x *Properties) GetAdditionalProperties() []*NamedSchema {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type QueryParameterSubSchema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Determines whether or not this parameter is required or optional.
+ Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
+ // Determines the location of the parameter.
+ In string `protobuf:"bytes,2,opt,name=in,proto3" json:"in,omitempty"`
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
+ // The name of the parameter.
+ Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
+ // allows sending a parameter by name only or with an empty value.
+ AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue,proto3" json:"allow_empty_value,omitempty"`
+ Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
+ Format string `protobuf:"bytes,7,opt,name=format,proto3" json:"format,omitempty"`
+ Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items,proto3" json:"items,omitempty"`
+ CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat,proto3" json:"collection_format,omitempty"`
+ Default *Any `protobuf:"bytes,10,opt,name=default,proto3" json:"default,omitempty"`
+ Maximum float64 `protobuf:"fixed64,11,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,13,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,17,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ Enum []*Any `protobuf:"bytes,21,rep,name=enum,proto3" json:"enum,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *QueryParameterSubSchema) Reset() {
+ *x = QueryParameterSubSchema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *QueryParameterSubSchema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*QueryParameterSubSchema) ProtoMessage() {}
+
+func (x *QueryParameterSubSchema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[45]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use QueryParameterSubSchema.ProtoReflect.Descriptor instead.
+func (*QueryParameterSubSchema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{45}
+}
+
+func (x *QueryParameterSubSchema) GetRequired() bool {
+ if x != nil {
+ return x.Required
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetIn() string {
+ if x != nil {
+ return x.In
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetAllowEmptyValue() bool {
+ if x != nil {
+ return x.AllowEmptyValue
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetType() string {
+ if x != nil {
+ return x.Type
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetItems() *PrimitivesItems {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *QueryParameterSubSchema) GetCollectionFormat() string {
+ if x != nil {
+ return x.CollectionFormat
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *QueryParameterSubSchema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *QueryParameterSubSchema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *QueryParameterSubSchema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *QueryParameterSubSchema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *QueryParameterSubSchema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type Response struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"`
+ Schema *SchemaItem `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"`
+ Headers *Headers `protobuf:"bytes,3,opt,name=headers,proto3" json:"headers,omitempty"`
+ Examples *Examples `protobuf:"bytes,4,opt,name=examples,proto3" json:"examples,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Response) Reset() {
+ *x = Response{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Response) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Response) ProtoMessage() {}
+
+func (x *Response) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[46]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Response.ProtoReflect.Descriptor instead.
+func (*Response) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{46}
+}
+
+func (x *Response) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Response) GetSchema() *SchemaItem {
+ if x != nil {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *Response) GetHeaders() *Headers {
+ if x != nil {
+ return x.Headers
+ }
+ return nil
+}
+
+func (x *Response) GetExamples() *Examples {
+ if x != nil {
+ return x.Examples
+ }
+ return nil
+}
+
+func (x *Response) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// One or more JSON representations for responses
+type ResponseDefinitions struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedResponse `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *ResponseDefinitions) Reset() {
+ *x = ResponseDefinitions{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ResponseDefinitions) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ResponseDefinitions) ProtoMessage() {}
+
+func (x *ResponseDefinitions) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[47]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ResponseDefinitions.ProtoReflect.Descriptor instead.
+func (*ResponseDefinitions) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{47}
+}
+
+func (x *ResponseDefinitions) GetAdditionalProperties() []*NamedResponse {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type ResponseValue struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *ResponseValue_Response
+ // *ResponseValue_JsonReference
+ Oneof isResponseValue_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *ResponseValue) Reset() {
+ *x = ResponseValue{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ResponseValue) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ResponseValue) ProtoMessage() {}
+
+func (x *ResponseValue) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[48]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ResponseValue.ProtoReflect.Descriptor instead.
+func (*ResponseValue) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{48}
+}
+
+func (m *ResponseValue) GetOneof() isResponseValue_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *ResponseValue) GetResponse() *Response {
+ if x, ok := x.GetOneof().(*ResponseValue_Response); ok {
+ return x.Response
+ }
+ return nil
+}
+
+func (x *ResponseValue) GetJsonReference() *JsonReference {
+ if x, ok := x.GetOneof().(*ResponseValue_JsonReference); ok {
+ return x.JsonReference
+ }
+ return nil
+}
+
+type isResponseValue_Oneof interface {
+ isResponseValue_Oneof()
+}
+
+type ResponseValue_Response struct {
+ Response *Response `protobuf:"bytes,1,opt,name=response,proto3,oneof"`
+}
+
+type ResponseValue_JsonReference struct {
+ JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,proto3,oneof"`
+}
+
+func (*ResponseValue_Response) isResponseValue_Oneof() {}
+
+func (*ResponseValue_JsonReference) isResponseValue_Oneof() {}
+
+// Response objects names can either be any valid HTTP status code or 'default'.
+type Responses struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ResponseCode []*NamedResponseValue `protobuf:"bytes,1,rep,name=response_code,json=responseCode,proto3" json:"response_code,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,2,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Responses) Reset() {
+ *x = Responses{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Responses) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Responses) ProtoMessage() {}
+
+func (x *Responses) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[49]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Responses.ProtoReflect.Descriptor instead.
+func (*Responses) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{49}
+}
+
+func (x *Responses) GetResponseCode() []*NamedResponseValue {
+ if x != nil {
+ return x.ResponseCode
+ }
+ return nil
+}
+
+func (x *Responses) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+// A deterministic version of a JSON Schema object.
+type Schema struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref,proto3" json:"_ref,omitempty"`
+ Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"`
+ Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
+ Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
+ Default *Any `protobuf:"bytes,5,opt,name=default,proto3" json:"default,omitempty"`
+ MultipleOf float64 `protobuf:"fixed64,6,opt,name=multiple_of,json=multipleOf,proto3" json:"multiple_of,omitempty"`
+ Maximum float64 `protobuf:"fixed64,7,opt,name=maximum,proto3" json:"maximum,omitempty"`
+ ExclusiveMaximum bool `protobuf:"varint,8,opt,name=exclusive_maximum,json=exclusiveMaximum,proto3" json:"exclusive_maximum,omitempty"`
+ Minimum float64 `protobuf:"fixed64,9,opt,name=minimum,proto3" json:"minimum,omitempty"`
+ ExclusiveMinimum bool `protobuf:"varint,10,opt,name=exclusive_minimum,json=exclusiveMinimum,proto3" json:"exclusive_minimum,omitempty"`
+ MaxLength int64 `protobuf:"varint,11,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
+ MinLength int64 `protobuf:"varint,12,opt,name=min_length,json=minLength,proto3" json:"min_length,omitempty"`
+ Pattern string `protobuf:"bytes,13,opt,name=pattern,proto3" json:"pattern,omitempty"`
+ MaxItems int64 `protobuf:"varint,14,opt,name=max_items,json=maxItems,proto3" json:"max_items,omitempty"`
+ MinItems int64 `protobuf:"varint,15,opt,name=min_items,json=minItems,proto3" json:"min_items,omitempty"`
+ UniqueItems bool `protobuf:"varint,16,opt,name=unique_items,json=uniqueItems,proto3" json:"unique_items,omitempty"`
+ MaxProperties int64 `protobuf:"varint,17,opt,name=max_properties,json=maxProperties,proto3" json:"max_properties,omitempty"`
+ MinProperties int64 `protobuf:"varint,18,opt,name=min_properties,json=minProperties,proto3" json:"min_properties,omitempty"`
+ Required []string `protobuf:"bytes,19,rep,name=required,proto3" json:"required,omitempty"`
+ Enum []*Any `protobuf:"bytes,20,rep,name=enum,proto3" json:"enum,omitempty"`
+ AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,21,opt,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+ Type *TypeItem `protobuf:"bytes,22,opt,name=type,proto3" json:"type,omitempty"`
+ Items *ItemsItem `protobuf:"bytes,23,opt,name=items,proto3" json:"items,omitempty"`
+ AllOf []*Schema `protobuf:"bytes,24,rep,name=all_of,json=allOf,proto3" json:"all_of,omitempty"`
+ Properties *Properties `protobuf:"bytes,25,opt,name=properties,proto3" json:"properties,omitempty"`
+ Discriminator string `protobuf:"bytes,26,opt,name=discriminator,proto3" json:"discriminator,omitempty"`
+ ReadOnly bool `protobuf:"varint,27,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"`
+ Xml *Xml `protobuf:"bytes,28,opt,name=xml,proto3" json:"xml,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,29,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ Example *Any `protobuf:"bytes,30,opt,name=example,proto3" json:"example,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,31,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Schema) Reset() {
+ *x = Schema{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Schema) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Schema) ProtoMessage() {}
+
+func (x *Schema) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[50]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Schema.ProtoReflect.Descriptor instead.
+func (*Schema) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{50}
+}
+
+func (x *Schema) GetXRef() string {
+ if x != nil {
+ return x.XRef
+ }
+ return ""
+}
+
+func (x *Schema) GetFormat() string {
+ if x != nil {
+ return x.Format
+ }
+ return ""
+}
+
+func (x *Schema) GetTitle() string {
+ if x != nil {
+ return x.Title
+ }
+ return ""
+}
+
+func (x *Schema) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Schema) GetDefault() *Any {
+ if x != nil {
+ return x.Default
+ }
+ return nil
+}
+
+func (x *Schema) GetMultipleOf() float64 {
+ if x != nil {
+ return x.MultipleOf
+ }
+ return 0
+}
+
+func (x *Schema) GetMaximum() float64 {
+ if x != nil {
+ return x.Maximum
+ }
+ return 0
+}
+
+func (x *Schema) GetExclusiveMaximum() bool {
+ if x != nil {
+ return x.ExclusiveMaximum
+ }
+ return false
+}
+
+func (x *Schema) GetMinimum() float64 {
+ if x != nil {
+ return x.Minimum
+ }
+ return 0
+}
+
+func (x *Schema) GetExclusiveMinimum() bool {
+ if x != nil {
+ return x.ExclusiveMinimum
+ }
+ return false
+}
+
+func (x *Schema) GetMaxLength() int64 {
+ if x != nil {
+ return x.MaxLength
+ }
+ return 0
+}
+
+func (x *Schema) GetMinLength() int64 {
+ if x != nil {
+ return x.MinLength
+ }
+ return 0
+}
+
+func (x *Schema) GetPattern() string {
+ if x != nil {
+ return x.Pattern
+ }
+ return ""
+}
+
+func (x *Schema) GetMaxItems() int64 {
+ if x != nil {
+ return x.MaxItems
+ }
+ return 0
+}
+
+func (x *Schema) GetMinItems() int64 {
+ if x != nil {
+ return x.MinItems
+ }
+ return 0
+}
+
+func (x *Schema) GetUniqueItems() bool {
+ if x != nil {
+ return x.UniqueItems
+ }
+ return false
+}
+
+func (x *Schema) GetMaxProperties() int64 {
+ if x != nil {
+ return x.MaxProperties
+ }
+ return 0
+}
+
+func (x *Schema) GetMinProperties() int64 {
+ if x != nil {
+ return x.MinProperties
+ }
+ return 0
+}
+
+func (x *Schema) GetRequired() []string {
+ if x != nil {
+ return x.Required
+ }
+ return nil
+}
+
+func (x *Schema) GetEnum() []*Any {
+ if x != nil {
+ return x.Enum
+ }
+ return nil
+}
+
+func (x *Schema) GetAdditionalProperties() *AdditionalPropertiesItem {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+func (x *Schema) GetType() *TypeItem {
+ if x != nil {
+ return x.Type
+ }
+ return nil
+}
+
+func (x *Schema) GetItems() *ItemsItem {
+ if x != nil {
+ return x.Items
+ }
+ return nil
+}
+
+func (x *Schema) GetAllOf() []*Schema {
+ if x != nil {
+ return x.AllOf
+ }
+ return nil
+}
+
+func (x *Schema) GetProperties() *Properties {
+ if x != nil {
+ return x.Properties
+ }
+ return nil
+}
+
+func (x *Schema) GetDiscriminator() string {
+ if x != nil {
+ return x.Discriminator
+ }
+ return ""
+}
+
+func (x *Schema) GetReadOnly() bool {
+ if x != nil {
+ return x.ReadOnly
+ }
+ return false
+}
+
+func (x *Schema) GetXml() *Xml {
+ if x != nil {
+ return x.Xml
+ }
+ return nil
+}
+
+func (x *Schema) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Schema) GetExample() *Any {
+ if x != nil {
+ return x.Example
+ }
+ return nil
+}
+
+func (x *Schema) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type SchemaItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *SchemaItem_Schema
+ // *SchemaItem_FileSchema
+ Oneof isSchemaItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *SchemaItem) Reset() {
+ *x = SchemaItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SchemaItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SchemaItem) ProtoMessage() {}
+
+func (x *SchemaItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[51]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SchemaItem.ProtoReflect.Descriptor instead.
+func (*SchemaItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{51}
+}
+
+func (m *SchemaItem) GetOneof() isSchemaItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *SchemaItem) GetSchema() *Schema {
+ if x, ok := x.GetOneof().(*SchemaItem_Schema); ok {
+ return x.Schema
+ }
+ return nil
+}
+
+func (x *SchemaItem) GetFileSchema() *FileSchema {
+ if x, ok := x.GetOneof().(*SchemaItem_FileSchema); ok {
+ return x.FileSchema
+ }
+ return nil
+}
+
+type isSchemaItem_Oneof interface {
+ isSchemaItem_Oneof()
+}
+
+type SchemaItem_Schema struct {
+ Schema *Schema `protobuf:"bytes,1,opt,name=schema,proto3,oneof"`
+}
+
+type SchemaItem_FileSchema struct {
+ FileSchema *FileSchema `protobuf:"bytes,2,opt,name=file_schema,json=fileSchema,proto3,oneof"`
+}
+
+func (*SchemaItem_Schema) isSchemaItem_Oneof() {}
+
+func (*SchemaItem_FileSchema) isSchemaItem_Oneof() {}
+
+type SecurityDefinitions struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedSecurityDefinitionsItem `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *SecurityDefinitions) Reset() {
+ *x = SecurityDefinitions{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecurityDefinitions) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecurityDefinitions) ProtoMessage() {}
+
+func (x *SecurityDefinitions) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[52]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecurityDefinitions.ProtoReflect.Descriptor instead.
+func (*SecurityDefinitions) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{52}
+}
+
+func (x *SecurityDefinitions) GetAdditionalProperties() []*NamedSecurityDefinitionsItem {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type SecurityDefinitionsItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Types that are assignable to Oneof:
+ // *SecurityDefinitionsItem_BasicAuthenticationSecurity
+ // *SecurityDefinitionsItem_ApiKeySecurity
+ // *SecurityDefinitionsItem_Oauth2ImplicitSecurity
+ // *SecurityDefinitionsItem_Oauth2PasswordSecurity
+ // *SecurityDefinitionsItem_Oauth2ApplicationSecurity
+ // *SecurityDefinitionsItem_Oauth2AccessCodeSecurity
+ Oneof isSecurityDefinitionsItem_Oneof `protobuf_oneof:"oneof"`
+}
+
+func (x *SecurityDefinitionsItem) Reset() {
+ *x = SecurityDefinitionsItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecurityDefinitionsItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecurityDefinitionsItem) ProtoMessage() {}
+
+func (x *SecurityDefinitionsItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[53]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecurityDefinitionsItem.ProtoReflect.Descriptor instead.
+func (*SecurityDefinitionsItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{53}
+}
+
+func (m *SecurityDefinitionsItem) GetOneof() isSecurityDefinitionsItem_Oneof {
+ if m != nil {
+ return m.Oneof
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetBasicAuthenticationSecurity() *BasicAuthenticationSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_BasicAuthenticationSecurity); ok {
+ return x.BasicAuthenticationSecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetApiKeySecurity() *ApiKeySecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_ApiKeySecurity); ok {
+ return x.ApiKeySecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetOauth2ImplicitSecurity() *Oauth2ImplicitSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ImplicitSecurity); ok {
+ return x.Oauth2ImplicitSecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetOauth2PasswordSecurity() *Oauth2PasswordSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2PasswordSecurity); ok {
+ return x.Oauth2PasswordSecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetOauth2ApplicationSecurity() *Oauth2ApplicationSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2ApplicationSecurity); ok {
+ return x.Oauth2ApplicationSecurity
+ }
+ return nil
+}
+
+func (x *SecurityDefinitionsItem) GetOauth2AccessCodeSecurity() *Oauth2AccessCodeSecurity {
+ if x, ok := x.GetOneof().(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity); ok {
+ return x.Oauth2AccessCodeSecurity
+ }
+ return nil
+}
+
+type isSecurityDefinitionsItem_Oneof interface {
+ isSecurityDefinitionsItem_Oneof()
+}
+
+type SecurityDefinitionsItem_BasicAuthenticationSecurity struct {
+ BasicAuthenticationSecurity *BasicAuthenticationSecurity `protobuf:"bytes,1,opt,name=basic_authentication_security,json=basicAuthenticationSecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_ApiKeySecurity struct {
+ ApiKeySecurity *ApiKeySecurity `protobuf:"bytes,2,opt,name=api_key_security,json=apiKeySecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_Oauth2ImplicitSecurity struct {
+ Oauth2ImplicitSecurity *Oauth2ImplicitSecurity `protobuf:"bytes,3,opt,name=oauth2_implicit_security,json=oauth2ImplicitSecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_Oauth2PasswordSecurity struct {
+ Oauth2PasswordSecurity *Oauth2PasswordSecurity `protobuf:"bytes,4,opt,name=oauth2_password_security,json=oauth2PasswordSecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_Oauth2ApplicationSecurity struct {
+ Oauth2ApplicationSecurity *Oauth2ApplicationSecurity `protobuf:"bytes,5,opt,name=oauth2_application_security,json=oauth2ApplicationSecurity,proto3,oneof"`
+}
+
+type SecurityDefinitionsItem_Oauth2AccessCodeSecurity struct {
+ Oauth2AccessCodeSecurity *Oauth2AccessCodeSecurity `protobuf:"bytes,6,opt,name=oauth2_access_code_security,json=oauth2AccessCodeSecurity,proto3,oneof"`
+}
+
+func (*SecurityDefinitionsItem_BasicAuthenticationSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_ApiKeySecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_Oauth2ImplicitSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_Oauth2PasswordSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_Oauth2ApplicationSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+func (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) isSecurityDefinitionsItem_Oneof() {}
+
+type SecurityRequirement struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *SecurityRequirement) Reset() {
+ *x = SecurityRequirement{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecurityRequirement) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecurityRequirement) ProtoMessage() {}
+
+func (x *SecurityRequirement) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[54]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecurityRequirement.ProtoReflect.Descriptor instead.
+func (*SecurityRequirement) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{54}
+}
+
+func (x *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type StringArray struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *StringArray) Reset() {
+ *x = StringArray{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *StringArray) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*StringArray) ProtoMessage() {}
+
+func (x *StringArray) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[55]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use StringArray.ProtoReflect.Descriptor instead.
+func (*StringArray) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{55}
+}
+
+func (x *StringArray) GetValue() []string {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+type Tag struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
+ ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs,proto3" json:"external_docs,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Tag) Reset() {
+ *x = Tag{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Tag) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Tag) ProtoMessage() {}
+
+func (x *Tag) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[56]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Tag.ProtoReflect.Descriptor instead.
+func (*Tag) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{56}
+}
+
+func (x *Tag) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Tag) GetDescription() string {
+ if x != nil {
+ return x.Description
+ }
+ return ""
+}
+
+func (x *Tag) GetExternalDocs() *ExternalDocs {
+ if x != nil {
+ return x.ExternalDocs
+ }
+ return nil
+}
+
+func (x *Tag) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+type TypeItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *TypeItem) Reset() {
+ *x = TypeItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *TypeItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TypeItem) ProtoMessage() {}
+
+func (x *TypeItem) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[57]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TypeItem.ProtoReflect.Descriptor instead.
+func (*TypeItem) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{57}
+}
+
+func (x *TypeItem) GetValue() []string {
+ if x != nil {
+ return x.Value
+ }
+ return nil
+}
+
+// Any property starting with x- is valid.
+type VendorExtension struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties,proto3" json:"additional_properties,omitempty"`
+}
+
+func (x *VendorExtension) Reset() {
+ *x = VendorExtension{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *VendorExtension) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*VendorExtension) ProtoMessage() {}
+
+func (x *VendorExtension) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[58]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use VendorExtension.ProtoReflect.Descriptor instead.
+func (*VendorExtension) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{58}
+}
+
+func (x *VendorExtension) GetAdditionalProperties() []*NamedAny {
+ if x != nil {
+ return x.AdditionalProperties
+ }
+ return nil
+}
+
+type Xml struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
+ Prefix string `protobuf:"bytes,3,opt,name=prefix,proto3" json:"prefix,omitempty"`
+ Attribute bool `protobuf:"varint,4,opt,name=attribute,proto3" json:"attribute,omitempty"`
+ Wrapped bool `protobuf:"varint,5,opt,name=wrapped,proto3" json:"wrapped,omitempty"`
+ VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension,proto3" json:"vendor_extension,omitempty"`
+}
+
+func (x *Xml) Reset() {
+ *x = Xml{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Xml) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Xml) ProtoMessage() {}
+
+func (x *Xml) ProtoReflect() protoreflect.Message {
+ mi := &file_openapiv2_OpenAPIv2_proto_msgTypes[59]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Xml.ProtoReflect.Descriptor instead.
+func (*Xml) Descriptor() ([]byte, []int) {
+ return file_openapiv2_OpenAPIv2_proto_rawDescGZIP(), []int{59}
+}
+
+func (x *Xml) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+func (x *Xml) GetNamespace() string {
+ if x != nil {
+ return x.Namespace
+ }
+ return ""
+}
+
+func (x *Xml) GetPrefix() string {
+ if x != nil {
+ return x.Prefix
+ }
+ return ""
+}
+
+func (x *Xml) GetAttribute() bool {
+ if x != nil {
+ return x.Attribute
+ }
+ return false
+}
+
+func (x *Xml) GetWrapped() bool {
+ if x != nil {
+ return x.Wrapped
+ }
+ return false
+}
+
+func (x *Xml) GetVendorExtension() []*NamedAny {
+ if x != nil {
+ return x.VendorExtension
+ }
+ return nil
+}
+
+var File_openapiv2_OpenAPIv2_proto protoreflect.FileDescriptor
+
+var file_openapiv2_OpenAPIv2_proto_rawDesc = []byte{
+ 0x0a, 0x19, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x4f, 0x70, 0x65, 0x6e,
+ 0x41, 0x50, 0x49, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c,
+ 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65,
+ 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x07,
+ 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52,
+ 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f,
+ 0x66, 0x22, 0x45, 0x0a, 0x03, 0x41, 0x6e, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x79, 0x61, 0x6d, 0x6c, 0x22, 0xab, 0x01, 0x0a, 0x0e, 0x41, 0x70, 0x69,
+ 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74,
+ 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
+ 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f,
+ 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x94, 0x01, 0x0a, 0x1b, 0x42, 0x61, 0x73, 0x69, 0x63,
+ 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65,
+ 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65,
+ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10,
+ 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65,
+ 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xde, 0x01,
+ 0x0a, 0x0d, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
+ 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65,
+ 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3f, 0x0a,
+ 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x86,
+ 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10,
+ 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c,
+ 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72,
+ 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x54, 0x0a, 0x07, 0x44, 0x65, 0x66, 0x61, 0x75,
+ 0x6c, 0x74, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x5b, 0x0a,
+ 0x0b, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4c, 0x0a, 0x15,
+ 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xe8, 0x05, 0x0a, 0x08, 0x44,
+ 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67,
+ 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65,
+ 0x72, 0x12, 0x24, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x10, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x66,
+ 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x62,
+ 0x61, 0x73, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+ 0x62, 0x61, 0x73, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65,
+ 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d,
+ 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x06,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x1a,
+ 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61,
+ 0x74, 0x68, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x73, 0x52, 0x05, 0x70, 0x61,
+ 0x74, 0x68, 0x73, 0x12, 0x39, 0x0a, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x52, 0x0b, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x40,
+ 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73,
+ 0x12, 0x3d, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x0b, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x12,
+ 0x3b, 0x0a, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53,
+ 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65,
+ 0x6e, 0x74, 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x52, 0x0a, 0x14,
+ 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
+ 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x13, 0x73, 0x65, 0x63,
+ 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73,
+ 0x12, 0x23, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x67, 0x52,
+ 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61,
+ 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e,
+ 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
+ 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65,
+ 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65,
+ 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x55, 0x0a, 0x08, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65,
+ 0x73, 0x12, 0x49, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x83, 0x01, 0x0a,
+ 0x0c, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x20, 0x0a,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+ 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72,
+ 0x6c, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0xff, 0x02, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74,
+ 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08,
+ 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
+ 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09,
+ 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74,
+ 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78,
+ 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d,
+ 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xab, 0x06, 0x0a, 0x1a, 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74,
+ 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12,
+ 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65,
+ 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75,
+ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18,
+ 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a,
+ 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74,
+ 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
+ 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c,
+ 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69,
+ 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d,
+ 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f,
+ 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12,
+ 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01,
+ 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d,
+ 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65,
+ 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c,
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e,
+ 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65,
+ 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18,
+ 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b,
+ 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d,
+ 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
+ 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71,
+ 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
+ 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65,
+ 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d,
+ 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18,
+ 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f,
+ 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0xab, 0x05, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70,
+ 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73,
+ 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11,
+ 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61,
+ 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
+ 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66,
+ 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66,
+ 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18,
+ 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b,
+ 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69,
+ 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75,
+ 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d,
+ 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69,
+ 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69,
+ 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d,
+ 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68,
+ 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74,
+ 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18,
+ 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68,
+ 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61,
+ 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d,
+ 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69,
+ 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49,
+ 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69,
+ 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71,
+ 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18,
+ 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b,
+ 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x11, 0x20, 0x01, 0x28,
+ 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x20, 0x0a,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+ 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x18, 0x13, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52,
+ 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x22, 0xfd, 0x05, 0x0a, 0x18, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a,
+ 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
+ 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
+ 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x06, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69,
+ 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76,
+ 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b,
+ 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72,
+ 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64,
+ 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64,
+ 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75,
+ 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d,
+ 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61,
+ 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a,
+ 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07,
+ 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75,
+ 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0d, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e,
+ 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67,
+ 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e,
+ 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74,
+ 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67,
+ 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x10, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09,
+ 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52,
+ 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e,
+ 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69,
+ 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65,
+ 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e,
+ 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75,
+ 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f,
+ 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x15, 0x20,
+ 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12,
+ 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
+ 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52,
+ 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x22, 0x57, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x15, 0x61,
+ 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72,
+ 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65, 0x61,
+ 0x64, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa1, 0x02, 0x0a, 0x04, 0x49, 0x6e,
+ 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73,
+ 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
+ 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x5f, 0x6f, 0x66,
+ 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e,
+ 0x74, 0x65, 0x72, 0x6d, 0x73, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d,
+ 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x6f, 0x6e,
+ 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x2d, 0x0a,
+ 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x63, 0x65,
+ 0x6e, 0x73, 0x65, 0x52, 0x07, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x10,
+ 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e,
+ 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65,
+ 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x37, 0x0a,
+ 0x09, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x22, 0x44, 0x0a, 0x0d, 0x4a, 0x73, 0x6f, 0x6e, 0x52, 0x65,
+ 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65,
+ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x70, 0x0a, 0x07,
+ 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75,
+ 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x3f, 0x0a,
+ 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x45,
+ 0x0a, 0x08, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25,
+ 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x48, 0x65,
+ 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x22, 0x51, 0x0a, 0x0e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x05,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61,
+ 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61,
+ 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52,
+ 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x4f, 0x0a, 0x0d, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x59, 0x0a, 0x12, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x22, 0x4b, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
+ 0x6d, 0x0a, 0x1c, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
+ 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x37,
+ 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x55, 0x0a, 0x10, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x72, 0x69,
+ 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb5,
+ 0x03, 0x0a, 0x10, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65,
+ 0x74, 0x65, 0x72, 0x12, 0x65, 0x0a, 0x1b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x61,
+ 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65,
+ 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61,
+ 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00,
+ 0x52, 0x18, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x6c, 0x0a, 0x1e, 0x66, 0x6f,
+ 0x72, 0x6d, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x46, 0x6f, 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x1a, 0x66, 0x6f,
+ 0x72, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53,
+ 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x62, 0x0a, 0x1a, 0x71, 0x75, 0x65, 0x72,
+ 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73, 0x75, 0x62, 0x5f,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50,
+ 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x48, 0x00, 0x52, 0x17, 0x71, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65,
+ 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x5f, 0x0a, 0x19,
+ 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x73,
+ 0x75, 0x62, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x74,
+ 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x16, 0x70, 0x61, 0x74, 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x42, 0x07, 0x0a,
+ 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xa1, 0x02, 0x0a, 0x18, 0x4f, 0x61, 0x75, 0x74, 0x68,
+ 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73,
+ 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53,
+ 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a,
+ 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75,
+ 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
+ 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f,
+ 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74,
+ 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
+ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf5, 0x01, 0x0a, 0x19, 0x4f,
+ 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
+ 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04,
+ 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77,
+ 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61,
+ 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70,
+ 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12,
+ 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
+ 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0x82, 0x02, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70,
+ 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70,
+ 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x52,
+ 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x75, 0x74, 0x68, 0x6f,
+ 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x10, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72,
+ 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf2, 0x01, 0x0a, 0x16, 0x4f, 0x61, 0x75, 0x74,
+ 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69,
+ 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x63,
+ 0x6f, 0x70, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63,
+ 0x6f, 0x70, 0x65, 0x73, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09,
+ 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
+ 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3f, 0x0a, 0x10, 0x76,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18,
+ 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5c, 0x0a, 0x0c,
+ 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x53, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x15,
+ 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74,
+ 0x72, 0x69, 0x6e, 0x67, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c,
+ 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x9e, 0x04, 0x0a, 0x09, 0x4f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73,
+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07,
+ 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
+ 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74,
+ 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72,
+ 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x70, 0x65, 0x72, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d,
+ 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d,
+ 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73,
+ 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74,
+ 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x33,
+ 0x0a, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x18, 0x0a,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x73, 0x12, 0x1e, 0x0a,
+ 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28,
+ 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3b, 0x0a,
+ 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x1f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x65, 0x63,
+ 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74,
+ 0x52, 0x08, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65,
+ 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64,
+ 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xa6, 0x01, 0x0a, 0x09,
+ 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x62, 0x6f, 0x64,
+ 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x42,
+ 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0d,
+ 0x62, 0x6f, 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x4c, 0x0a,
+ 0x12, 0x6e, 0x6f, 0x6e, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65,
+ 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x6f, 0x6e, 0x42, 0x6f, 0x64, 0x79, 0x50, 0x61,
+ 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x10, 0x6e, 0x6f, 0x6e, 0x42, 0x6f,
+ 0x64, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x42, 0x07, 0x0a, 0x05, 0x6f,
+ 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x67, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4f, 0x0a, 0x15,
+ 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61,
+ 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f,
+ 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x94, 0x01,
+ 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d,
+ 0x12, 0x35, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x09, 0x70, 0x61,
+ 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f,
+ 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f,
+ 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73,
+ 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f,
+ 0x6e, 0x65, 0x6f, 0x66, 0x22, 0xcf, 0x03, 0x0a, 0x08, 0x50, 0x61, 0x74, 0x68, 0x49, 0x74, 0x65,
+ 0x6d, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x03, 0x52, 0x65, 0x66, 0x12, 0x27, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a,
+ 0x03, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65,
+ 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x18, 0x04,
+ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x70, 0x6f, 0x73,
+ 0x74, 0x12, 0x2d, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65,
+ 0x12, 0x2f, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f,
+ 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x12, 0x29, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65,
+ 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x2b, 0x0a, 0x05,
+ 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x3a, 0x0a, 0x0a, 0x70, 0x61, 0x72,
+ 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d,
+ 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f,
+ 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74,
+ 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfb, 0x05, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x68, 0x50,
+ 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a,
+ 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a,
+ 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61,
+ 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12,
+ 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d,
+ 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
+ 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63,
+ 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12,
+ 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e,
+ 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61,
+ 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78,
+ 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76,
+ 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75,
+ 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01,
+ 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d,
+ 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76,
+ 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f,
+ 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61,
+ 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c,
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e,
+ 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72,
+ 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e,
+ 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x11, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a,
+ 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03,
+ 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e,
+ 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a,
+ 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e,
+ 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f,
+ 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c,
+ 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x3f, 0x0a,
+ 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
+ 0x6e, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d,
+ 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50,
+ 0x61, 0x74, 0x68, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x92, 0x05,
+ 0x0a, 0x0f, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d,
+ 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a,
+ 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f,
+ 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74,
+ 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
+ 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66,
+ 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c,
+ 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
+ 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52,
+ 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69,
+ 0x6d, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d,
+ 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f,
+ 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65,
+ 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12,
+ 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01,
+ 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d,
+ 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65,
+ 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c,
+ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e,
+ 0x67, 0x74, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65,
+ 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18,
+ 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b,
+ 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d,
+ 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
+ 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71,
+ 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
+ 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65,
+ 0x6e, 0x75, 0x6d, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d,
+ 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18,
+ 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f,
+ 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65,
+ 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e,
+ 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
+ 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73,
+ 0x12, 0x4c, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x17, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d,
+ 0x65, 0x64, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69,
+ 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xa8,
+ 0x06, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
+ 0x72, 0x53, 0x75, 0x62, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65,
+ 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65,
+ 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x02, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11,
+ 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x45, 0x6d,
+ 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06,
+ 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f,
+ 0x72, 0x6d, 0x61, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x08, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x73,
+ 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x6f, 0x6c, 0x6c, 0x65,
+ 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f,
+ 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18,
+ 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12,
+ 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x01,
+ 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0c,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d,
+ 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75,
+ 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d,
+ 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x69,
+ 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63,
+ 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x1d, 0x0a,
+ 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0f, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1d, 0x0a, 0x0a,
+ 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03,
+ 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70,
+ 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61,
+ 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x49, 0x74, 0x65,
+ 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18,
+ 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12,
+ 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18,
+ 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x49, 0x74, 0x65,
+ 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x15, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e,
+ 0x79, 0x52, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69,
+ 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66, 0x18, 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75,
+ 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x4f, 0x66, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64,
+ 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x17, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72,
+ 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xfe, 0x01, 0x0a, 0x08, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
+ 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73,
+ 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65,
+ 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d,
+ 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x2d, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64,
+ 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x52, 0x07,
+ 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70,
+ 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x52,
+ 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x65, 0x0a, 0x13, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x12, 0x4e, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x14, 0x61, 0x64, 0x64,
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65,
+ 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61,
+ 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0e, 0x6a, 0x73, 0x6f, 0x6e, 0x5f,
+ 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x19, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4a, 0x73, 0x6f,
+ 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6a, 0x73,
+ 0x6f, 0x6e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x6f,
+ 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x91, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x73, 0x12, 0x43, 0x0a, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63,
+ 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e,
+ 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45,
+ 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xaf, 0x09, 0x0a, 0x06, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x12, 0x11, 0x0a, 0x04, 0x5f, 0x72, 0x65, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x03, 0x52, 0x65, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x14,
+ 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74,
+ 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
+ 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
+ 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
+ 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x66,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65,
+ 0x4f, 0x66, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x07, 0x20,
+ 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11,
+ 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x69, 0x6d, 0x75,
+ 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69,
+ 0x76, 0x65, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e,
+ 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x69,
+ 0x6d, 0x75, 0x6d, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65,
+ 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10,
+ 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d,
+ 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0b,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12,
+ 0x1d, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0c, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x18,
+ 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f,
+ 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x61, 0x78,
+ 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x49, 0x74, 0x65,
+ 0x6d, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65,
+ 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x72, 0x6f,
+ 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d,
+ 0x61, 0x78, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x0e,
+ 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x12,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74,
+ 0x69, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18,
+ 0x13, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12,
+ 0x23, 0x0a, 0x04, 0x65, 0x6e, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x04,
+ 0x65, 0x6e, 0x75, 0x6d, 0x12, 0x59, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x15, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x41, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65,
+ 0x72, 0x74, 0x69, 0x65, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12,
+ 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x49,
+ 0x74, 0x65, 0x6d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, 0x65,
+ 0x6d, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52,
+ 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x29, 0x0a, 0x06, 0x61, 0x6c, 0x6c, 0x5f, 0x6f, 0x66,
+ 0x18, 0x18, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x4f,
+ 0x66, 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18,
+ 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x0a, 0x70,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x69, 0x73,
+ 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0d, 0x64, 0x69, 0x73, 0x63, 0x72, 0x69, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12,
+ 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x1b, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x21, 0x0a, 0x03,
+ 0x78, 0x6d, 0x6c, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x58, 0x6d, 0x6c, 0x52, 0x03, 0x78, 0x6d, 0x6c, 0x12,
+ 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73,
+ 0x18, 0x1d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73,
+ 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x29,
+ 0x0a, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x0f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x41, 0x6e, 0x79,
+ 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e,
+ 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x1f, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f,
+ 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x7e, 0x0a, 0x0a, 0x53, 0x63,
+ 0x68, 0x65, 0x6d, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x2c, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65,
+ 0x6d, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x06,
+ 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x39, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73,
+ 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6f, 0x70,
+ 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68,
+ 0x65, 0x6d, 0x61, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d,
+ 0x61, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x74, 0x0a, 0x13, 0x53, 0x65,
+ 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e,
+ 0x73, 0x12, 0x5d, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f,
+ 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x28, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61,
+ 0x6d, 0x65, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66, 0x69, 0x6e,
+ 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69,
+ 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73,
+ 0x22, 0xe9, 0x04, 0x0a, 0x17, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x66,
+ 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x6d, 0x0a, 0x1d,
+ 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32,
+ 0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x1b,
+ 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x10, 0x61,
+ 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x41, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74,
+ 0x79, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x69, 0x6d,
+ 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69,
+ 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75,
+ 0x74, 0x68, 0x32, 0x49, 0x6d, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x12, 0x5e, 0x0a, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x70, 0x61,
+ 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e,
+ 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,
+ 0x64, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x61, 0x75,
+ 0x74, 0x68, 0x32, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x1b, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x70,
+ 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69,
+ 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61,
+ 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c,
+ 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48,
+ 0x00, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x12, 0x65, 0x0a, 0x1b,
+ 0x6f, 0x61, 0x75, 0x74, 0x68, 0x32, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x6f,
+ 0x64, 0x65, 0x5f, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4f,
+ 0x61, 0x75, 0x74, 0x68, 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53,
+ 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x18, 0x6f, 0x61, 0x75, 0x74, 0x68,
+ 0x32, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72,
+ 0x69, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x6f, 0x6e, 0x65, 0x6f, 0x66, 0x22, 0x68, 0x0a, 0x13,
+ 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x6d,
+ 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61,
+ 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x72, 0x61, 0x79,
+ 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x70,
+ 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0x23, 0x0a, 0x0b, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
+ 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xbb, 0x01, 0x0a, 0x03,
+ 0x54, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
+ 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x0d, 0x65, 0x78, 0x74,
+ 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x63, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x18, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x45, 0x78,
+ 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x52, 0x0c, 0x65, 0x78, 0x74, 0x65,
+ 0x72, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64,
+ 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e,
+ 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72,
+ 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x0a, 0x08, 0x54, 0x79, 0x70,
+ 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x5c, 0x0a, 0x0f, 0x56,
+ 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49,
+ 0x0a, 0x15, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f,
+ 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x14, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50,
+ 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x22, 0xc8, 0x01, 0x0a, 0x03, 0x58, 0x6d,
+ 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
+ 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70,
+ 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61,
+ 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
+ 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x61,
+ 0x70, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70,
+ 0x70, 0x65, 0x64, 0x12, 0x3f, 0x0a, 0x10, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x5f, 0x65, 0x78,
+ 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64,
+ 0x41, 0x6e, 0x79, 0x52, 0x0f, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x6e,
+ 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x3e, 0x0a, 0x0e, 0x6f, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x65, 0x6e,
+ 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x42, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x50, 0x49, 0x50,
+ 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x16, 0x2e, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
+ 0x69, 0x76, 0x32, 0x3b, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0xa2, 0x02,
+ 0x03, 0x4f, 0x41, 0x53, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_openapiv2_OpenAPIv2_proto_rawDescOnce sync.Once
+ file_openapiv2_OpenAPIv2_proto_rawDescData = file_openapiv2_OpenAPIv2_proto_rawDesc
+)
+
+func file_openapiv2_OpenAPIv2_proto_rawDescGZIP() []byte {
+ file_openapiv2_OpenAPIv2_proto_rawDescOnce.Do(func() {
+ file_openapiv2_OpenAPIv2_proto_rawDescData = protoimpl.X.CompressGZIP(file_openapiv2_OpenAPIv2_proto_rawDescData)
+ })
+ return file_openapiv2_OpenAPIv2_proto_rawDescData
+}
+
+var file_openapiv2_OpenAPIv2_proto_msgTypes = make([]protoimpl.MessageInfo, 60)
+var file_openapiv2_OpenAPIv2_proto_goTypes = []interface{}{
+ (*AdditionalPropertiesItem)(nil), // 0: openapi.v2.AdditionalPropertiesItem
+ (*Any)(nil), // 1: openapi.v2.Any
+ (*ApiKeySecurity)(nil), // 2: openapi.v2.ApiKeySecurity
+ (*BasicAuthenticationSecurity)(nil), // 3: openapi.v2.BasicAuthenticationSecurity
+ (*BodyParameter)(nil), // 4: openapi.v2.BodyParameter
+ (*Contact)(nil), // 5: openapi.v2.Contact
+ (*Default)(nil), // 6: openapi.v2.Default
+ (*Definitions)(nil), // 7: openapi.v2.Definitions
+ (*Document)(nil), // 8: openapi.v2.Document
+ (*Examples)(nil), // 9: openapi.v2.Examples
+ (*ExternalDocs)(nil), // 10: openapi.v2.ExternalDocs
+ (*FileSchema)(nil), // 11: openapi.v2.FileSchema
+ (*FormDataParameterSubSchema)(nil), // 12: openapi.v2.FormDataParameterSubSchema
+ (*Header)(nil), // 13: openapi.v2.Header
+ (*HeaderParameterSubSchema)(nil), // 14: openapi.v2.HeaderParameterSubSchema
+ (*Headers)(nil), // 15: openapi.v2.Headers
+ (*Info)(nil), // 16: openapi.v2.Info
+ (*ItemsItem)(nil), // 17: openapi.v2.ItemsItem
+ (*JsonReference)(nil), // 18: openapi.v2.JsonReference
+ (*License)(nil), // 19: openapi.v2.License
+ (*NamedAny)(nil), // 20: openapi.v2.NamedAny
+ (*NamedHeader)(nil), // 21: openapi.v2.NamedHeader
+ (*NamedParameter)(nil), // 22: openapi.v2.NamedParameter
+ (*NamedPathItem)(nil), // 23: openapi.v2.NamedPathItem
+ (*NamedResponse)(nil), // 24: openapi.v2.NamedResponse
+ (*NamedResponseValue)(nil), // 25: openapi.v2.NamedResponseValue
+ (*NamedSchema)(nil), // 26: openapi.v2.NamedSchema
+ (*NamedSecurityDefinitionsItem)(nil), // 27: openapi.v2.NamedSecurityDefinitionsItem
+ (*NamedString)(nil), // 28: openapi.v2.NamedString
+ (*NamedStringArray)(nil), // 29: openapi.v2.NamedStringArray
+ (*NonBodyParameter)(nil), // 30: openapi.v2.NonBodyParameter
+ (*Oauth2AccessCodeSecurity)(nil), // 31: openapi.v2.Oauth2AccessCodeSecurity
+ (*Oauth2ApplicationSecurity)(nil), // 32: openapi.v2.Oauth2ApplicationSecurity
+ (*Oauth2ImplicitSecurity)(nil), // 33: openapi.v2.Oauth2ImplicitSecurity
+ (*Oauth2PasswordSecurity)(nil), // 34: openapi.v2.Oauth2PasswordSecurity
+ (*Oauth2Scopes)(nil), // 35: openapi.v2.Oauth2Scopes
+ (*Operation)(nil), // 36: openapi.v2.Operation
+ (*Parameter)(nil), // 37: openapi.v2.Parameter
+ (*ParameterDefinitions)(nil), // 38: openapi.v2.ParameterDefinitions
+ (*ParametersItem)(nil), // 39: openapi.v2.ParametersItem
+ (*PathItem)(nil), // 40: openapi.v2.PathItem
+ (*PathParameterSubSchema)(nil), // 41: openapi.v2.PathParameterSubSchema
+ (*Paths)(nil), // 42: openapi.v2.Paths
+ (*PrimitivesItems)(nil), // 43: openapi.v2.PrimitivesItems
+ (*Properties)(nil), // 44: openapi.v2.Properties
+ (*QueryParameterSubSchema)(nil), // 45: openapi.v2.QueryParameterSubSchema
+ (*Response)(nil), // 46: openapi.v2.Response
+ (*ResponseDefinitions)(nil), // 47: openapi.v2.ResponseDefinitions
+ (*ResponseValue)(nil), // 48: openapi.v2.ResponseValue
+ (*Responses)(nil), // 49: openapi.v2.Responses
+ (*Schema)(nil), // 50: openapi.v2.Schema
+ (*SchemaItem)(nil), // 51: openapi.v2.SchemaItem
+ (*SecurityDefinitions)(nil), // 52: openapi.v2.SecurityDefinitions
+ (*SecurityDefinitionsItem)(nil), // 53: openapi.v2.SecurityDefinitionsItem
+ (*SecurityRequirement)(nil), // 54: openapi.v2.SecurityRequirement
+ (*StringArray)(nil), // 55: openapi.v2.StringArray
+ (*Tag)(nil), // 56: openapi.v2.Tag
+ (*TypeItem)(nil), // 57: openapi.v2.TypeItem
+ (*VendorExtension)(nil), // 58: openapi.v2.VendorExtension
+ (*Xml)(nil), // 59: openapi.v2.Xml
+ (*anypb.Any)(nil), // 60: google.protobuf.Any
+}
+var file_openapiv2_OpenAPIv2_proto_depIdxs = []int32{
+ 50, // 0: openapi.v2.AdditionalPropertiesItem.schema:type_name -> openapi.v2.Schema
+ 60, // 1: openapi.v2.Any.value:type_name -> google.protobuf.Any
+ 20, // 2: openapi.v2.ApiKeySecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 3: openapi.v2.BasicAuthenticationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 50, // 4: openapi.v2.BodyParameter.schema:type_name -> openapi.v2.Schema
+ 20, // 5: openapi.v2.BodyParameter.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 6: openapi.v2.Contact.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 7: openapi.v2.Default.additional_properties:type_name -> openapi.v2.NamedAny
+ 26, // 8: openapi.v2.Definitions.additional_properties:type_name -> openapi.v2.NamedSchema
+ 16, // 9: openapi.v2.Document.info:type_name -> openapi.v2.Info
+ 42, // 10: openapi.v2.Document.paths:type_name -> openapi.v2.Paths
+ 7, // 11: openapi.v2.Document.definitions:type_name -> openapi.v2.Definitions
+ 38, // 12: openapi.v2.Document.parameters:type_name -> openapi.v2.ParameterDefinitions
+ 47, // 13: openapi.v2.Document.responses:type_name -> openapi.v2.ResponseDefinitions
+ 54, // 14: openapi.v2.Document.security:type_name -> openapi.v2.SecurityRequirement
+ 52, // 15: openapi.v2.Document.security_definitions:type_name -> openapi.v2.SecurityDefinitions
+ 56, // 16: openapi.v2.Document.tags:type_name -> openapi.v2.Tag
+ 10, // 17: openapi.v2.Document.external_docs:type_name -> openapi.v2.ExternalDocs
+ 20, // 18: openapi.v2.Document.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 19: openapi.v2.Examples.additional_properties:type_name -> openapi.v2.NamedAny
+ 20, // 20: openapi.v2.ExternalDocs.vendor_extension:type_name -> openapi.v2.NamedAny
+ 1, // 21: openapi.v2.FileSchema.default:type_name -> openapi.v2.Any
+ 10, // 22: openapi.v2.FileSchema.external_docs:type_name -> openapi.v2.ExternalDocs
+ 1, // 23: openapi.v2.FileSchema.example:type_name -> openapi.v2.Any
+ 20, // 24: openapi.v2.FileSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 43, // 25: openapi.v2.FormDataParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 26: openapi.v2.FormDataParameterSubSchema.default:type_name -> openapi.v2.Any
+ 1, // 27: openapi.v2.FormDataParameterSubSchema.enum:type_name -> openapi.v2.Any
+ 20, // 28: openapi.v2.FormDataParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 43, // 29: openapi.v2.Header.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 30: openapi.v2.Header.default:type_name -> openapi.v2.Any
+ 1, // 31: openapi.v2.Header.enum:type_name -> openapi.v2.Any
+ 20, // 32: openapi.v2.Header.vendor_extension:type_name -> openapi.v2.NamedAny
+ 43, // 33: openapi.v2.HeaderParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 34: openapi.v2.HeaderParameterSubSchema.default:type_name -> openapi.v2.Any
+ 1, // 35: openapi.v2.HeaderParameterSubSchema.enum:type_name -> openapi.v2.Any
+ 20, // 36: openapi.v2.HeaderParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 21, // 37: openapi.v2.Headers.additional_properties:type_name -> openapi.v2.NamedHeader
+ 5, // 38: openapi.v2.Info.contact:type_name -> openapi.v2.Contact
+ 19, // 39: openapi.v2.Info.license:type_name -> openapi.v2.License
+ 20, // 40: openapi.v2.Info.vendor_extension:type_name -> openapi.v2.NamedAny
+ 50, // 41: openapi.v2.ItemsItem.schema:type_name -> openapi.v2.Schema
+ 20, // 42: openapi.v2.License.vendor_extension:type_name -> openapi.v2.NamedAny
+ 1, // 43: openapi.v2.NamedAny.value:type_name -> openapi.v2.Any
+ 13, // 44: openapi.v2.NamedHeader.value:type_name -> openapi.v2.Header
+ 37, // 45: openapi.v2.NamedParameter.value:type_name -> openapi.v2.Parameter
+ 40, // 46: openapi.v2.NamedPathItem.value:type_name -> openapi.v2.PathItem
+ 46, // 47: openapi.v2.NamedResponse.value:type_name -> openapi.v2.Response
+ 48, // 48: openapi.v2.NamedResponseValue.value:type_name -> openapi.v2.ResponseValue
+ 50, // 49: openapi.v2.NamedSchema.value:type_name -> openapi.v2.Schema
+ 53, // 50: openapi.v2.NamedSecurityDefinitionsItem.value:type_name -> openapi.v2.SecurityDefinitionsItem
+ 55, // 51: openapi.v2.NamedStringArray.value:type_name -> openapi.v2.StringArray
+ 14, // 52: openapi.v2.NonBodyParameter.header_parameter_sub_schema:type_name -> openapi.v2.HeaderParameterSubSchema
+ 12, // 53: openapi.v2.NonBodyParameter.form_data_parameter_sub_schema:type_name -> openapi.v2.FormDataParameterSubSchema
+ 45, // 54: openapi.v2.NonBodyParameter.query_parameter_sub_schema:type_name -> openapi.v2.QueryParameterSubSchema
+ 41, // 55: openapi.v2.NonBodyParameter.path_parameter_sub_schema:type_name -> openapi.v2.PathParameterSubSchema
+ 35, // 56: openapi.v2.Oauth2AccessCodeSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes
+ 20, // 57: openapi.v2.Oauth2AccessCodeSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 35, // 58: openapi.v2.Oauth2ApplicationSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes
+ 20, // 59: openapi.v2.Oauth2ApplicationSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 35, // 60: openapi.v2.Oauth2ImplicitSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes
+ 20, // 61: openapi.v2.Oauth2ImplicitSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 35, // 62: openapi.v2.Oauth2PasswordSecurity.scopes:type_name -> openapi.v2.Oauth2Scopes
+ 20, // 63: openapi.v2.Oauth2PasswordSecurity.vendor_extension:type_name -> openapi.v2.NamedAny
+ 28, // 64: openapi.v2.Oauth2Scopes.additional_properties:type_name -> openapi.v2.NamedString
+ 10, // 65: openapi.v2.Operation.external_docs:type_name -> openapi.v2.ExternalDocs
+ 39, // 66: openapi.v2.Operation.parameters:type_name -> openapi.v2.ParametersItem
+ 49, // 67: openapi.v2.Operation.responses:type_name -> openapi.v2.Responses
+ 54, // 68: openapi.v2.Operation.security:type_name -> openapi.v2.SecurityRequirement
+ 20, // 69: openapi.v2.Operation.vendor_extension:type_name -> openapi.v2.NamedAny
+ 4, // 70: openapi.v2.Parameter.body_parameter:type_name -> openapi.v2.BodyParameter
+ 30, // 71: openapi.v2.Parameter.non_body_parameter:type_name -> openapi.v2.NonBodyParameter
+ 22, // 72: openapi.v2.ParameterDefinitions.additional_properties:type_name -> openapi.v2.NamedParameter
+ 37, // 73: openapi.v2.ParametersItem.parameter:type_name -> openapi.v2.Parameter
+ 18, // 74: openapi.v2.ParametersItem.json_reference:type_name -> openapi.v2.JsonReference
+ 36, // 75: openapi.v2.PathItem.get:type_name -> openapi.v2.Operation
+ 36, // 76: openapi.v2.PathItem.put:type_name -> openapi.v2.Operation
+ 36, // 77: openapi.v2.PathItem.post:type_name -> openapi.v2.Operation
+ 36, // 78: openapi.v2.PathItem.delete:type_name -> openapi.v2.Operation
+ 36, // 79: openapi.v2.PathItem.options:type_name -> openapi.v2.Operation
+ 36, // 80: openapi.v2.PathItem.head:type_name -> openapi.v2.Operation
+ 36, // 81: openapi.v2.PathItem.patch:type_name -> openapi.v2.Operation
+ 39, // 82: openapi.v2.PathItem.parameters:type_name -> openapi.v2.ParametersItem
+ 20, // 83: openapi.v2.PathItem.vendor_extension:type_name -> openapi.v2.NamedAny
+ 43, // 84: openapi.v2.PathParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 85: openapi.v2.PathParameterSubSchema.default:type_name -> openapi.v2.Any
+ 1, // 86: openapi.v2.PathParameterSubSchema.enum:type_name -> openapi.v2.Any
+ 20, // 87: openapi.v2.PathParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 88: openapi.v2.Paths.vendor_extension:type_name -> openapi.v2.NamedAny
+ 23, // 89: openapi.v2.Paths.path:type_name -> openapi.v2.NamedPathItem
+ 43, // 90: openapi.v2.PrimitivesItems.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 91: openapi.v2.PrimitivesItems.default:type_name -> openapi.v2.Any
+ 1, // 92: openapi.v2.PrimitivesItems.enum:type_name -> openapi.v2.Any
+ 20, // 93: openapi.v2.PrimitivesItems.vendor_extension:type_name -> openapi.v2.NamedAny
+ 26, // 94: openapi.v2.Properties.additional_properties:type_name -> openapi.v2.NamedSchema
+ 43, // 95: openapi.v2.QueryParameterSubSchema.items:type_name -> openapi.v2.PrimitivesItems
+ 1, // 96: openapi.v2.QueryParameterSubSchema.default:type_name -> openapi.v2.Any
+ 1, // 97: openapi.v2.QueryParameterSubSchema.enum:type_name -> openapi.v2.Any
+ 20, // 98: openapi.v2.QueryParameterSubSchema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 51, // 99: openapi.v2.Response.schema:type_name -> openapi.v2.SchemaItem
+ 15, // 100: openapi.v2.Response.headers:type_name -> openapi.v2.Headers
+ 9, // 101: openapi.v2.Response.examples:type_name -> openapi.v2.Examples
+ 20, // 102: openapi.v2.Response.vendor_extension:type_name -> openapi.v2.NamedAny
+ 24, // 103: openapi.v2.ResponseDefinitions.additional_properties:type_name -> openapi.v2.NamedResponse
+ 46, // 104: openapi.v2.ResponseValue.response:type_name -> openapi.v2.Response
+ 18, // 105: openapi.v2.ResponseValue.json_reference:type_name -> openapi.v2.JsonReference
+ 25, // 106: openapi.v2.Responses.response_code:type_name -> openapi.v2.NamedResponseValue
+ 20, // 107: openapi.v2.Responses.vendor_extension:type_name -> openapi.v2.NamedAny
+ 1, // 108: openapi.v2.Schema.default:type_name -> openapi.v2.Any
+ 1, // 109: openapi.v2.Schema.enum:type_name -> openapi.v2.Any
+ 0, // 110: openapi.v2.Schema.additional_properties:type_name -> openapi.v2.AdditionalPropertiesItem
+ 57, // 111: openapi.v2.Schema.type:type_name -> openapi.v2.TypeItem
+ 17, // 112: openapi.v2.Schema.items:type_name -> openapi.v2.ItemsItem
+ 50, // 113: openapi.v2.Schema.all_of:type_name -> openapi.v2.Schema
+ 44, // 114: openapi.v2.Schema.properties:type_name -> openapi.v2.Properties
+ 59, // 115: openapi.v2.Schema.xml:type_name -> openapi.v2.Xml
+ 10, // 116: openapi.v2.Schema.external_docs:type_name -> openapi.v2.ExternalDocs
+ 1, // 117: openapi.v2.Schema.example:type_name -> openapi.v2.Any
+ 20, // 118: openapi.v2.Schema.vendor_extension:type_name -> openapi.v2.NamedAny
+ 50, // 119: openapi.v2.SchemaItem.schema:type_name -> openapi.v2.Schema
+ 11, // 120: openapi.v2.SchemaItem.file_schema:type_name -> openapi.v2.FileSchema
+ 27, // 121: openapi.v2.SecurityDefinitions.additional_properties:type_name -> openapi.v2.NamedSecurityDefinitionsItem
+ 3, // 122: openapi.v2.SecurityDefinitionsItem.basic_authentication_security:type_name -> openapi.v2.BasicAuthenticationSecurity
+ 2, // 123: openapi.v2.SecurityDefinitionsItem.api_key_security:type_name -> openapi.v2.ApiKeySecurity
+ 33, // 124: openapi.v2.SecurityDefinitionsItem.oauth2_implicit_security:type_name -> openapi.v2.Oauth2ImplicitSecurity
+ 34, // 125: openapi.v2.SecurityDefinitionsItem.oauth2_password_security:type_name -> openapi.v2.Oauth2PasswordSecurity
+ 32, // 126: openapi.v2.SecurityDefinitionsItem.oauth2_application_security:type_name -> openapi.v2.Oauth2ApplicationSecurity
+ 31, // 127: openapi.v2.SecurityDefinitionsItem.oauth2_access_code_security:type_name -> openapi.v2.Oauth2AccessCodeSecurity
+ 29, // 128: openapi.v2.SecurityRequirement.additional_properties:type_name -> openapi.v2.NamedStringArray
+ 10, // 129: openapi.v2.Tag.external_docs:type_name -> openapi.v2.ExternalDocs
+ 20, // 130: openapi.v2.Tag.vendor_extension:type_name -> openapi.v2.NamedAny
+ 20, // 131: openapi.v2.VendorExtension.additional_properties:type_name -> openapi.v2.NamedAny
+ 20, // 132: openapi.v2.Xml.vendor_extension:type_name -> openapi.v2.NamedAny
+ 133, // [133:133] is the sub-list for method output_type
+ 133, // [133:133] is the sub-list for method input_type
+ 133, // [133:133] is the sub-list for extension type_name
+ 133, // [133:133] is the sub-list for extension extendee
+ 0, // [0:133] is the sub-list for field type_name
+}
+
+func init() { file_openapiv2_OpenAPIv2_proto_init() }
+func file_openapiv2_OpenAPIv2_proto_init() {
+ if File_openapiv2_OpenAPIv2_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_openapiv2_OpenAPIv2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*AdditionalPropertiesItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Any); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ApiKeySecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BasicAuthenticationSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*BodyParameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Contact); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Default); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Definitions); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Document); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Examples); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExternalDocs); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*FileSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*FormDataParameterSubSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Header); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*HeaderParameterSubSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Headers); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Info); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ItemsItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*JsonReference); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*License); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedAny); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedHeader); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedParameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedPathItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedResponseValue); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedSecurityDefinitionsItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedString); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NamedStringArray); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*NonBodyParameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2AccessCodeSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2ApplicationSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2ImplicitSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2PasswordSecurity); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Oauth2Scopes); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Operation); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Parameter); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParameterDefinitions); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ParametersItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PathItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PathParameterSubSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Paths); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PrimitivesItems); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Properties); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*QueryParameterSubSchema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Response); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ResponseDefinitions); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ResponseValue); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Responses); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Schema); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SchemaItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecurityDefinitions); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecurityDefinitionsItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SecurityRequirement); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*StringArray); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Tag); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*TypeItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*VendorExtension); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Xml); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[0].OneofWrappers = []interface{}{
+ (*AdditionalPropertiesItem_Schema)(nil),
+ (*AdditionalPropertiesItem_Boolean)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[30].OneofWrappers = []interface{}{
+ (*NonBodyParameter_HeaderParameterSubSchema)(nil),
+ (*NonBodyParameter_FormDataParameterSubSchema)(nil),
+ (*NonBodyParameter_QueryParameterSubSchema)(nil),
+ (*NonBodyParameter_PathParameterSubSchema)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[37].OneofWrappers = []interface{}{
+ (*Parameter_BodyParameter)(nil),
+ (*Parameter_NonBodyParameter)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[39].OneofWrappers = []interface{}{
+ (*ParametersItem_Parameter)(nil),
+ (*ParametersItem_JsonReference)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[48].OneofWrappers = []interface{}{
+ (*ResponseValue_Response)(nil),
+ (*ResponseValue_JsonReference)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[51].OneofWrappers = []interface{}{
+ (*SchemaItem_Schema)(nil),
+ (*SchemaItem_FileSchema)(nil),
+ }
+ file_openapiv2_OpenAPIv2_proto_msgTypes[53].OneofWrappers = []interface{}{
+ (*SecurityDefinitionsItem_BasicAuthenticationSecurity)(nil),
+ (*SecurityDefinitionsItem_ApiKeySecurity)(nil),
+ (*SecurityDefinitionsItem_Oauth2ImplicitSecurity)(nil),
+ (*SecurityDefinitionsItem_Oauth2PasswordSecurity)(nil),
+ (*SecurityDefinitionsItem_Oauth2ApplicationSecurity)(nil),
+ (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)(nil),
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_openapiv2_OpenAPIv2_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 60,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_openapiv2_OpenAPIv2_proto_goTypes,
+ DependencyIndexes: file_openapiv2_OpenAPIv2_proto_depIdxs,
+ MessageInfos: file_openapiv2_OpenAPIv2_proto_msgTypes,
+ }.Build()
+ File_openapiv2_OpenAPIv2_proto = out.File
+ file_openapiv2_OpenAPIv2_proto_rawDesc = nil
+ file_openapiv2_OpenAPIv2_proto_goTypes = nil
+ file_openapiv2_OpenAPIv2_proto_depIdxs = nil
+}
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto
new file mode 100644
index 000000000..1c59b2f4a
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/OpenAPIv2.proto
@@ -0,0 +1,666 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// THIS FILE IS AUTOMATICALLY GENERATED.
+
+syntax = "proto3";
+
+package openapi.v2;
+
+import "google/protobuf/any.proto";
+
+// This option lets the proto compiler generate Java code inside the package
+// name (see below) instead of inside an outer class. It creates a simpler
+// developer experience by reducing one-level of name nesting and be
+// consistent with most programming languages that don't support outer classes.
+option java_multiple_files = true;
+
+// The Java outer classname should be the filename in UpperCamelCase. This
+// class is only used to hold proto descriptor, so developers don't need to
+// work with it directly.
+option java_outer_classname = "OpenAPIProto";
+
+// The Java package name must be proto package name with proper prefix.
+option java_package = "org.openapi_v2";
+
+// A reasonable prefix for the Objective-C symbols generated from the package.
+// It should at a minimum be 3 characters long, all uppercase, and convention
+// is to use an abbreviation of the package name. Something short, but
+// hopefully unique enough to not conflict with things that may come along in
+// the future. 'GPB' is reserved for the protocol buffer implementation itself.
+option objc_class_prefix = "OAS";
+
+// The Go package name.
+option go_package = "./openapiv2;openapi_v2";
+
+message AdditionalPropertiesItem {
+ oneof oneof {
+ Schema schema = 1;
+ bool boolean = 2;
+ }
+}
+
+message Any {
+ google.protobuf.Any value = 1;
+ string yaml = 2;
+}
+
+message ApiKeySecurity {
+ string type = 1;
+ string name = 2;
+ string in = 3;
+ string description = 4;
+ repeated NamedAny vendor_extension = 5;
+}
+
+message BasicAuthenticationSecurity {
+ string type = 1;
+ string description = 2;
+ repeated NamedAny vendor_extension = 3;
+}
+
+message BodyParameter {
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 1;
+ // The name of the parameter.
+ string name = 2;
+ // Determines the location of the parameter.
+ string in = 3;
+ // Determines whether or not this parameter is required or optional.
+ bool required = 4;
+ Schema schema = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
+// Contact information for the owners of the API.
+message Contact {
+ // The identifying name of the contact person/organization.
+ string name = 1;
+ // The URL pointing to the contact information.
+ string url = 2;
+ // The email address of the contact person/organization.
+ string email = 3;
+ repeated NamedAny vendor_extension = 4;
+}
+
+message Default {
+ repeated NamedAny additional_properties = 1;
+}
+
+// One or more JSON objects describing the schemas being consumed and produced by the API.
+message Definitions {
+ repeated NamedSchema additional_properties = 1;
+}
+
+message Document {
+ // The Swagger version of this document.
+ string swagger = 1;
+ Info info = 2;
+ // The host (name or ip) of the API. Example: 'swagger.io'
+ string host = 3;
+ // The base path to the API. Example: '/api'.
+ string base_path = 4;
+ // The transfer protocol of the API.
+ repeated string schemes = 5;
+ // A list of MIME types accepted by the API.
+ repeated string consumes = 6;
+ // A list of MIME types the API can produce.
+ repeated string produces = 7;
+ Paths paths = 8;
+ Definitions definitions = 9;
+ ParameterDefinitions parameters = 10;
+ ResponseDefinitions responses = 11;
+ repeated SecurityRequirement security = 12;
+ SecurityDefinitions security_definitions = 13;
+ repeated Tag tags = 14;
+ ExternalDocs external_docs = 15;
+ repeated NamedAny vendor_extension = 16;
+}
+
+message Examples {
+ repeated NamedAny additional_properties = 1;
+}
+
+// information about external documentation
+message ExternalDocs {
+ string description = 1;
+ string url = 2;
+ repeated NamedAny vendor_extension = 3;
+}
+
+// A deterministic version of a JSON Schema object.
+message FileSchema {
+ string format = 1;
+ string title = 2;
+ string description = 3;
+ Any default = 4;
+ repeated string required = 5;
+ string type = 6;
+ bool read_only = 7;
+ ExternalDocs external_docs = 8;
+ Any example = 9;
+ repeated NamedAny vendor_extension = 10;
+}
+
+message FormDataParameterSubSchema {
+ // Determines whether or not this parameter is required or optional.
+ bool required = 1;
+ // Determines the location of the parameter.
+ string in = 2;
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The name of the parameter.
+ string name = 4;
+ // allows sending a parameter by name only or with an empty value.
+ bool allow_empty_value = 5;
+ string type = 6;
+ string format = 7;
+ PrimitivesItems items = 8;
+ string collection_format = 9;
+ Any default = 10;
+ double maximum = 11;
+ bool exclusive_maximum = 12;
+ double minimum = 13;
+ bool exclusive_minimum = 14;
+ int64 max_length = 15;
+ int64 min_length = 16;
+ string pattern = 17;
+ int64 max_items = 18;
+ int64 min_items = 19;
+ bool unique_items = 20;
+ repeated Any enum = 21;
+ double multiple_of = 22;
+ repeated NamedAny vendor_extension = 23;
+}
+
+message Header {
+ string type = 1;
+ string format = 2;
+ PrimitivesItems items = 3;
+ string collection_format = 4;
+ Any default = 5;
+ double maximum = 6;
+ bool exclusive_maximum = 7;
+ double minimum = 8;
+ bool exclusive_minimum = 9;
+ int64 max_length = 10;
+ int64 min_length = 11;
+ string pattern = 12;
+ int64 max_items = 13;
+ int64 min_items = 14;
+ bool unique_items = 15;
+ repeated Any enum = 16;
+ double multiple_of = 17;
+ string description = 18;
+ repeated NamedAny vendor_extension = 19;
+}
+
+message HeaderParameterSubSchema {
+ // Determines whether or not this parameter is required or optional.
+ bool required = 1;
+ // Determines the location of the parameter.
+ string in = 2;
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The name of the parameter.
+ string name = 4;
+ string type = 5;
+ string format = 6;
+ PrimitivesItems items = 7;
+ string collection_format = 8;
+ Any default = 9;
+ double maximum = 10;
+ bool exclusive_maximum = 11;
+ double minimum = 12;
+ bool exclusive_minimum = 13;
+ int64 max_length = 14;
+ int64 min_length = 15;
+ string pattern = 16;
+ int64 max_items = 17;
+ int64 min_items = 18;
+ bool unique_items = 19;
+ repeated Any enum = 20;
+ double multiple_of = 21;
+ repeated NamedAny vendor_extension = 22;
+}
+
+message Headers {
+ repeated NamedHeader additional_properties = 1;
+}
+
+// General information about the API.
+message Info {
+ // A unique and precise title of the API.
+ string title = 1;
+ // A semantic version number of the API.
+ string version = 2;
+ // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The terms of service for the API.
+ string terms_of_service = 4;
+ Contact contact = 5;
+ License license = 6;
+ repeated NamedAny vendor_extension = 7;
+}
+
+message ItemsItem {
+ repeated Schema schema = 1;
+}
+
+message JsonReference {
+ string _ref = 1;
+ string description = 2;
+}
+
+message License {
+ // The name of the license type. It's encouraged to use an OSI compatible license.
+ string name = 1;
+ // The URL pointing to the license.
+ string url = 2;
+ repeated NamedAny vendor_extension = 3;
+}
+
+// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
+message NamedAny {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Any value = 2;
+}
+
+// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs.
+message NamedHeader {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Header value = 2;
+}
+
+// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs.
+message NamedParameter {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Parameter value = 2;
+}
+
+// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
+message NamedPathItem {
+ // Map key
+ string name = 1;
+ // Mapped value
+ PathItem value = 2;
+}
+
+// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs.
+message NamedResponse {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Response value = 2;
+}
+
+// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs.
+message NamedResponseValue {
+ // Map key
+ string name = 1;
+ // Mapped value
+ ResponseValue value = 2;
+}
+
+// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs.
+message NamedSchema {
+ // Map key
+ string name = 1;
+ // Mapped value
+ Schema value = 2;
+}
+
+// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs.
+message NamedSecurityDefinitionsItem {
+ // Map key
+ string name = 1;
+ // Mapped value
+ SecurityDefinitionsItem value = 2;
+}
+
+// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
+message NamedString {
+ // Map key
+ string name = 1;
+ // Mapped value
+ string value = 2;
+}
+
+// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
+message NamedStringArray {
+ // Map key
+ string name = 1;
+ // Mapped value
+ StringArray value = 2;
+}
+
+message NonBodyParameter {
+ oneof oneof {
+ HeaderParameterSubSchema header_parameter_sub_schema = 1;
+ FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
+ QueryParameterSubSchema query_parameter_sub_schema = 3;
+ PathParameterSubSchema path_parameter_sub_schema = 4;
+ }
+}
+
+message Oauth2AccessCodeSecurity {
+ string type = 1;
+ string flow = 2;
+ Oauth2Scopes scopes = 3;
+ string authorization_url = 4;
+ string token_url = 5;
+ string description = 6;
+ repeated NamedAny vendor_extension = 7;
+}
+
+message Oauth2ApplicationSecurity {
+ string type = 1;
+ string flow = 2;
+ Oauth2Scopes scopes = 3;
+ string token_url = 4;
+ string description = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
+message Oauth2ImplicitSecurity {
+ string type = 1;
+ string flow = 2;
+ Oauth2Scopes scopes = 3;
+ string authorization_url = 4;
+ string description = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
+message Oauth2PasswordSecurity {
+ string type = 1;
+ string flow = 2;
+ Oauth2Scopes scopes = 3;
+ string token_url = 4;
+ string description = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
+message Oauth2Scopes {
+ repeated NamedString additional_properties = 1;
+}
+
+message Operation {
+ repeated string tags = 1;
+ // A brief summary of the operation.
+ string summary = 2;
+ // A longer description of the operation, GitHub Flavored Markdown is allowed.
+ string description = 3;
+ ExternalDocs external_docs = 4;
+ // A unique identifier of the operation.
+ string operation_id = 5;
+ // A list of MIME types the API can produce.
+ repeated string produces = 6;
+ // A list of MIME types the API can consume.
+ repeated string consumes = 7;
+ // The parameters needed to send a valid API call.
+ repeated ParametersItem parameters = 8;
+ Responses responses = 9;
+ // The transfer protocol of the API.
+ repeated string schemes = 10;
+ bool deprecated = 11;
+ repeated SecurityRequirement security = 12;
+ repeated NamedAny vendor_extension = 13;
+}
+
+message Parameter {
+ oneof oneof {
+ BodyParameter body_parameter = 1;
+ NonBodyParameter non_body_parameter = 2;
+ }
+}
+
+// One or more JSON representations for parameters
+message ParameterDefinitions {
+ repeated NamedParameter additional_properties = 1;
+}
+
+message ParametersItem {
+ oneof oneof {
+ Parameter parameter = 1;
+ JsonReference json_reference = 2;
+ }
+}
+
+message PathItem {
+ string _ref = 1;
+ Operation get = 2;
+ Operation put = 3;
+ Operation post = 4;
+ Operation delete = 5;
+ Operation options = 6;
+ Operation head = 7;
+ Operation patch = 8;
+ // The parameters needed to send a valid API call.
+ repeated ParametersItem parameters = 9;
+ repeated NamedAny vendor_extension = 10;
+}
+
+message PathParameterSubSchema {
+ // Determines whether or not this parameter is required or optional.
+ bool required = 1;
+ // Determines the location of the parameter.
+ string in = 2;
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The name of the parameter.
+ string name = 4;
+ string type = 5;
+ string format = 6;
+ PrimitivesItems items = 7;
+ string collection_format = 8;
+ Any default = 9;
+ double maximum = 10;
+ bool exclusive_maximum = 11;
+ double minimum = 12;
+ bool exclusive_minimum = 13;
+ int64 max_length = 14;
+ int64 min_length = 15;
+ string pattern = 16;
+ int64 max_items = 17;
+ int64 min_items = 18;
+ bool unique_items = 19;
+ repeated Any enum = 20;
+ double multiple_of = 21;
+ repeated NamedAny vendor_extension = 22;
+}
+
+// Relative paths to the individual endpoints. They must be relative to the 'basePath'.
+message Paths {
+ repeated NamedAny vendor_extension = 1;
+ repeated NamedPathItem path = 2;
+}
+
+message PrimitivesItems {
+ string type = 1;
+ string format = 2;
+ PrimitivesItems items = 3;
+ string collection_format = 4;
+ Any default = 5;
+ double maximum = 6;
+ bool exclusive_maximum = 7;
+ double minimum = 8;
+ bool exclusive_minimum = 9;
+ int64 max_length = 10;
+ int64 min_length = 11;
+ string pattern = 12;
+ int64 max_items = 13;
+ int64 min_items = 14;
+ bool unique_items = 15;
+ repeated Any enum = 16;
+ double multiple_of = 17;
+ repeated NamedAny vendor_extension = 18;
+}
+
+message Properties {
+ repeated NamedSchema additional_properties = 1;
+}
+
+message QueryParameterSubSchema {
+ // Determines whether or not this parameter is required or optional.
+ bool required = 1;
+ // Determines the location of the parameter.
+ string in = 2;
+ // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
+ string description = 3;
+ // The name of the parameter.
+ string name = 4;
+ // allows sending a parameter by name only or with an empty value.
+ bool allow_empty_value = 5;
+ string type = 6;
+ string format = 7;
+ PrimitivesItems items = 8;
+ string collection_format = 9;
+ Any default = 10;
+ double maximum = 11;
+ bool exclusive_maximum = 12;
+ double minimum = 13;
+ bool exclusive_minimum = 14;
+ int64 max_length = 15;
+ int64 min_length = 16;
+ string pattern = 17;
+ int64 max_items = 18;
+ int64 min_items = 19;
+ bool unique_items = 20;
+ repeated Any enum = 21;
+ double multiple_of = 22;
+ repeated NamedAny vendor_extension = 23;
+}
+
+message Response {
+ string description = 1;
+ SchemaItem schema = 2;
+ Headers headers = 3;
+ Examples examples = 4;
+ repeated NamedAny vendor_extension = 5;
+}
+
+// One or more JSON representations for responses
+message ResponseDefinitions {
+ repeated NamedResponse additional_properties = 1;
+}
+
+message ResponseValue {
+ oneof oneof {
+ Response response = 1;
+ JsonReference json_reference = 2;
+ }
+}
+
+// Response objects names can either be any valid HTTP status code or 'default'.
+message Responses {
+ repeated NamedResponseValue response_code = 1;
+ repeated NamedAny vendor_extension = 2;
+}
+
+// A deterministic version of a JSON Schema object.
+message Schema {
+ string _ref = 1;
+ string format = 2;
+ string title = 3;
+ string description = 4;
+ Any default = 5;
+ double multiple_of = 6;
+ double maximum = 7;
+ bool exclusive_maximum = 8;
+ double minimum = 9;
+ bool exclusive_minimum = 10;
+ int64 max_length = 11;
+ int64 min_length = 12;
+ string pattern = 13;
+ int64 max_items = 14;
+ int64 min_items = 15;
+ bool unique_items = 16;
+ int64 max_properties = 17;
+ int64 min_properties = 18;
+ repeated string required = 19;
+ repeated Any enum = 20;
+ AdditionalPropertiesItem additional_properties = 21;
+ TypeItem type = 22;
+ ItemsItem items = 23;
+ repeated Schema all_of = 24;
+ Properties properties = 25;
+ string discriminator = 26;
+ bool read_only = 27;
+ Xml xml = 28;
+ ExternalDocs external_docs = 29;
+ Any example = 30;
+ repeated NamedAny vendor_extension = 31;
+}
+
+message SchemaItem {
+ oneof oneof {
+ Schema schema = 1;
+ FileSchema file_schema = 2;
+ }
+}
+
+message SecurityDefinitions {
+ repeated NamedSecurityDefinitionsItem additional_properties = 1;
+}
+
+message SecurityDefinitionsItem {
+ oneof oneof {
+ BasicAuthenticationSecurity basic_authentication_security = 1;
+ ApiKeySecurity api_key_security = 2;
+ Oauth2ImplicitSecurity oauth2_implicit_security = 3;
+ Oauth2PasswordSecurity oauth2_password_security = 4;
+ Oauth2ApplicationSecurity oauth2_application_security = 5;
+ Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
+ }
+}
+
+message SecurityRequirement {
+ repeated NamedStringArray additional_properties = 1;
+}
+
+message StringArray {
+ repeated string value = 1;
+}
+
+message Tag {
+ string name = 1;
+ string description = 2;
+ ExternalDocs external_docs = 3;
+ repeated NamedAny vendor_extension = 4;
+}
+
+message TypeItem {
+ repeated string value = 1;
+}
+
+// Any property starting with x- is valid.
+message VendorExtension {
+ repeated NamedAny additional_properties = 1;
+}
+
+message Xml {
+ string name = 1;
+ string namespace = 2;
+ string prefix = 3;
+ bool attribute = 4;
+ bool wrapped = 5;
+ repeated NamedAny vendor_extension = 6;
+}
+
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/README.md b/vendor/github.com/google/gnostic-models/openapiv2/README.md
new file mode 100644
index 000000000..5276128d3
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/README.md
@@ -0,0 +1,14 @@
+# OpenAPI v2 Protocol Buffer Models
+
+This directory contains a Protocol Buffer-language model and related code for
+supporting OpenAPI v2.
+
+Gnostic applications and plugins can use OpenAPIv2.proto to generate Protocol
+Buffer support code for their preferred languages.
+
+OpenAPIv2.go is used by Gnostic to read JSON and YAML OpenAPI descriptions into
+the Protocol Buffer-based datastructures generated from OpenAPIv2.proto.
+
+OpenAPIv2.proto and OpenAPIv2.go are generated by the Gnostic compiler
+generator, and OpenAPIv2.pb.go is generated by protoc, the Protocol Buffer
+compiler, and protoc-gen-go, the Protocol Buffer Go code generation plugin.
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/document.go b/vendor/github.com/google/gnostic-models/openapiv2/document.go
new file mode 100644
index 000000000..e96ac0d6d
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/document.go
@@ -0,0 +1,42 @@
+// Copyright 2020 Google LLC. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package openapi_v2
+
+import (
+ "gopkg.in/yaml.v3"
+
+ "github.com/google/gnostic-models/compiler"
+)
+
+// ParseDocument reads an OpenAPI v2 description from a YAML/JSON representation.
+func ParseDocument(b []byte) (*Document, error) {
+ info, err := compiler.ReadInfoFromBytes("", b)
+ if err != nil {
+ return nil, err
+ }
+ root := info.Content[0]
+ return NewDocument(root, compiler.NewContextWithExtensions("$root", root, nil, nil))
+}
+
+// YAMLValue produces a serialized YAML representation of the document.
+func (d *Document) YAMLValue(comment string) ([]byte, error) {
+ rawInfo := d.ToRawInfo()
+ rawInfo = &yaml.Node{
+ Kind: yaml.DocumentNode,
+ Content: []*yaml.Node{rawInfo},
+ HeadComment: comment,
+ }
+ return yaml.Marshal(rawInfo)
+}
diff --git a/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json b/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json
new file mode 100644
index 000000000..afa12b79b
--- /dev/null
+++ b/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json
@@ -0,0 +1,1610 @@
+{
+ "title": "A JSON Schema for Swagger 2.0 API.",
+ "id": "http://swagger.io/v2/schema.json#",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "required": [
+ "swagger",
+ "info",
+ "paths"
+ ],
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "swagger": {
+ "type": "string",
+ "enum": [
+ "2.0"
+ ],
+ "description": "The Swagger version of this document."
+ },
+ "info": {
+ "$ref": "#/definitions/info"
+ },
+ "host": {
+ "type": "string",
+ "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$",
+ "description": "The host (name or ip) of the API. Example: 'swagger.io'"
+ },
+ "basePath": {
+ "type": "string",
+ "pattern": "^/",
+ "description": "The base path to the API. Example: '/api'."
+ },
+ "schemes": {
+ "$ref": "#/definitions/schemesList"
+ },
+ "consumes": {
+ "description": "A list of MIME types accepted by the API.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/mediaTypeList"
+ }
+ ]
+ },
+ "produces": {
+ "description": "A list of MIME types the API can produce.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/mediaTypeList"
+ }
+ ]
+ },
+ "paths": {
+ "$ref": "#/definitions/paths"
+ },
+ "definitions": {
+ "$ref": "#/definitions/definitions"
+ },
+ "parameters": {
+ "$ref": "#/definitions/parameterDefinitions"
+ },
+ "responses": {
+ "$ref": "#/definitions/responseDefinitions"
+ },
+ "security": {
+ "$ref": "#/definitions/security"
+ },
+ "securityDefinitions": {
+ "$ref": "#/definitions/securityDefinitions"
+ },
+ "tags": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/tag"
+ },
+ "uniqueItems": true
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ }
+ },
+ "definitions": {
+ "info": {
+ "type": "object",
+ "description": "General information about the API.",
+ "required": [
+ "version",
+ "title"
+ ],
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "title": {
+ "type": "string",
+ "description": "A unique and precise title of the API."
+ },
+ "version": {
+ "type": "string",
+ "description": "A semantic version number of the API."
+ },
+ "description": {
+ "type": "string",
+ "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."
+ },
+ "termsOfService": {
+ "type": "string",
+ "description": "The terms of service for the API."
+ },
+ "contact": {
+ "$ref": "#/definitions/contact"
+ },
+ "license": {
+ "$ref": "#/definitions/license"
+ }
+ }
+ },
+ "contact": {
+ "type": "object",
+ "description": "Contact information for the owners of the API.",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The identifying name of the contact person/organization."
+ },
+ "url": {
+ "type": "string",
+ "description": "The URL pointing to the contact information.",
+ "format": "uri"
+ },
+ "email": {
+ "type": "string",
+ "description": "The email address of the contact person/organization.",
+ "format": "email"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "license": {
+ "type": "object",
+ "required": [
+ "name"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the license type. It's encouraged to use an OSI compatible license."
+ },
+ "url": {
+ "type": "string",
+ "description": "The URL pointing to the license.",
+ "format": "uri"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "paths": {
+ "type": "object",
+ "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.",
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ },
+ "^/": {
+ "$ref": "#/definitions/pathItem"
+ }
+ },
+ "additionalProperties": false
+ },
+ "definitions": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/schema"
+ },
+ "description": "One or more JSON objects describing the schemas being consumed and produced by the API."
+ },
+ "parameterDefinitions": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/parameter"
+ },
+ "description": "One or more JSON representations for parameters"
+ },
+ "responseDefinitions": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/response"
+ },
+ "description": "One or more JSON representations for responses"
+ },
+ "externalDocs": {
+ "type": "object",
+ "additionalProperties": false,
+ "description": "information about external documentation",
+ "required": [
+ "url"
+ ],
+ "properties": {
+ "description": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string",
+ "format": "uri"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "examples": {
+ "type": "object",
+ "additionalProperties": true
+ },
+ "mimeType": {
+ "type": "string",
+ "description": "The MIME type of the HTTP message."
+ },
+ "operation": {
+ "type": "object",
+ "required": [
+ "responses"
+ ],
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "tags": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "uniqueItems": true
+ },
+ "summary": {
+ "type": "string",
+ "description": "A brief summary of the operation."
+ },
+ "description": {
+ "type": "string",
+ "description": "A longer description of the operation, GitHub Flavored Markdown is allowed."
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ },
+ "operationId": {
+ "type": "string",
+ "description": "A unique identifier of the operation."
+ },
+ "produces": {
+ "description": "A list of MIME types the API can produce.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/mediaTypeList"
+ }
+ ]
+ },
+ "consumes": {
+ "description": "A list of MIME types the API can consume.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/mediaTypeList"
+ }
+ ]
+ },
+ "parameters": {
+ "$ref": "#/definitions/parametersList"
+ },
+ "responses": {
+ "$ref": "#/definitions/responses"
+ },
+ "schemes": {
+ "$ref": "#/definitions/schemesList"
+ },
+ "deprecated": {
+ "type": "boolean",
+ "default": false
+ },
+ "security": {
+ "$ref": "#/definitions/security"
+ }
+ }
+ },
+ "pathItem": {
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "$ref": {
+ "type": "string"
+ },
+ "get": {
+ "$ref": "#/definitions/operation"
+ },
+ "put": {
+ "$ref": "#/definitions/operation"
+ },
+ "post": {
+ "$ref": "#/definitions/operation"
+ },
+ "delete": {
+ "$ref": "#/definitions/operation"
+ },
+ "options": {
+ "$ref": "#/definitions/operation"
+ },
+ "head": {
+ "$ref": "#/definitions/operation"
+ },
+ "patch": {
+ "$ref": "#/definitions/operation"
+ },
+ "parameters": {
+ "$ref": "#/definitions/parametersList"
+ }
+ }
+ },
+ "responses": {
+ "type": "object",
+ "description": "Response objects names can either be any valid HTTP status code or 'default'.",
+ "minProperties": 1,
+ "additionalProperties": false,
+ "patternProperties": {
+ "^([0-9]{3})$|^(default)$": {
+ "$ref": "#/definitions/responseValue"
+ },
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "not": {
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ }
+ },
+ "responseValue": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/response"
+ },
+ {
+ "$ref": "#/definitions/jsonReference"
+ }
+ ]
+ },
+ "response": {
+ "type": "object",
+ "required": [
+ "description"
+ ],
+ "properties": {
+ "description": {
+ "type": "string"
+ },
+ "schema": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/schema"
+ },
+ {
+ "$ref": "#/definitions/fileSchema"
+ }
+ ]
+ },
+ "headers": {
+ "$ref": "#/definitions/headers"
+ },
+ "examples": {
+ "$ref": "#/definitions/examples"
+ }
+ },
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "headers": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/header"
+ }
+ },
+ "header": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "integer",
+ "boolean",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormat"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "vendorExtension": {
+ "description": "Any property starting with x- is valid.",
+ "additionalProperties": true,
+ "additionalItems": true
+ },
+ "bodyParameter": {
+ "type": "object",
+ "required": [
+ "name",
+ "in",
+ "schema"
+ ],
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "body"
+ ]
+ },
+ "required": {
+ "type": "boolean",
+ "description": "Determines whether or not this parameter is required or optional.",
+ "default": false
+ },
+ "schema": {
+ "$ref": "#/definitions/schema"
+ }
+ },
+ "additionalProperties": false
+ },
+ "headerParameterSubSchema": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "required": {
+ "type": "boolean",
+ "description": "Determines whether or not this parameter is required or optional.",
+ "default": false
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "header"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "integer",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormat"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ }
+ },
+ "queryParameterSubSchema": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "required": {
+ "type": "boolean",
+ "description": "Determines whether or not this parameter is required or optional.",
+ "default": false
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "query"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "allowEmptyValue": {
+ "type": "boolean",
+ "default": false,
+ "description": "allows sending a parameter by name only or with an empty value."
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "integer",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormatWithMulti"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ }
+ },
+ "formDataParameterSubSchema": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "required": {
+ "type": "boolean",
+ "description": "Determines whether or not this parameter is required or optional.",
+ "default": false
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "formData"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "allowEmptyValue": {
+ "type": "boolean",
+ "default": false,
+ "description": "allows sending a parameter by name only or with an empty value."
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "integer",
+ "array",
+ "file"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormatWithMulti"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ }
+ },
+ "pathParameterSubSchema": {
+ "additionalProperties": false,
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "required": [
+ "required"
+ ],
+ "properties": {
+ "required": {
+ "type": "boolean",
+ "enum": [
+ true
+ ],
+ "description": "Determines whether or not this parameter is required or optional."
+ },
+ "in": {
+ "type": "string",
+ "description": "Determines the location of the parameter.",
+ "enum": [
+ "path"
+ ]
+ },
+ "description": {
+ "type": "string",
+ "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the parameter."
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "boolean",
+ "integer",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormat"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ }
+ },
+ "nonBodyParameter": {
+ "type": "object",
+ "required": [
+ "name",
+ "in",
+ "type"
+ ],
+ "oneOf": [
+ {
+ "$ref": "#/definitions/headerParameterSubSchema"
+ },
+ {
+ "$ref": "#/definitions/formDataParameterSubSchema"
+ },
+ {
+ "$ref": "#/definitions/queryParameterSubSchema"
+ },
+ {
+ "$ref": "#/definitions/pathParameterSubSchema"
+ }
+ ]
+ },
+ "parameter": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/bodyParameter"
+ },
+ {
+ "$ref": "#/definitions/nonBodyParameter"
+ }
+ ]
+ },
+ "schema": {
+ "type": "object",
+ "description": "A deterministic version of a JSON Schema object.",
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "properties": {
+ "$ref": {
+ "type": "string"
+ },
+ "format": {
+ "type": "string"
+ },
+ "title": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
+ },
+ "description": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
+ },
+ "default": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
+ },
+ "multipleOf": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
+ },
+ "maximum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minLength": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "pattern": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
+ },
+ "maxItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "uniqueItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
+ },
+ "maxProperties": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minProperties": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "required": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
+ },
+ "enum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
+ },
+ "additionalProperties": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/schema"
+ },
+ {
+ "type": "boolean"
+ }
+ ],
+ "default": {}
+ },
+ "type": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/type"
+ },
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/schema"
+ },
+ {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "$ref": "#/definitions/schema"
+ }
+ }
+ ],
+ "default": {}
+ },
+ "allOf": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "$ref": "#/definitions/schema"
+ }
+ },
+ "properties": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/schema"
+ },
+ "default": {}
+ },
+ "discriminator": {
+ "type": "string"
+ },
+ "readOnly": {
+ "type": "boolean",
+ "default": false
+ },
+ "xml": {
+ "$ref": "#/definitions/xml"
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ },
+ "example": {}
+ },
+ "additionalProperties": false
+ },
+ "fileSchema": {
+ "type": "object",
+ "description": "A deterministic version of a JSON Schema object.",
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ },
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "format": {
+ "type": "string"
+ },
+ "title": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
+ },
+ "description": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
+ },
+ "default": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
+ },
+ "required": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "file"
+ ]
+ },
+ "readOnly": {
+ "type": "boolean",
+ "default": false
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ },
+ "example": {}
+ },
+ "additionalProperties": false
+ },
+ "primitivesItems": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "string",
+ "number",
+ "integer",
+ "boolean",
+ "array"
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "items": {
+ "$ref": "#/definitions/primitivesItems"
+ },
+ "collectionFormat": {
+ "$ref": "#/definitions/collectionFormat"
+ },
+ "default": {
+ "$ref": "#/definitions/default"
+ },
+ "maximum": {
+ "$ref": "#/definitions/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "#/definitions/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "#/definitions/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "#/definitions/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/maxLength"
+ },
+ "minLength": {
+ "$ref": "#/definitions/minLength"
+ },
+ "pattern": {
+ "$ref": "#/definitions/pattern"
+ },
+ "maxItems": {
+ "$ref": "#/definitions/maxItems"
+ },
+ "minItems": {
+ "$ref": "#/definitions/minItems"
+ },
+ "uniqueItems": {
+ "$ref": "#/definitions/uniqueItems"
+ },
+ "enum": {
+ "$ref": "#/definitions/enum"
+ },
+ "multipleOf": {
+ "$ref": "#/definitions/multipleOf"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "security": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/securityRequirement"
+ },
+ "uniqueItems": true
+ },
+ "securityRequirement": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "uniqueItems": true
+ }
+ },
+ "xml": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "namespace": {
+ "type": "string"
+ },
+ "prefix": {
+ "type": "string"
+ },
+ "attribute": {
+ "type": "boolean",
+ "default": false
+ },
+ "wrapped": {
+ "type": "boolean",
+ "default": false
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "tag": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "name"
+ ],
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "externalDocs": {
+ "$ref": "#/definitions/externalDocs"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "securityDefinitions": {
+ "type": "object",
+ "additionalProperties": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/basicAuthenticationSecurity"
+ },
+ {
+ "$ref": "#/definitions/apiKeySecurity"
+ },
+ {
+ "$ref": "#/definitions/oauth2ImplicitSecurity"
+ },
+ {
+ "$ref": "#/definitions/oauth2PasswordSecurity"
+ },
+ {
+ "$ref": "#/definitions/oauth2ApplicationSecurity"
+ },
+ {
+ "$ref": "#/definitions/oauth2AccessCodeSecurity"
+ }
+ ]
+ }
+ },
+ "basicAuthenticationSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "basic"
+ ]
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "apiKeySecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "name",
+ "in"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "apiKey"
+ ]
+ },
+ "name": {
+ "type": "string"
+ },
+ "in": {
+ "type": "string",
+ "enum": [
+ "header",
+ "query"
+ ]
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2ImplicitSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "flow",
+ "authorizationUrl"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "oauth2"
+ ]
+ },
+ "flow": {
+ "type": "string",
+ "enum": [
+ "implicit"
+ ]
+ },
+ "scopes": {
+ "$ref": "#/definitions/oauth2Scopes"
+ },
+ "authorizationUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2PasswordSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "flow",
+ "tokenUrl"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "oauth2"
+ ]
+ },
+ "flow": {
+ "type": "string",
+ "enum": [
+ "password"
+ ]
+ },
+ "scopes": {
+ "$ref": "#/definitions/oauth2Scopes"
+ },
+ "tokenUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2ApplicationSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "flow",
+ "tokenUrl"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "oauth2"
+ ]
+ },
+ "flow": {
+ "type": "string",
+ "enum": [
+ "application"
+ ]
+ },
+ "scopes": {
+ "$ref": "#/definitions/oauth2Scopes"
+ },
+ "tokenUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2AccessCodeSecurity": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "type",
+ "flow",
+ "authorizationUrl",
+ "tokenUrl"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "oauth2"
+ ]
+ },
+ "flow": {
+ "type": "string",
+ "enum": [
+ "accessCode"
+ ]
+ },
+ "scopes": {
+ "$ref": "#/definitions/oauth2Scopes"
+ },
+ "authorizationUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "tokenUrl": {
+ "type": "string",
+ "format": "uri"
+ },
+ "description": {
+ "type": "string"
+ }
+ },
+ "patternProperties": {
+ "^x-": {
+ "$ref": "#/definitions/vendorExtension"
+ }
+ }
+ },
+ "oauth2Scopes": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "mediaTypeList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/mimeType"
+ },
+ "uniqueItems": true
+ },
+ "parametersList": {
+ "type": "array",
+ "description": "The parameters needed to send a valid API call.",
+ "additionalItems": false,
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/definitions/parameter"
+ },
+ {
+ "$ref": "#/definitions/jsonReference"
+ }
+ ]
+ },
+ "uniqueItems": true
+ },
+ "schemesList": {
+ "type": "array",
+ "description": "The transfer protocol of the API.",
+ "items": {
+ "type": "string",
+ "enum": [
+ "http",
+ "https",
+ "ws",
+ "wss"
+ ]
+ },
+ "uniqueItems": true
+ },
+ "collectionFormat": {
+ "type": "string",
+ "enum": [
+ "csv",
+ "ssv",
+ "tsv",
+ "pipes"
+ ],
+ "default": "csv"
+ },
+ "collectionFormatWithMulti": {
+ "type": "string",
+ "enum": [
+ "csv",
+ "ssv",
+ "tsv",
+ "pipes",
+ "multi"
+ ],
+ "default": "csv"
+ },
+ "title": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
+ },
+ "description": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
+ },
+ "default": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
+ },
+ "multipleOf": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
+ },
+ "maximum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
+ },
+ "exclusiveMaximum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
+ },
+ "minimum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
+ },
+ "exclusiveMinimum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
+ },
+ "maxLength": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minLength": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "pattern": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
+ },
+ "maxItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
+ },
+ "minItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
+ },
+ "uniqueItems": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
+ },
+ "enum": {
+ "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
+ },
+ "jsonReference": {
+ "type": "object",
+ "required": [
+ "$ref"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "$ref": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.go b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go
similarity index 99%
rename from vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.go
rename to vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go
index 5f4a7025e..4b1131ce1 100644
--- a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.go
+++ b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.go
@@ -23,7 +23,7 @@ import (
"gopkg.in/yaml.v3"
- "github.com/google/gnostic/compiler"
+ "github.com/google/gnostic-models/compiler"
)
// Version returns the package name (and OpenAPI version).
diff --git a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.pb.go b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go
similarity index 99%
rename from vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.pb.go
rename to vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go
index 499e7f932..945b8d11f 100644
--- a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.pb.go
+++ b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.pb.go
@@ -16,8 +16,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.26.0
-// protoc v3.18.1
+// protoc-gen-go v1.27.1
+// protoc v3.19.3
// source: openapiv3/OpenAPIv3.proto
package openapi_v3
diff --git a/vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.proto b/vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto
similarity index 100%
rename from vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.proto
rename to vendor/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto
diff --git a/vendor/github.com/google/gnostic/openapiv3/README.md b/vendor/github.com/google/gnostic-models/openapiv3/README.md
similarity index 100%
rename from vendor/github.com/google/gnostic/openapiv3/README.md
rename to vendor/github.com/google/gnostic-models/openapiv3/README.md
diff --git a/vendor/github.com/google/gnostic/openapiv3/document.go b/vendor/github.com/google/gnostic-models/openapiv3/document.go
similarity index 96%
rename from vendor/github.com/google/gnostic/openapiv3/document.go
rename to vendor/github.com/google/gnostic-models/openapiv3/document.go
index ef10d1d90..1cee46773 100644
--- a/vendor/github.com/google/gnostic/openapiv3/document.go
+++ b/vendor/github.com/google/gnostic-models/openapiv3/document.go
@@ -17,7 +17,7 @@ package openapi_v3
import (
"gopkg.in/yaml.v3"
- "github.com/google/gnostic/compiler"
+ "github.com/google/gnostic-models/compiler"
)
// ParseDocument reads an OpenAPI v3 description from a YAML/JSON representation.
diff --git a/vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json b/vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json
deleted file mode 100644
index d5caed162..000000000
--- a/vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json
+++ /dev/null
@@ -1,1251 +0,0 @@
-{
- "title": "A JSON Schema for OpenAPI 3.0.",
- "id": "http://openapis.org/v3/schema.json#",
- "$schema": "http://json-schema.org/draft-04/schema#",
- "type": "object",
- "description": "This is the root document object of the OpenAPI document.",
- "required": [
- "openapi",
- "info",
- "paths"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "openapi": {
- "type": "string"
- },
- "info": {
- "$ref": "#/definitions/info"
- },
- "servers": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/server"
- },
- "uniqueItems": true
- },
- "paths": {
- "$ref": "#/definitions/paths"
- },
- "components": {
- "$ref": "#/definitions/components"
- },
- "security": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/securityRequirement"
- },
- "uniqueItems": true
- },
- "tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/tag"
- },
- "uniqueItems": true
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- }
- },
- "definitions": {
- "info": {
- "type": "object",
- "description": "The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.",
- "required": [
- "title",
- "version"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "title": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "termsOfService": {
- "type": "string"
- },
- "contact": {
- "$ref": "#/definitions/contact"
- },
- "license": {
- "$ref": "#/definitions/license"
- },
- "version": {
- "type": "string"
- }
- }
- },
- "contact": {
- "type": "object",
- "description": "Contact information for the exposed API.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "url": {
- "type": "string",
- "format": "uri"
- },
- "email": {
- "type": "string",
- "format": "email"
- }
- }
- },
- "license": {
- "type": "object",
- "description": "License information for the exposed API.",
- "required": [
- "name"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "url": {
- "type": "string"
- }
- }
- },
- "server": {
- "type": "object",
- "description": "An object representing a Server.",
- "required": [
- "url"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "url": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "variables": {
- "$ref": "#/definitions/serverVariables"
- }
- }
- },
- "serverVariable": {
- "type": "object",
- "description": "An object representing a Server Variable for server URL template substitution.",
- "required": [
- "default"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "enum": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- },
- "default": {
- "type": "string"
- },
- "description": {
- "type": "string"
- }
- }
- },
- "components": {
- "type": "object",
- "description": "Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "schemas": {
- "$ref": "#/definitions/schemasOrReferences"
- },
- "responses": {
- "$ref": "#/definitions/responsesOrReferences"
- },
- "parameters": {
- "$ref": "#/definitions/parametersOrReferences"
- },
- "examples": {
- "$ref": "#/definitions/examplesOrReferences"
- },
- "requestBodies": {
- "$ref": "#/definitions/requestBodiesOrReferences"
- },
- "headers": {
- "$ref": "#/definitions/headersOrReferences"
- },
- "securitySchemes": {
- "$ref": "#/definitions/securitySchemesOrReferences"
- },
- "links": {
- "$ref": "#/definitions/linksOrReferences"
- },
- "callbacks": {
- "$ref": "#/definitions/callbacksOrReferences"
- }
- }
- },
- "paths": {
- "type": "object",
- "description": "Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.",
- "additionalProperties": false,
- "patternProperties": {
- "^/": {
- "$ref": "#/definitions/pathItem"
- },
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- }
- },
- "pathItem": {
- "type": "object",
- "description": "Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "$ref": {
- "type": "string"
- },
- "summary": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "get": {
- "$ref": "#/definitions/operation"
- },
- "put": {
- "$ref": "#/definitions/operation"
- },
- "post": {
- "$ref": "#/definitions/operation"
- },
- "delete": {
- "$ref": "#/definitions/operation"
- },
- "options": {
- "$ref": "#/definitions/operation"
- },
- "head": {
- "$ref": "#/definitions/operation"
- },
- "patch": {
- "$ref": "#/definitions/operation"
- },
- "trace": {
- "$ref": "#/definitions/operation"
- },
- "servers": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/server"
- },
- "uniqueItems": true
- },
- "parameters": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/parameterOrReference"
- },
- "uniqueItems": true
- }
- }
- },
- "operation": {
- "type": "object",
- "description": "Describes a single API operation on a path.",
- "required": [
- "responses"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- },
- "summary": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "operationId": {
- "type": "string"
- },
- "parameters": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/parameterOrReference"
- },
- "uniqueItems": true
- },
- "requestBody": {
- "$ref": "#/definitions/requestBodyOrReference"
- },
- "responses": {
- "$ref": "#/definitions/responses"
- },
- "callbacks": {
- "$ref": "#/definitions/callbacksOrReferences"
- },
- "deprecated": {
- "type": "boolean"
- },
- "security": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/securityRequirement"
- },
- "uniqueItems": true
- },
- "servers": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/server"
- },
- "uniqueItems": true
- }
- }
- },
- "externalDocs": {
- "type": "object",
- "description": "Allows referencing an external resource for extended documentation.",
- "required": [
- "url"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string"
- },
- "url": {
- "type": "string"
- }
- }
- },
- "parameter": {
- "type": "object",
- "description": "Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.",
- "required": [
- "name",
- "in"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "in": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "required": {
- "type": "boolean"
- },
- "deprecated": {
- "type": "boolean"
- },
- "allowEmptyValue": {
- "type": "boolean"
- },
- "style": {
- "type": "string"
- },
- "explode": {
- "type": "boolean"
- },
- "allowReserved": {
- "type": "boolean"
- },
- "schema": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "example": {
- "$ref": "#/definitions/any"
- },
- "examples": {
- "$ref": "#/definitions/examplesOrReferences"
- },
- "content": {
- "$ref": "#/definitions/mediaTypes"
- }
- }
- },
- "requestBody": {
- "type": "object",
- "description": "Describes a single request body.",
- "required": [
- "content"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string"
- },
- "content": {
- "$ref": "#/definitions/mediaTypes"
- },
- "required": {
- "type": "boolean"
- }
- }
- },
- "mediaType": {
- "type": "object",
- "description": "Each Media Type Object provides schema and examples for the media type identified by its key.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "schema": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "example": {
- "$ref": "#/definitions/any"
- },
- "examples": {
- "$ref": "#/definitions/examplesOrReferences"
- },
- "encoding": {
- "$ref": "#/definitions/encodings"
- }
- }
- },
- "encoding": {
- "type": "object",
- "description": "A single encoding definition applied to a single schema property.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "contentType": {
- "type": "string"
- },
- "headers": {
- "$ref": "#/definitions/headersOrReferences"
- },
- "style": {
- "type": "string"
- },
- "explode": {
- "type": "boolean"
- },
- "allowReserved": {
- "type": "boolean"
- }
- }
- },
- "responses": {
- "type": "object",
- "description": "A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.",
- "additionalProperties": false,
- "patternProperties": {
- "^([0-9X]{3})$": {
- "$ref": "#/definitions/responseOrReference"
- },
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "default": {
- "$ref": "#/definitions/responseOrReference"
- }
- }
- },
- "response": {
- "type": "object",
- "description": "Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.",
- "required": [
- "description"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string"
- },
- "headers": {
- "$ref": "#/definitions/headersOrReferences"
- },
- "content": {
- "$ref": "#/definitions/mediaTypes"
- },
- "links": {
- "$ref": "#/definitions/linksOrReferences"
- }
- }
- },
- "callback": {
- "type": "object",
- "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.",
- "additionalProperties": false,
- "patternProperties": {
- "^": {
- "$ref": "#/definitions/pathItem"
- },
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- }
- },
- "example": {
- "type": "object",
- "description": "",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "summary": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "value": {
- "$ref": "#/definitions/any"
- },
- "externalValue": {
- "type": "string"
- }
- }
- },
- "link": {
- "type": "object",
- "description": "The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "operationRef": {
- "type": "string"
- },
- "operationId": {
- "type": "string"
- },
- "parameters": {
- "$ref": "#/definitions/anysOrExpressions"
- },
- "requestBody": {
- "$ref": "#/definitions/anyOrExpression"
- },
- "description": {
- "type": "string"
- },
- "server": {
- "$ref": "#/definitions/server"
- }
- }
- },
- "header": {
- "type": "object",
- "description": "The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string"
- },
- "required": {
- "type": "boolean"
- },
- "deprecated": {
- "type": "boolean"
- },
- "allowEmptyValue": {
- "type": "boolean"
- },
- "style": {
- "type": "string"
- },
- "explode": {
- "type": "boolean"
- },
- "allowReserved": {
- "type": "boolean"
- },
- "schema": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "example": {
- "$ref": "#/definitions/any"
- },
- "examples": {
- "$ref": "#/definitions/examplesOrReferences"
- },
- "content": {
- "$ref": "#/definitions/mediaTypes"
- }
- }
- },
- "tag": {
- "type": "object",
- "description": "Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.",
- "required": [
- "name"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- }
- }
- },
- "reference": {
- "type": "object",
- "description": "A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.",
- "required": [
- "$ref"
- ],
- "additionalProperties": false,
- "properties": {
- "$ref": {
- "type": "string"
- },
- "summary": {
- "type": "string"
- },
- "description": {
- "type": "string"
- }
- }
- },
- "schema": {
- "type": "object",
- "description": "The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "nullable": {
- "type": "boolean"
- },
- "discriminator": {
- "$ref": "#/definitions/discriminator"
- },
- "readOnly": {
- "type": "boolean"
- },
- "writeOnly": {
- "type": "boolean"
- },
- "xml": {
- "$ref": "#/definitions/xml"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "example": {
- "$ref": "#/definitions/any"
- },
- "deprecated": {
- "type": "boolean"
- },
- "title": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
- },
- "multipleOf": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
- },
- "maximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxLength"
- },
- "minLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minLength"
- },
- "pattern": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
- },
- "maxItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxItems"
- },
- "minItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minItems"
- },
- "uniqueItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
- },
- "maxProperties": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxProperties"
- },
- "minProperties": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minProperties"
- },
- "required": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/required"
- },
- "enum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
- },
- "type": {
- "type": "string"
- },
- "allOf": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "minItems": 1
- },
- "oneOf": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "minItems": 1
- },
- "anyOf": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "minItems": 1
- },
- "not": {
- "$ref": "#/definitions/schema"
- },
- "items": {
- "anyOf": [
- {
- "$ref": "#/definitions/schemaOrReference"
- },
- {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "minItems": 1
- }
- ]
- },
- "properties": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/schemaOrReference"
- }
- },
- "additionalProperties": {
- "oneOf": [
- {
- "$ref": "#/definitions/schemaOrReference"
- },
- {
- "type": "boolean"
- }
- ]
- },
- "default": {
- "$ref": "#/definitions/defaultType"
- },
- "description": {
- "type": "string"
- },
- "format": {
- "type": "string"
- }
- }
- },
- "discriminator": {
- "type": "object",
- "description": "When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.",
- "required": [
- "propertyName"
- ],
- "additionalProperties": false,
- "properties": {
- "propertyName": {
- "type": "string"
- },
- "mapping": {
- "$ref": "#/definitions/strings"
- }
- }
- },
- "xml": {
- "type": "object",
- "description": "A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "namespace": {
- "type": "string"
- },
- "prefix": {
- "type": "string"
- },
- "attribute": {
- "type": "boolean"
- },
- "wrapped": {
- "type": "boolean"
- }
- }
- },
- "securityScheme": {
- "type": "object",
- "description": "Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect Discovery.",
- "required": [
- "type"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "type": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "in": {
- "type": "string"
- },
- "scheme": {
- "type": "string"
- },
- "bearerFormat": {
- "type": "string"
- },
- "flows": {
- "$ref": "#/definitions/oauthFlows"
- },
- "openIdConnectUrl": {
- "type": "string"
- }
- }
- },
- "oauthFlows": {
- "type": "object",
- "description": "Allows configuration of the supported OAuth Flows.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "implicit": {
- "$ref": "#/definitions/oauthFlow"
- },
- "password": {
- "$ref": "#/definitions/oauthFlow"
- },
- "clientCredentials": {
- "$ref": "#/definitions/oauthFlow"
- },
- "authorizationCode": {
- "$ref": "#/definitions/oauthFlow"
- }
- }
- },
- "oauthFlow": {
- "type": "object",
- "description": "Configuration details for a supported OAuth Flow",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "authorizationUrl": {
- "type": "string"
- },
- "tokenUrl": {
- "type": "string"
- },
- "refreshUrl": {
- "type": "string"
- },
- "scopes": {
- "$ref": "#/definitions/strings"
- }
- }
- },
- "securityRequirement": {
- "type": "object",
- "description": "Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.",
- "additionalProperties": false,
- "patternProperties": {
- "^[a-zA-Z0-9\\.\\-_]+$": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- }
- }
- },
- "anyOrExpression": {
- "oneOf": [
- {
- "$ref": "#/definitions/any"
- },
- {
- "$ref": "#/definitions/expression"
- }
- ]
- },
- "callbackOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/callback"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "exampleOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/example"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "headerOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/header"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "linkOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/link"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "parameterOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/parameter"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "requestBodyOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/requestBody"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "responseOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/response"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "schemaOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/schema"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "securitySchemeOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/securityScheme"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "anysOrExpressions": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/anyOrExpression"
- }
- },
- "callbacksOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/callbackOrReference"
- }
- },
- "encodings": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/encoding"
- }
- },
- "examplesOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/exampleOrReference"
- }
- },
- "headersOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/headerOrReference"
- }
- },
- "linksOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/linkOrReference"
- }
- },
- "mediaTypes": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/mediaType"
- }
- },
- "parametersOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/parameterOrReference"
- }
- },
- "requestBodiesOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/requestBodyOrReference"
- }
- },
- "responsesOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/responseOrReference"
- }
- },
- "schemasOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/schemaOrReference"
- }
- },
- "securitySchemesOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/securitySchemeOrReference"
- }
- },
- "serverVariables": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/serverVariable"
- }
- },
- "strings": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "object": {
- "type": "object",
- "additionalProperties": true
- },
- "any": {
- "additionalProperties": true
- },
- "expression": {
- "type": "object",
- "additionalProperties": true
- },
- "specificationExtension": {
- "description": "Any property starting with x- is valid.",
- "oneOf": [
- {
- "type": "null"
- },
- {
- "type": "number"
- },
- {
- "type": "boolean"
- },
- {
- "type": "string"
- },
- {
- "type": "object"
- },
- {
- "type": "array"
- }
- ]
- },
- "defaultType": {
- "oneOf": [
- {
- "type": "null"
- },
- {
- "type": "array"
- },
- {
- "type": "object"
- },
- {
- "type": "number"
- },
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ]
- }
- }
-}
diff --git a/vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json b/vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json
deleted file mode 100644
index ed0b83adf..000000000
--- a/vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json
+++ /dev/null
@@ -1,1250 +0,0 @@
-{
- "title": "A JSON Schema for OpenAPI 3.0.",
- "id": "http://openapis.org/v3/schema.json#",
- "$schema": "http://json-schema.org/draft-04/schema#",
- "type": "object",
- "description": "This is the root document object of the OpenAPI document.",
- "required": [
- "openapi",
- "info",
- "paths"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "openapi": {
- "type": "string"
- },
- "info": {
- "$ref": "#/definitions/info"
- },
- "servers": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/server"
- },
- "uniqueItems": true
- },
- "paths": {
- "$ref": "#/definitions/paths"
- },
- "components": {
- "$ref": "#/definitions/components"
- },
- "security": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/securityRequirement"
- },
- "uniqueItems": true
- },
- "tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/tag"
- },
- "uniqueItems": true
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- }
- },
- "definitions": {
- "info": {
- "type": "object",
- "description": "The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.",
- "required": [
- "title",
- "version"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "title": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "termsOfService": {
- "type": "string"
- },
- "contact": {
- "$ref": "#/definitions/contact"
- },
- "license": {
- "$ref": "#/definitions/license"
- },
- "version": {
- "type": "string"
- },
- "summary": {
- "type": "string"
- }
- }
- },
- "contact": {
- "type": "object",
- "description": "Contact information for the exposed API.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "url": {
- "type": "string",
- "format": "uri"
- },
- "email": {
- "type": "string",
- "format": "email"
- }
- }
- },
- "license": {
- "type": "object",
- "description": "License information for the exposed API.",
- "required": [
- "name"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "url": {
- "type": "string"
- }
- }
- },
- "server": {
- "type": "object",
- "description": "An object representing a Server.",
- "required": [
- "url"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "url": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "variables": {
- "$ref": "#/definitions/serverVariables"
- }
- }
- },
- "serverVariable": {
- "type": "object",
- "description": "An object representing a Server Variable for server URL template substitution.",
- "required": [
- "default"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "enum": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- },
- "default": {
- "type": "string"
- },
- "description": {
- "type": "string"
- }
- }
- },
- "components": {
- "type": "object",
- "description": "Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "schemas": {
- "$ref": "#/definitions/schemasOrReferences"
- },
- "responses": {
- "$ref": "#/definitions/responsesOrReferences"
- },
- "parameters": {
- "$ref": "#/definitions/parametersOrReferences"
- },
- "examples": {
- "$ref": "#/definitions/examplesOrReferences"
- },
- "requestBodies": {
- "$ref": "#/definitions/requestBodiesOrReferences"
- },
- "headers": {
- "$ref": "#/definitions/headersOrReferences"
- },
- "securitySchemes": {
- "$ref": "#/definitions/securitySchemesOrReferences"
- },
- "links": {
- "$ref": "#/definitions/linksOrReferences"
- },
- "callbacks": {
- "$ref": "#/definitions/callbacksOrReferences"
- }
- }
- },
- "paths": {
- "type": "object",
- "description": "Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.",
- "additionalProperties": false,
- "patternProperties": {
- "^/": {
- "$ref": "#/definitions/pathItem"
- },
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- }
- },
- "pathItem": {
- "type": "object",
- "description": "Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "$ref": {
- "type": "string"
- },
- "summary": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "get": {
- "$ref": "#/definitions/operation"
- },
- "put": {
- "$ref": "#/definitions/operation"
- },
- "post": {
- "$ref": "#/definitions/operation"
- },
- "delete": {
- "$ref": "#/definitions/operation"
- },
- "options": {
- "$ref": "#/definitions/operation"
- },
- "head": {
- "$ref": "#/definitions/operation"
- },
- "patch": {
- "$ref": "#/definitions/operation"
- },
- "trace": {
- "$ref": "#/definitions/operation"
- },
- "servers": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/server"
- },
- "uniqueItems": true
- },
- "parameters": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/parameterOrReference"
- },
- "uniqueItems": true
- }
- }
- },
- "operation": {
- "type": "object",
- "description": "Describes a single API operation on a path.",
- "required": [
- "responses"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- },
- "summary": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "operationId": {
- "type": "string"
- },
- "parameters": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/parameterOrReference"
- },
- "uniqueItems": true
- },
- "requestBody": {
- "$ref": "#/definitions/requestBodyOrReference"
- },
- "responses": {
- "$ref": "#/definitions/responses"
- },
- "callbacks": {
- "$ref": "#/definitions/callbacksOrReferences"
- },
- "deprecated": {
- "type": "boolean"
- },
- "security": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/securityRequirement"
- },
- "uniqueItems": true
- },
- "servers": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/server"
- },
- "uniqueItems": true
- }
- }
- },
- "externalDocs": {
- "type": "object",
- "description": "Allows referencing an external resource for extended documentation.",
- "required": [
- "url"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string"
- },
- "url": {
- "type": "string"
- }
- }
- },
- "parameter": {
- "type": "object",
- "description": "Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.",
- "required": [
- "name",
- "in"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "in": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "required": {
- "type": "boolean"
- },
- "deprecated": {
- "type": "boolean"
- },
- "allowEmptyValue": {
- "type": "boolean"
- },
- "style": {
- "type": "string"
- },
- "explode": {
- "type": "boolean"
- },
- "allowReserved": {
- "type": "boolean"
- },
- "schema": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "example": {
- "$ref": "#/definitions/any"
- },
- "examples": {
- "$ref": "#/definitions/examplesOrReferences"
- },
- "content": {
- "$ref": "#/definitions/mediaTypes"
- }
- }
- },
- "requestBody": {
- "type": "object",
- "description": "Describes a single request body.",
- "required": [
- "content"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string"
- },
- "content": {
- "$ref": "#/definitions/mediaTypes"
- },
- "required": {
- "type": "boolean"
- }
- }
- },
- "mediaType": {
- "type": "object",
- "description": "Each Media Type Object provides schema and examples for the media type identified by its key.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "schema": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "example": {
- "$ref": "#/definitions/any"
- },
- "examples": {
- "$ref": "#/definitions/examplesOrReferences"
- },
- "encoding": {
- "$ref": "#/definitions/encodings"
- }
- }
- },
- "encoding": {
- "type": "object",
- "description": "A single encoding definition applied to a single schema property.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "contentType": {
- "type": "string"
- },
- "headers": {
- "$ref": "#/definitions/headersOrReferences"
- },
- "style": {
- "type": "string"
- },
- "explode": {
- "type": "boolean"
- },
- "allowReserved": {
- "type": "boolean"
- }
- }
- },
- "responses": {
- "type": "object",
- "description": "A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.",
- "additionalProperties": false,
- "patternProperties": {
- "^([0-9X]{3})$": {
- "$ref": "#/definitions/responseOrReference"
- },
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "default": {
- "$ref": "#/definitions/responseOrReference"
- }
- }
- },
- "response": {
- "type": "object",
- "description": "Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.",
- "required": [
- "description"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string"
- },
- "headers": {
- "$ref": "#/definitions/headersOrReferences"
- },
- "content": {
- "$ref": "#/definitions/mediaTypes"
- },
- "links": {
- "$ref": "#/definitions/linksOrReferences"
- }
- }
- },
- "callback": {
- "type": "object",
- "description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.",
- "additionalProperties": false,
- "patternProperties": {
- "^": {
- "$ref": "#/definitions/pathItem"
- },
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- }
- },
- "example": {
- "type": "object",
- "description": "",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "summary": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "value": {
- "$ref": "#/definitions/any"
- },
- "externalValue": {
- "type": "string"
- }
- }
- },
- "link": {
- "type": "object",
- "description": "The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "operationRef": {
- "type": "string"
- },
- "operationId": {
- "type": "string"
- },
- "parameters": {
- "$ref": "#/definitions/anyOrExpression"
- },
- "requestBody": {
- "$ref": "#/definitions/anyOrExpression"
- },
- "description": {
- "type": "string"
- },
- "server": {
- "$ref": "#/definitions/server"
- }
- }
- },
- "header": {
- "type": "object",
- "description": "The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string"
- },
- "required": {
- "type": "boolean"
- },
- "deprecated": {
- "type": "boolean"
- },
- "allowEmptyValue": {
- "type": "boolean"
- },
- "style": {
- "type": "string"
- },
- "explode": {
- "type": "boolean"
- },
- "allowReserved": {
- "type": "boolean"
- },
- "schema": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "example": {
- "$ref": "#/definitions/any"
- },
- "examples": {
- "$ref": "#/definitions/examplesOrReferences"
- },
- "content": {
- "$ref": "#/definitions/mediaTypes"
- }
- }
- },
- "tag": {
- "type": "object",
- "description": "Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.",
- "required": [
- "name"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- }
- }
- },
- "reference": {
- "type": "object",
- "description": "A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.",
- "required": [
- "$ref"
- ],
- "additionalProperties": false,
- "properties": {
- "$ref": {
- "type": "string"
- },
- "summary": {
- "type": "string"
- },
- "description": {
- "type": "string"
- }
- }
- },
- "schema": {
- "type": "object",
- "description": "The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "nullable": {
- "type": "boolean"
- },
- "discriminator": {
- "$ref": "#/definitions/discriminator"
- },
- "readOnly": {
- "type": "boolean"
- },
- "writeOnly": {
- "type": "boolean"
- },
- "xml": {
- "$ref": "#/definitions/xml"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "example": {
- "$ref": "#/definitions/any"
- },
- "deprecated": {
- "type": "boolean"
- },
- "title": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
- },
- "multipleOf": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
- },
- "maximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxLength"
- },
- "minLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minLength"
- },
- "pattern": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
- },
- "maxItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxItems"
- },
- "minItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minItems"
- },
- "uniqueItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
- },
- "maxProperties": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maxProperties"
- },
- "minProperties": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minProperties"
- },
- "required": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/required"
- },
- "enum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
- },
- "type": {
- "type": "string"
- },
- "allOf": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "minItems": 1
- },
- "oneOf": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "minItems": 1
- },
- "anyOf": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "minItems": 1
- },
- "not": {
- "$ref": "#/definitions/schema"
- },
- "items": {
- "anyOf": [
- {
- "$ref": "#/definitions/schemaOrReference"
- },
- {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schemaOrReference"
- },
- "minItems": 1
- }
- ]
- },
- "properties": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/schemaOrReference"
- }
- },
- "additionalProperties": {
- "oneOf": [
- {
- "$ref": "#/definitions/schemaOrReference"
- },
- {
- "type": "boolean"
- }
- ]
- },
- "default": {
- "$ref": "#/definitions/defaultType"
- },
- "description": {
- "type": "string"
- },
- "format": {
- "type": "string"
- }
- }
- },
- "discriminator": {
- "type": "object",
- "description": "When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.",
- "required": [
- "propertyName"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "propertyName": {
- "type": "string"
- },
- "mapping": {
- "$ref": "#/definitions/strings"
- }
- }
- },
- "xml": {
- "type": "object",
- "description": "A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "name": {
- "type": "string"
- },
- "namespace": {
- "type": "string"
- },
- "prefix": {
- "type": "string"
- },
- "attribute": {
- "type": "boolean"
- },
- "wrapped": {
- "type": "boolean"
- }
- }
- },
- "securityScheme": {
- "type": "object",
- "description": "Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE.",
- "required": [
- "type"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "type": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "name": {
- "type": "string"
- },
- "in": {
- "type": "string"
- },
- "scheme": {
- "type": "string"
- },
- "bearerFormat": {
- "type": "string"
- },
- "flows": {
- "$ref": "#/definitions/oauthFlows"
- },
- "openIdConnectUrl": {
- "type": "string"
- }
- }
- },
- "oauthFlows": {
- "type": "object",
- "description": "Allows configuration of the supported OAuth Flows.",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "implicit": {
- "$ref": "#/definitions/oauthFlow"
- },
- "password": {
- "$ref": "#/definitions/oauthFlow"
- },
- "clientCredentials": {
- "$ref": "#/definitions/oauthFlow"
- },
- "authorizationCode": {
- "$ref": "#/definitions/oauthFlow"
- }
- }
- },
- "oauthFlow": {
- "type": "object",
- "description": "Configuration details for a supported OAuth Flow",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/specificationExtension"
- }
- },
- "properties": {
- "authorizationUrl": {
- "type": "string"
- },
- "tokenUrl": {
- "type": "string"
- },
- "refreshUrl": {
- "type": "string"
- },
- "scopes": {
- "$ref": "#/definitions/strings"
- }
- }
- },
- "securityRequirement": {
- "type": "object",
- "description": "Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.",
- "additionalProperties": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- }
- },
- "anyOrExpression": {
- "oneOf": [
- {
- "$ref": "#/definitions/any"
- },
- {
- "$ref": "#/definitions/expression"
- }
- ]
- },
- "callbackOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/callback"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "exampleOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/example"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "headerOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/header"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "linkOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/link"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "parameterOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/parameter"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "requestBodyOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/requestBody"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "responseOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/response"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "schemaOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/schema"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "securitySchemeOrReference": {
- "oneOf": [
- {
- "$ref": "#/definitions/securityScheme"
- },
- {
- "$ref": "#/definitions/reference"
- }
- ]
- },
- "callbacksOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/callbackOrReference"
- }
- },
- "encodings": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/encoding"
- }
- },
- "examplesOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/exampleOrReference"
- }
- },
- "headersOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/headerOrReference"
- }
- },
- "linksOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/linkOrReference"
- }
- },
- "mediaTypes": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/mediaType"
- }
- },
- "parametersOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/parameterOrReference"
- }
- },
- "requestBodiesOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/requestBodyOrReference"
- }
- },
- "responsesOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/responseOrReference"
- }
- },
- "schemasOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/schemaOrReference"
- }
- },
- "securitySchemesOrReferences": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/securitySchemeOrReference"
- }
- },
- "serverVariables": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/serverVariable"
- }
- },
- "strings": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "object": {
- "type": "object",
- "additionalProperties": true
- },
- "any": {
- "additionalProperties": true
- },
- "expression": {
- "type": "object",
- "additionalProperties": true
- },
- "specificationExtension": {
- "description": "Any property starting with x- is valid.",
- "oneOf": [
- {
- "type": "null"
- },
- {
- "type": "number"
- },
- {
- "type": "boolean"
- },
- {
- "type": "string"
- },
- {
- "type": "object"
- },
- {
- "type": "array"
- }
- ]
- },
- "defaultType": {
- "oneOf": [
- {
- "type": "null"
- },
- {
- "type": "array"
- },
- {
- "type": "object"
- },
- {
- "type": "number"
- },
- {
- "type": "boolean"
- },
- {
- "type": "string"
- }
- ]
- }
- }
-}
diff --git a/vendor/github.com/google/gofuzz/.travis.yml b/vendor/github.com/google/gofuzz/.travis.yml
index f8684d99f..061d72ae0 100644
--- a/vendor/github.com/google/gofuzz/.travis.yml
+++ b/vendor/github.com/google/gofuzz/.travis.yml
@@ -1,13 +1,10 @@
language: go
go:
- - 1.4
- - 1.3
- - 1.2
- - tip
-
-install:
- - if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
+ - 1.11.x
+ - 1.12.x
+ - 1.13.x
+ - master
script:
- go test -cover
diff --git a/vendor/github.com/google/gofuzz/CONTRIBUTING.md b/vendor/github.com/google/gofuzz/CONTRIBUTING.md
index 51cf5cd1a..97c1b34fd 100644
--- a/vendor/github.com/google/gofuzz/CONTRIBUTING.md
+++ b/vendor/github.com/google/gofuzz/CONTRIBUTING.md
@@ -1,7 +1,7 @@
# How to contribute #
We'd love to accept your patches and contributions to this project. There are
-a just a few small guidelines you need to follow.
+just a few small guidelines you need to follow.
## Contributor License Agreement ##
diff --git a/vendor/github.com/google/gofuzz/README.md b/vendor/github.com/google/gofuzz/README.md
index 386c2a457..b503aae7d 100644
--- a/vendor/github.com/google/gofuzz/README.md
+++ b/vendor/github.com/google/gofuzz/README.md
@@ -68,4 +68,22 @@ f.Fuzz(&myObject) // Type will correspond to whether A or B info is set.
See more examples in ```example_test.go```.
+You can use this library for easier [go-fuzz](https://github.com/dvyukov/go-fuzz)ing.
+go-fuzz provides the user a byte-slice, which should be converted to different inputs
+for the tested function. This library can help convert the byte slice. Consider for
+example a fuzz test for a the function `mypackage.MyFunc` that takes an int arguments:
+```go
+// +build gofuzz
+package mypackage
+
+import fuzz "github.com/google/gofuzz"
+
+func Fuzz(data []byte) int {
+ var i int
+ fuzz.NewFromGoFuzz(data).Fuzz(&i)
+ MyFunc(i)
+ return 0
+}
+```
+
Happy testing!
diff --git a/vendor/github.com/google/gofuzz/bytesource/bytesource.go b/vendor/github.com/google/gofuzz/bytesource/bytesource.go
new file mode 100644
index 000000000..5bb365949
--- /dev/null
+++ b/vendor/github.com/google/gofuzz/bytesource/bytesource.go
@@ -0,0 +1,81 @@
+/*
+Copyright 2014 Google Inc. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Package bytesource provides a rand.Source64 that is determined by a slice of bytes.
+package bytesource
+
+import (
+ "bytes"
+ "encoding/binary"
+ "io"
+ "math/rand"
+)
+
+// ByteSource implements rand.Source64 determined by a slice of bytes. The random numbers are
+// generated from each 8 bytes in the slice, until the last bytes are consumed, from which a
+// fallback pseudo random source is created in case more random numbers are required.
+// It also exposes a `bytes.Reader` API, which lets callers consume the bytes directly.
+type ByteSource struct {
+ *bytes.Reader
+ fallback rand.Source
+}
+
+// New returns a new ByteSource from a given slice of bytes.
+func New(input []byte) *ByteSource {
+ s := &ByteSource{
+ Reader: bytes.NewReader(input),
+ fallback: rand.NewSource(0),
+ }
+ if len(input) > 0 {
+ s.fallback = rand.NewSource(int64(s.consumeUint64()))
+ }
+ return s
+}
+
+func (s *ByteSource) Uint64() uint64 {
+ // Return from input if it was not exhausted.
+ if s.Len() > 0 {
+ return s.consumeUint64()
+ }
+
+ // Input was exhausted, return random number from fallback (in this case fallback should not be
+ // nil). Try first having a Uint64 output (Should work in current rand implementation),
+ // otherwise return a conversion of Int63.
+ if s64, ok := s.fallback.(rand.Source64); ok {
+ return s64.Uint64()
+ }
+ return uint64(s.fallback.Int63())
+}
+
+func (s *ByteSource) Int63() int64 {
+ return int64(s.Uint64() >> 1)
+}
+
+func (s *ByteSource) Seed(seed int64) {
+ s.fallback = rand.NewSource(seed)
+ s.Reader = bytes.NewReader(nil)
+}
+
+// consumeUint64 reads 8 bytes from the input and convert them to a uint64. It assumes that the the
+// bytes reader is not empty.
+func (s *ByteSource) consumeUint64() uint64 {
+ var bytes [8]byte
+ _, err := s.Read(bytes[:])
+ if err != nil && err != io.EOF {
+ panic("failed reading source") // Should not happen.
+ }
+ return binary.BigEndian.Uint64(bytes[:])
+}
diff --git a/vendor/github.com/google/gofuzz/fuzz.go b/vendor/github.com/google/gofuzz/fuzz.go
index da0a5f938..761520a8c 100644
--- a/vendor/github.com/google/gofuzz/fuzz.go
+++ b/vendor/github.com/google/gofuzz/fuzz.go
@@ -22,6 +22,9 @@ import (
"reflect"
"regexp"
"time"
+
+ "github.com/google/gofuzz/bytesource"
+ "strings"
)
// fuzzFuncMap is a map from a type to a fuzzFunc that handles that type.
@@ -61,6 +64,34 @@ func NewWithSeed(seed int64) *Fuzzer {
return f
}
+// NewFromGoFuzz is a helper function that enables using gofuzz (this
+// project) with go-fuzz (https://github.com/dvyukov/go-fuzz) for continuous
+// fuzzing. Essentially, it enables translating the fuzzing bytes from
+// go-fuzz to any Go object using this library.
+//
+// This implementation promises a constant translation from a given slice of
+// bytes to the fuzzed objects. This promise will remain over future
+// versions of Go and of this library.
+//
+// Note: the returned Fuzzer should not be shared between multiple goroutines,
+// as its deterministic output will no longer be available.
+//
+// Example: use go-fuzz to test the function `MyFunc(int)` in the package
+// `mypackage`. Add the file: "mypacakge_fuzz.go" with the content:
+//
+// // +build gofuzz
+// package mypacakge
+// import fuzz "github.com/google/gofuzz"
+// func Fuzz(data []byte) int {
+// var i int
+// fuzz.NewFromGoFuzz(data).Fuzz(&i)
+// MyFunc(i)
+// return 0
+// }
+func NewFromGoFuzz(data []byte) *Fuzzer {
+ return New().RandSource(bytesource.New(data))
+}
+
// Funcs adds each entry in fuzzFuncs as a custom fuzzing function.
//
// Each entry in fuzzFuncs must be a function taking two parameters.
@@ -141,7 +172,7 @@ func (f *Fuzzer) genElementCount() int {
}
func (f *Fuzzer) genShouldFill() bool {
- return f.r.Float64() > f.nilChance
+ return f.r.Float64() >= f.nilChance
}
// MaxDepth sets the maximum number of recursive fuzz calls that will be made
@@ -240,6 +271,7 @@ func (fc *fuzzerContext) doFuzz(v reflect.Value, flags uint64) {
fn(v, fc.fuzzer.r)
return
}
+
switch v.Kind() {
case reflect.Map:
if fc.fuzzer.genShouldFill() {
@@ -450,10 +482,10 @@ var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){
v.SetFloat(r.Float64())
},
reflect.Complex64: func(v reflect.Value, r *rand.Rand) {
- panic("unimplemented")
+ v.SetComplex(complex128(complex(r.Float32(), r.Float32())))
},
reflect.Complex128: func(v reflect.Value, r *rand.Rand) {
- panic("unimplemented")
+ v.SetComplex(complex(r.Float64(), r.Float64()))
},
reflect.String: func(v reflect.Value, r *rand.Rand) {
v.SetString(randString(r))
@@ -465,38 +497,105 @@ var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){
// randBool returns true or false randomly.
func randBool(r *rand.Rand) bool {
- if r.Int()&1 == 1 {
- return true
- }
- return false
+ return r.Int31()&(1<<30) == 0
+}
+
+type int63nPicker interface {
+ Int63n(int64) int64
}
-type charRange struct {
- first, last rune
+// UnicodeRange describes a sequential range of unicode characters.
+// Last must be numerically greater than First.
+type UnicodeRange struct {
+ First, Last rune
}
+// UnicodeRanges describes an arbitrary number of sequential ranges of unicode characters.
+// To be useful, each range must have at least one character (First <= Last) and
+// there must be at least one range.
+type UnicodeRanges []UnicodeRange
+
// choose returns a random unicode character from the given range, using the
// given randomness source.
-func (r *charRange) choose(rand *rand.Rand) rune {
- count := int64(r.last - r.first)
- return r.first + rune(rand.Int63n(count))
+func (ur UnicodeRange) choose(r int63nPicker) rune {
+ count := int64(ur.Last - ur.First + 1)
+ return ur.First + rune(r.Int63n(count))
+}
+
+// CustomStringFuzzFunc constructs a FuzzFunc which produces random strings.
+// Each character is selected from the range ur. If there are no characters
+// in the range (cr.Last < cr.First), this will panic.
+func (ur UnicodeRange) CustomStringFuzzFunc() func(s *string, c Continue) {
+ ur.check()
+ return func(s *string, c Continue) {
+ *s = ur.randString(c.Rand)
+ }
}
-var unicodeRanges = []charRange{
+// check is a function that used to check whether the first of ur(UnicodeRange)
+// is greater than the last one.
+func (ur UnicodeRange) check() {
+ if ur.Last < ur.First {
+ panic("The last encoding must be greater than the first one.")
+ }
+}
+
+// randString of UnicodeRange makes a random string up to 20 characters long.
+// Each character is selected form ur(UnicodeRange).
+func (ur UnicodeRange) randString(r *rand.Rand) string {
+ n := r.Intn(20)
+ sb := strings.Builder{}
+ sb.Grow(n)
+ for i := 0; i < n; i++ {
+ sb.WriteRune(ur.choose(r))
+ }
+ return sb.String()
+}
+
+// defaultUnicodeRanges sets a default unicode range when user do not set
+// CustomStringFuzzFunc() but wants fuzz string.
+var defaultUnicodeRanges = UnicodeRanges{
{' ', '~'}, // ASCII characters
{'\u00a0', '\u02af'}, // Multi-byte encoded characters
{'\u4e00', '\u9fff'}, // Common CJK (even longer encodings)
}
+// CustomStringFuzzFunc constructs a FuzzFunc which produces random strings.
+// Each character is selected from one of the ranges of ur(UnicodeRanges).
+// Each range has an equal probability of being chosen. If there are no ranges,
+// or a selected range has no characters (.Last < .First), this will panic.
+// Do not modify any of the ranges in ur after calling this function.
+func (ur UnicodeRanges) CustomStringFuzzFunc() func(s *string, c Continue) {
+ // Check unicode ranges slice is empty.
+ if len(ur) == 0 {
+ panic("UnicodeRanges is empty.")
+ }
+ // if not empty, each range should be checked.
+ for i := range ur {
+ ur[i].check()
+ }
+ return func(s *string, c Continue) {
+ *s = ur.randString(c.Rand)
+ }
+}
+
+// randString of UnicodeRanges makes a random string up to 20 characters long.
+// Each character is selected form one of the ranges of ur(UnicodeRanges),
+// and each range has an equal probability of being chosen.
+func (ur UnicodeRanges) randString(r *rand.Rand) string {
+ n := r.Intn(20)
+ sb := strings.Builder{}
+ sb.Grow(n)
+ for i := 0; i < n; i++ {
+ sb.WriteRune(ur[r.Intn(len(ur))].choose(r))
+ }
+ return sb.String()
+}
+
// randString makes a random string up to 20 characters long. The returned string
// may include a variety of (valid) UTF-8 encodings.
func randString(r *rand.Rand) string {
- n := r.Intn(20)
- runes := make([]rune, n)
- for i := range runes {
- runes[i] = unicodeRanges[r.Intn(len(unicodeRanges))].choose(r)
- }
- return string(runes)
+ return defaultUnicodeRanges.randString(r)
}
// randUint64 makes random 64 bit numbers.
diff --git a/vendor/github.com/google/uuid/.travis.yml b/vendor/github.com/google/uuid/.travis.yml
deleted file mode 100644
index d8156a60b..000000000
--- a/vendor/github.com/google/uuid/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-
-go:
- - 1.4.3
- - 1.5.3
- - tip
-
-script:
- - go test -v ./...
diff --git a/vendor/github.com/google/uuid/CHANGELOG.md b/vendor/github.com/google/uuid/CHANGELOG.md
new file mode 100644
index 000000000..7ec5ac7ea
--- /dev/null
+++ b/vendor/github.com/google/uuid/CHANGELOG.md
@@ -0,0 +1,41 @@
+# Changelog
+
+## [1.6.0](https://github.com/google/uuid/compare/v1.5.0...v1.6.0) (2024-01-16)
+
+
+### Features
+
+* add Max UUID constant ([#149](https://github.com/google/uuid/issues/149)) ([c58770e](https://github.com/google/uuid/commit/c58770eb495f55fe2ced6284f93c5158a62e53e3))
+
+
+### Bug Fixes
+
+* fix typo in version 7 uuid documentation ([#153](https://github.com/google/uuid/issues/153)) ([016b199](https://github.com/google/uuid/commit/016b199544692f745ffc8867b914129ecb47ef06))
+* Monotonicity in UUIDv7 ([#150](https://github.com/google/uuid/issues/150)) ([a2b2b32](https://github.com/google/uuid/commit/a2b2b32373ff0b1a312b7fdf6d38a977099698a6))
+
+## [1.5.0](https://github.com/google/uuid/compare/v1.4.0...v1.5.0) (2023-12-12)
+
+
+### Features
+
+* Validate UUID without creating new UUID ([#141](https://github.com/google/uuid/issues/141)) ([9ee7366](https://github.com/google/uuid/commit/9ee7366e66c9ad96bab89139418a713dc584ae29))
+
+## [1.4.0](https://github.com/google/uuid/compare/v1.3.1...v1.4.0) (2023-10-26)
+
+
+### Features
+
+* UUIDs slice type with Strings() convenience method ([#133](https://github.com/google/uuid/issues/133)) ([cd5fbbd](https://github.com/google/uuid/commit/cd5fbbdd02f3e3467ac18940e07e062be1f864b4))
+
+### Fixes
+
+* Clarify that Parse's job is to parse but not necessarily validate strings. (Documents current behavior)
+
+## [1.3.1](https://github.com/google/uuid/compare/v1.3.0...v1.3.1) (2023-08-18)
+
+
+### Bug Fixes
+
+* Use .EqualFold() to parse urn prefixed UUIDs ([#118](https://github.com/google/uuid/issues/118)) ([574e687](https://github.com/google/uuid/commit/574e6874943741fb99d41764c705173ada5293f0))
+
+## Changelog
diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md
index 04fdf09f1..a502fdc51 100644
--- a/vendor/github.com/google/uuid/CONTRIBUTING.md
+++ b/vendor/github.com/google/uuid/CONTRIBUTING.md
@@ -2,6 +2,22 @@
We definitely welcome patches and contribution to this project!
+### Tips
+
+Commits must be formatted according to the [Conventional Commits Specification](https://www.conventionalcommits.org).
+
+Always try to include a test case! If it is not possible or not necessary,
+please explain why in the pull request description.
+
+### Releasing
+
+Commits that would precipitate a SemVer change, as described in the Conventional
+Commits Specification, will trigger [`release-please`](https://github.com/google-github-actions/release-please-action)
+to create a release candidate pull request. Once submitted, `release-please`
+will create a release.
+
+For tips on how to work with `release-please`, see its documentation.
+
### Legal requirements
In order to protect both you and ourselves, you will need to sign the
diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md
index f765a46f9..3e9a61889 100644
--- a/vendor/github.com/google/uuid/README.md
+++ b/vendor/github.com/google/uuid/README.md
@@ -1,6 +1,6 @@
-# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master)
+# uuid
The uuid package generates and inspects UUIDs based on
-[RFC 4122](http://tools.ietf.org/html/rfc4122)
+[RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122)
and DCE 1.1: Authentication and Security Services.
This package is based on the github.com/pborman/uuid package (previously named
@@ -9,10 +9,12 @@ a UUID is a 16 byte array rather than a byte slice. One loss due to this
change is the ability to represent an invalid UUID (vs a NIL UUID).
###### Install
-`go get github.com/google/uuid`
+```sh
+go get github.com/google/uuid
+```
###### Documentation
-[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid)
+[![Go Reference](https://pkg.go.dev/badge/github.com/google/uuid.svg)](https://pkg.go.dev/github.com/google/uuid)
Full `go doc` style documentation for the package can be viewed online without
installing this package by using the GoDoc site here:
diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go
index b17461631..dc60082d3 100644
--- a/vendor/github.com/google/uuid/hash.go
+++ b/vendor/github.com/google/uuid/hash.go
@@ -17,6 +17,12 @@ var (
NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8"))
NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8"))
Nil UUID // empty UUID, all zeros
+
+ // The Max UUID is special form of UUID that is specified to have all 128 bits set to 1.
+ Max = UUID{
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ }
)
// NewHash returns a new UUID derived from the hash of space concatenated with
@@ -26,8 +32,8 @@ var (
// NewMD5 and NewSHA1.
func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID {
h.Reset()
- h.Write(space[:])
- h.Write(data)
+ h.Write(space[:]) //nolint:errcheck
+ h.Write(data) //nolint:errcheck
s := h.Sum(nil)
var uuid UUID
copy(uuid[:], s)
diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go
index 24b78edc9..b2a0bc871 100644
--- a/vendor/github.com/google/uuid/node_js.go
+++ b/vendor/github.com/google/uuid/node_js.go
@@ -7,6 +7,6 @@
package uuid
// getHardwareInterface returns nil values for the JS version of the code.
-// This remvoves the "net" dependency, because it is not used in the browser.
+// This removes the "net" dependency, because it is not used in the browser.
// Using the "net" library inflates the size of the transpiled JS code by 673k bytes.
func getHardwareInterface(name string) (string, []byte) { return "", nil }
diff --git a/vendor/github.com/google/uuid/null.go b/vendor/github.com/google/uuid/null.go
new file mode 100644
index 000000000..d7fcbf286
--- /dev/null
+++ b/vendor/github.com/google/uuid/null.go
@@ -0,0 +1,118 @@
+// Copyright 2021 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package uuid
+
+import (
+ "bytes"
+ "database/sql/driver"
+ "encoding/json"
+ "fmt"
+)
+
+var jsonNull = []byte("null")
+
+// NullUUID represents a UUID that may be null.
+// NullUUID implements the SQL driver.Scanner interface so
+// it can be used as a scan destination:
+//
+// var u uuid.NullUUID
+// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u)
+// ...
+// if u.Valid {
+// // use u.UUID
+// } else {
+// // NULL value
+// }
+//
+type NullUUID struct {
+ UUID UUID
+ Valid bool // Valid is true if UUID is not NULL
+}
+
+// Scan implements the SQL driver.Scanner interface.
+func (nu *NullUUID) Scan(value interface{}) error {
+ if value == nil {
+ nu.UUID, nu.Valid = Nil, false
+ return nil
+ }
+
+ err := nu.UUID.Scan(value)
+ if err != nil {
+ nu.Valid = false
+ return err
+ }
+
+ nu.Valid = true
+ return nil
+}
+
+// Value implements the driver Valuer interface.
+func (nu NullUUID) Value() (driver.Value, error) {
+ if !nu.Valid {
+ return nil, nil
+ }
+ // Delegate to UUID Value function
+ return nu.UUID.Value()
+}
+
+// MarshalBinary implements encoding.BinaryMarshaler.
+func (nu NullUUID) MarshalBinary() ([]byte, error) {
+ if nu.Valid {
+ return nu.UUID[:], nil
+ }
+
+ return []byte(nil), nil
+}
+
+// UnmarshalBinary implements encoding.BinaryUnmarshaler.
+func (nu *NullUUID) UnmarshalBinary(data []byte) error {
+ if len(data) != 16 {
+ return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
+ }
+ copy(nu.UUID[:], data)
+ nu.Valid = true
+ return nil
+}
+
+// MarshalText implements encoding.TextMarshaler.
+func (nu NullUUID) MarshalText() ([]byte, error) {
+ if nu.Valid {
+ return nu.UUID.MarshalText()
+ }
+
+ return jsonNull, nil
+}
+
+// UnmarshalText implements encoding.TextUnmarshaler.
+func (nu *NullUUID) UnmarshalText(data []byte) error {
+ id, err := ParseBytes(data)
+ if err != nil {
+ nu.Valid = false
+ return err
+ }
+ nu.UUID = id
+ nu.Valid = true
+ return nil
+}
+
+// MarshalJSON implements json.Marshaler.
+func (nu NullUUID) MarshalJSON() ([]byte, error) {
+ if nu.Valid {
+ return json.Marshal(nu.UUID)
+ }
+
+ return jsonNull, nil
+}
+
+// UnmarshalJSON implements json.Unmarshaler.
+func (nu *NullUUID) UnmarshalJSON(data []byte) error {
+ if bytes.Equal(data, jsonNull) {
+ *nu = NullUUID{}
+ return nil // valid null UUID
+ }
+ err := json.Unmarshal(data, &nu.UUID)
+ nu.Valid = err == nil
+ return err
+}
diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go
index f326b54db..2e02ec06c 100644
--- a/vendor/github.com/google/uuid/sql.go
+++ b/vendor/github.com/google/uuid/sql.go
@@ -9,7 +9,7 @@ import (
"fmt"
)
-// Scan implements sql.Scanner so UUIDs can be read from databases transparently
+// Scan implements sql.Scanner so UUIDs can be read from databases transparently.
// Currently, database types that map to string and []byte are supported. Please
// consult database-specific driver documentation for matching types.
func (uuid *UUID) Scan(src interface{}) error {
diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go
index e6ef06cdc..c35112927 100644
--- a/vendor/github.com/google/uuid/time.go
+++ b/vendor/github.com/google/uuid/time.go
@@ -108,12 +108,23 @@ func setClockSequence(seq int) {
}
// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in
-// uuid. The time is only defined for version 1 and 2 UUIDs.
+// uuid. The time is only defined for version 1, 2, 6 and 7 UUIDs.
func (uuid UUID) Time() Time {
- time := int64(binary.BigEndian.Uint32(uuid[0:4]))
- time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32
- time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48
- return Time(time)
+ var t Time
+ switch uuid.Version() {
+ case 6:
+ time := binary.BigEndian.Uint64(uuid[:8]) // Ignore uuid[6] version b0110
+ t = Time(time)
+ case 7:
+ time := binary.BigEndian.Uint64(uuid[:8])
+ t = Time((time>>16)*10000 + g1582ns100)
+ default: // forward compatible
+ time := int64(binary.BigEndian.Uint32(uuid[0:4]))
+ time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32
+ time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48
+ t = Time(time)
+ }
+ return t
}
// ClockSequence returns the clock sequence encoded in uuid.
diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go
index 524404cc5..5232b4867 100644
--- a/vendor/github.com/google/uuid/uuid.go
+++ b/vendor/github.com/google/uuid/uuid.go
@@ -12,6 +12,7 @@ import (
"fmt"
"io"
"strings"
+ "sync"
)
// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC
@@ -33,13 +34,37 @@ const (
Future // Reserved for future definition.
)
-var rander = rand.Reader // random function
+const randPoolSize = 16 * 16
-// Parse decodes s into a UUID or returns an error. Both the standard UUID
-// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
-// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the
-// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex
-// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
+var (
+ rander = rand.Reader // random function
+ poolEnabled = false
+ poolMu sync.Mutex
+ poolPos = randPoolSize // protected with poolMu
+ pool [randPoolSize]byte // protected with poolMu
+)
+
+type invalidLengthError struct{ len int }
+
+func (err invalidLengthError) Error() string {
+ return fmt.Sprintf("invalid UUID length: %d", err.len)
+}
+
+// IsInvalidLengthError is matcher function for custom error invalidLengthError
+func IsInvalidLengthError(err error) bool {
+ _, ok := err.(invalidLengthError)
+ return ok
+}
+
+// Parse decodes s into a UUID or returns an error if it cannot be parsed. Both
+// the standard UUID forms defined in RFC 4122
+// (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
+// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition,
+// Parse accepts non-standard strings such as the raw hex encoding
+// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and 38 byte "Microsoft style" encodings,
+// e.g. {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. Only the middle 36 bytes are
+// examined in the latter case. Parse should not be used to validate strings as
+// it parses non-standard encodings as indicated above.
func Parse(s string) (UUID, error) {
var uuid UUID
switch len(s) {
@@ -48,7 +73,7 @@ func Parse(s string) (UUID, error) {
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
case 36 + 9:
- if strings.ToLower(s[:9]) != "urn:uuid:" {
+ if !strings.EqualFold(s[:9], "urn:uuid:") {
return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9])
}
s = s[9:]
@@ -68,7 +93,7 @@ func Parse(s string) (UUID, error) {
}
return uuid, nil
default:
- return uuid, fmt.Errorf("invalid UUID length: %d", len(s))
+ return uuid, invalidLengthError{len(s)}
}
// s is now at least 36 bytes long
// it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
@@ -80,7 +105,8 @@ func Parse(s string) (UUID, error) {
9, 11,
14, 16,
19, 21,
- 24, 26, 28, 30, 32, 34} {
+ 24, 26, 28, 30, 32, 34,
+ } {
v, ok := xtob(s[x], s[x+1])
if !ok {
return uuid, errors.New("invalid UUID format")
@@ -96,7 +122,7 @@ func ParseBytes(b []byte) (UUID, error) {
switch len(b) {
case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) {
+ if !bytes.EqualFold(b[:9], []byte("urn:uuid:")) {
return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9])
}
b = b[9:]
@@ -112,7 +138,7 @@ func ParseBytes(b []byte) (UUID, error) {
}
return uuid, nil
default:
- return uuid, fmt.Errorf("invalid UUID length: %d", len(b))
+ return uuid, invalidLengthError{len(b)}
}
// s is now at least 36 bytes long
// it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
@@ -124,7 +150,8 @@ func ParseBytes(b []byte) (UUID, error) {
9, 11,
14, 16,
19, 21,
- 24, 26, 28, 30, 32, 34} {
+ 24, 26, 28, 30, 32, 34,
+ } {
v, ok := xtob(b[x], b[x+1])
if !ok {
return uuid, errors.New("invalid UUID format")
@@ -159,6 +186,59 @@ func Must(uuid UUID, err error) UUID {
return uuid
}
+// Validate returns an error if s is not a properly formatted UUID in one of the following formats:
+// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
+// It returns an error if the format is invalid, otherwise nil.
+func Validate(s string) error {
+ switch len(s) {
+ // Standard UUID format
+ case 36:
+
+ // UUID with "urn:uuid:" prefix
+ case 36 + 9:
+ if !strings.EqualFold(s[:9], "urn:uuid:") {
+ return fmt.Errorf("invalid urn prefix: %q", s[:9])
+ }
+ s = s[9:]
+
+ // UUID enclosed in braces
+ case 36 + 2:
+ if s[0] != '{' || s[len(s)-1] != '}' {
+ return fmt.Errorf("invalid bracketed UUID format")
+ }
+ s = s[1 : len(s)-1]
+
+ // UUID without hyphens
+ case 32:
+ for i := 0; i < len(s); i += 2 {
+ _, ok := xtob(s[i], s[i+1])
+ if !ok {
+ return errors.New("invalid UUID format")
+ }
+ }
+
+ default:
+ return invalidLengthError{len(s)}
+ }
+
+ // Check for standard UUID format
+ if len(s) == 36 {
+ if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' {
+ return errors.New("invalid UUID format")
+ }
+ for _, x := range []int{0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24, 26, 28, 30, 32, 34} {
+ if _, ok := xtob(s[x], s[x+1]); !ok {
+ return errors.New("invalid UUID format")
+ }
+ }
+ }
+
+ return nil
+}
+
// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
// , or "" if uuid is invalid.
func (uuid UUID) String() string {
@@ -243,3 +323,43 @@ func SetRand(r io.Reader) {
}
rander = r
}
+
+// EnableRandPool enables internal randomness pool used for Random
+// (Version 4) UUID generation. The pool contains random bytes read from
+// the random number generator on demand in batches. Enabling the pool
+// may improve the UUID generation throughput significantly.
+//
+// Since the pool is stored on the Go heap, this feature may be a bad fit
+// for security sensitive applications.
+//
+// Both EnableRandPool and DisableRandPool are not thread-safe and should
+// only be called when there is no possibility that New or any other
+// UUID Version 4 generation function will be called concurrently.
+func EnableRandPool() {
+ poolEnabled = true
+}
+
+// DisableRandPool disables the randomness pool if it was previously
+// enabled with EnableRandPool.
+//
+// Both EnableRandPool and DisableRandPool are not thread-safe and should
+// only be called when there is no possibility that New or any other
+// UUID Version 4 generation function will be called concurrently.
+func DisableRandPool() {
+ poolEnabled = false
+ defer poolMu.Unlock()
+ poolMu.Lock()
+ poolPos = randPoolSize
+}
+
+// UUIDs is a slice of UUID types.
+type UUIDs []UUID
+
+// Strings returns a string slice containing the string form of each UUID in uuids.
+func (uuids UUIDs) Strings() []string {
+ var uuidStrs = make([]string, len(uuids))
+ for i, uuid := range uuids {
+ uuidStrs[i] = uuid.String()
+ }
+ return uuidStrs
+}
diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go
index c110465db..7697802e4 100644
--- a/vendor/github.com/google/uuid/version4.go
+++ b/vendor/github.com/google/uuid/version4.go
@@ -14,11 +14,21 @@ func New() UUID {
return Must(NewRandom())
}
+// NewString creates a new random UUID and returns it as a string or panics.
+// NewString is equivalent to the expression
+//
+// uuid.New().String()
+func NewString() string {
+ return Must(NewRandom()).String()
+}
+
// NewRandom returns a Random (Version 4) UUID.
//
// The strength of the UUIDs is based on the strength of the crypto/rand
// package.
//
+// Uses the randomness pool if it was enabled with EnableRandPool.
+//
// A note about uniqueness derived from the UUID Wikipedia entry:
//
// Randomly generated UUIDs have 122 random bits. One's annual risk of being
@@ -27,7 +37,10 @@ func New() UUID {
// equivalent to the odds of creating a few tens of trillions of UUIDs in a
// year and having one duplicate.
func NewRandom() (UUID, error) {
- return NewRandomFromReader(rander)
+ if !poolEnabled {
+ return NewRandomFromReader(rander)
+ }
+ return newRandomFromPool()
}
// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader.
@@ -41,3 +54,23 @@ func NewRandomFromReader(r io.Reader) (UUID, error) {
uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
return uuid, nil
}
+
+func newRandomFromPool() (UUID, error) {
+ var uuid UUID
+ poolMu.Lock()
+ if poolPos == randPoolSize {
+ _, err := io.ReadFull(rander, pool[:])
+ if err != nil {
+ poolMu.Unlock()
+ return Nil, err
+ }
+ poolPos = 0
+ }
+ copy(uuid[:], pool[poolPos:(poolPos+16)])
+ poolPos += 16
+ poolMu.Unlock()
+
+ uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
+ uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
+ return uuid, nil
+}
diff --git a/vendor/github.com/google/uuid/version6.go b/vendor/github.com/google/uuid/version6.go
new file mode 100644
index 000000000..339a959a7
--- /dev/null
+++ b/vendor/github.com/google/uuid/version6.go
@@ -0,0 +1,56 @@
+// Copyright 2023 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package uuid
+
+import "encoding/binary"
+
+// UUID version 6 is a field-compatible version of UUIDv1, reordered for improved DB locality.
+// It is expected that UUIDv6 will primarily be used in contexts where there are existing v1 UUIDs.
+// Systems that do not involve legacy UUIDv1 SHOULD consider using UUIDv7 instead.
+//
+// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#uuidv6
+//
+// NewV6 returns a Version 6 UUID based on the current NodeID and clock
+// sequence, and the current time. If the NodeID has not been set by SetNodeID
+// or SetNodeInterface then it will be set automatically. If the NodeID cannot
+// be set NewV6 set NodeID is random bits automatically . If clock sequence has not been set by
+// SetClockSequence then it will be set automatically. If GetTime fails to
+// return the current NewV6 returns Nil and an error.
+func NewV6() (UUID, error) {
+ var uuid UUID
+ now, seq, err := GetTime()
+ if err != nil {
+ return uuid, err
+ }
+
+ /*
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | time_high |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | time_mid | time_low_and_version |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |clk_seq_hi_res | clk_seq_low | node (0-1) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | node (2-5) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+ binary.BigEndian.PutUint64(uuid[0:], uint64(now))
+ binary.BigEndian.PutUint16(uuid[8:], seq)
+
+ uuid[6] = 0x60 | (uuid[6] & 0x0F)
+ uuid[8] = 0x80 | (uuid[8] & 0x3F)
+
+ nodeMu.Lock()
+ if nodeID == zeroID {
+ setNodeInterface("")
+ }
+ copy(uuid[10:], nodeID[:])
+ nodeMu.Unlock()
+
+ return uuid, nil
+}
diff --git a/vendor/github.com/google/uuid/version7.go b/vendor/github.com/google/uuid/version7.go
new file mode 100644
index 000000000..3167b643d
--- /dev/null
+++ b/vendor/github.com/google/uuid/version7.go
@@ -0,0 +1,104 @@
+// Copyright 2023 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package uuid
+
+import (
+ "io"
+)
+
+// UUID version 7 features a time-ordered value field derived from the widely
+// implemented and well known Unix Epoch timestamp source,
+// the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded.
+// As well as improved entropy characteristics over versions 1 or 6.
+//
+// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#name-uuid-version-7
+//
+// Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible.
+//
+// NewV7 returns a Version 7 UUID based on the current time(Unix Epoch).
+// Uses the randomness pool if it was enabled with EnableRandPool.
+// On error, NewV7 returns Nil and an error
+func NewV7() (UUID, error) {
+ uuid, err := NewRandom()
+ if err != nil {
+ return uuid, err
+ }
+ makeV7(uuid[:])
+ return uuid, nil
+}
+
+// NewV7FromReader returns a Version 7 UUID based on the current time(Unix Epoch).
+// it use NewRandomFromReader fill random bits.
+// On error, NewV7FromReader returns Nil and an error.
+func NewV7FromReader(r io.Reader) (UUID, error) {
+ uuid, err := NewRandomFromReader(r)
+ if err != nil {
+ return uuid, err
+ }
+
+ makeV7(uuid[:])
+ return uuid, nil
+}
+
+// makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6])
+// uuid[8] already has the right version number (Variant is 10)
+// see function NewV7 and NewV7FromReader
+func makeV7(uuid []byte) {
+ /*
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | unix_ts_ms |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | unix_ts_ms | ver | rand_a (12 bit seq) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |var| rand_b |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | rand_b |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+ _ = uuid[15] // bounds check
+
+ t, s := getV7Time()
+
+ uuid[0] = byte(t >> 40)
+ uuid[1] = byte(t >> 32)
+ uuid[2] = byte(t >> 24)
+ uuid[3] = byte(t >> 16)
+ uuid[4] = byte(t >> 8)
+ uuid[5] = byte(t)
+
+ uuid[6] = 0x70 | (0x0F & byte(s>>8))
+ uuid[7] = byte(s)
+}
+
+// lastV7time is the last time we returned stored as:
+//
+// 52 bits of time in milliseconds since epoch
+// 12 bits of (fractional nanoseconds) >> 8
+var lastV7time int64
+
+const nanoPerMilli = 1000000
+
+// getV7Time returns the time in milliseconds and nanoseconds / 256.
+// The returned (milli << 12 + seq) is guarenteed to be greater than
+// (milli << 12 + seq) returned by any previous call to getV7Time.
+func getV7Time() (milli, seq int64) {
+ timeMu.Lock()
+ defer timeMu.Unlock()
+
+ nano := timeNow().UnixNano()
+ milli = nano / nanoPerMilli
+ // Sequence number is between 0 and 3906 (nanoPerMilli>>8)
+ seq = (nano - milli*nanoPerMilli) >> 8
+ now := milli<<12 + seq
+ if now <= lastV7time {
+ now = lastV7time + 1
+ milli = now >> 12
+ seq = now & 0xfff
+ }
+ lastV7time = now
+ return milli, seq
+}
diff --git a/vendor/github.com/x448/float16/.travis.yml b/vendor/github.com/x448/float16/.travis.yml
new file mode 100644
index 000000000..8902bdaaf
--- /dev/null
+++ b/vendor/github.com/x448/float16/.travis.yml
@@ -0,0 +1,13 @@
+language: go
+
+go:
+ - 1.11.x
+
+env:
+ - GO111MODULE=on
+
+script:
+ - go test -short -coverprofile=coverage.txt -covermode=count ./...
+
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/x448/float16/LICENSE b/vendor/github.com/x448/float16/LICENSE
new file mode 100644
index 000000000..bf6e35785
--- /dev/null
+++ b/vendor/github.com/x448/float16/LICENSE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/vendor/github.com/x448/float16/README.md b/vendor/github.com/x448/float16/README.md
new file mode 100644
index 000000000..b524b8135
--- /dev/null
+++ b/vendor/github.com/x448/float16/README.md
@@ -0,0 +1,133 @@
+# Float16 (Binary16) in Go/Golang
+[![Build Status](https://travis-ci.org/x448/float16.svg?branch=master)](https://travis-ci.org/x448/float16)
+[![codecov](https://codecov.io/gh/x448/float16/branch/master/graph/badge.svg?v=4)](https://codecov.io/gh/x448/float16)
+[![Go Report Card](https://goreportcard.com/badge/github.com/x448/float16)](https://goreportcard.com/report/github.com/x448/float16)
+[![Release](https://img.shields.io/github/release/x448/float16.svg?style=flat-square)](https://github.com/x448/float16/releases)
+[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/x448/float16/master/LICENSE)
+
+`float16` package provides [IEEE 754 half-precision floating-point format (binary16)](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) with IEEE 754 default rounding for conversions. IEEE 754-2008 refers to this 16-bit floating-point format as binary16.
+
+IEEE 754 default rounding ("Round-to-Nearest RoundTiesToEven") is considered the most accurate and statistically unbiased estimate of the true result.
+
+All possible 4+ billion floating-point conversions with this library are verified to be correct.
+
+Lowercase "float16" refers to IEEE 754 binary16. And capitalized "Float16" refers to exported Go data type provided by this library.
+
+## Features
+Current features include:
+
+* float16 to float32 conversions use lossless conversion.
+* float32 to float16 conversions use IEEE 754-2008 "Round-to-Nearest RoundTiesToEven".
+* conversions using pure Go take about 2.65 ns/op on a desktop amd64.
+* unit tests provide 100% code coverage and check all possible 4+ billion conversions.
+* other functions include: IsInf(), IsNaN(), IsNormal(), PrecisionFromfloat32(), String(), etc.
+* all functions in this library use zero allocs except String().
+
+## Status
+This library is used by [fxamacker/cbor](https://github.com/fxamacker/cbor) and is ready for production use on supported platforms. The version number < 1.0 indicates more functions and options are planned but not yet published.
+
+Current status:
+
+* core API is done and breaking API changes are unlikely.
+* 100% of unit tests pass:
+ * short mode (`go test -short`) tests around 65765 conversions in 0.005s.
+ * normal mode (`go test`) tests all possible 4+ billion conversions in about 95s.
+* 100% code coverage with both short mode and normal mode.
+* tested on amd64 but it should work on all little-endian platforms supported by Go.
+
+Roadmap:
+
+* add functions for fast batch conversions leveraging SIMD when supported by hardware.
+* speed up unit test when verifying all possible 4+ billion conversions.
+* test on additional platforms.
+
+## Float16 to Float32 Conversion
+Conversions from float16 to float32 are lossless conversions. All 65536 possible float16 to float32 conversions (in pure Go) are confirmed to be correct.
+
+Unit tests take a fraction of a second to check all 65536 expected values for float16 to float32 conversions.
+
+## Float32 to Float16 Conversion
+Conversions from float32 to float16 use IEEE 754 default rounding ("Round-to-Nearest RoundTiesToEven"). All 4294967296 possible float32 to float16 conversions (in pure Go) are confirmed to be correct.
+
+Unit tests in normal mode take about 1-2 minutes to check all 4+ billion float32 input values and results for Fromfloat32(), FromNaN32ps(), and PrecisionFromfloat32().
+
+Unit tests in short mode use a small subset (around 229 float32 inputs) and finish in under 0.01 second while still reaching 100% code coverage.
+
+## Usage
+Install with `go get github.com/x448/float16`.
+```
+// Convert float32 to float16
+pi := float32(math.Pi)
+pi16 := float16.Fromfloat32(pi)
+
+// Convert float16 to float32
+pi32 := pi16.Float32()
+
+// PrecisionFromfloat32() is faster than the overhead of calling a function.
+// This example only converts if there's no data loss and input is not a subnormal.
+if float16.PrecisionFromfloat32(pi) == float16.PrecisionExact {
+ pi16 := float16.Fromfloat32(pi)
+}
+```
+
+## Float16 Type and API
+Float16 (capitalized) is a Go type with uint16 as the underlying state. There are 6 exported functions and 9 exported methods.
+```
+package float16 // import "github.com/x448/float16"
+
+// Exported types and consts
+type Float16 uint16
+const ErrInvalidNaNValue = float16Error("float16: invalid NaN value, expected IEEE 754 NaN")
+
+// Exported functions
+Fromfloat32(f32 float32) Float16 // Float16 number converted from f32 using IEEE 754 default rounding
+ with identical results to AMD and Intel F16C hardware. NaN inputs
+ are converted with quiet bit always set on, to be like F16C.
+
+FromNaN32ps(nan float32) (Float16, error) // Float16 NaN without modifying quiet bit.
+ // The "ps" suffix means "preserve signaling".
+ // Returns sNaN and ErrInvalidNaNValue if nan isn't a NaN.
+
+Frombits(b16 uint16) Float16 // Float16 number corresponding to b16 (IEEE 754 binary16 rep.)
+NaN() Float16 // Float16 of IEEE 754 binary16 not-a-number
+Inf(sign int) Float16 // Float16 of IEEE 754 binary16 infinity according to sign
+
+PrecisionFromfloat32(f32 float32) Precision // quickly indicates exact, ..., overflow, underflow
+ // (inline and < 1 ns/op)
+// Exported methods
+(f Float16) Float32() float32 // float32 number converted from f16 using lossless conversion
+(f Float16) Bits() uint16 // the IEEE 754 binary16 representation of f
+(f Float16) IsNaN() bool // true if f is not-a-number (NaN)
+(f Float16) IsQuietNaN() bool // true if f is a quiet not-a-number (NaN)
+(f Float16) IsInf(sign int) bool // true if f is infinite based on sign (-1=NegInf, 0=any, 1=PosInf)
+(f Float16) IsFinite() bool // true if f is not infinite or NaN
+(f Float16) IsNormal() bool // true if f is not zero, infinite, subnormal, or NaN.
+(f Float16) Signbit() bool // true if f is negative or negative zero
+(f Float16) String() string // string representation of f to satisfy fmt.Stringer interface
+```
+See [API](https://godoc.org/github.com/x448/float16) at godoc.org for more info.
+
+## Benchmarks
+Conversions (in pure Go) are around 2.65 ns/op for float16 -> float32 and float32 -> float16 on amd64. Speeds can vary depending on input value.
+
+```
+All functions have zero allocations except float16.String().
+
+FromFloat32pi-2 2.59ns ± 0% // speed using Fromfloat32() to convert a float32 of math.Pi to Float16
+ToFloat32pi-2 2.69ns ± 0% // speed using Float32() to convert a float16 of math.Pi to float32
+Frombits-2 0.29ns ± 5% // speed using Frombits() to cast a uint16 to Float16
+
+PrecisionFromFloat32-2 0.29ns ± 1% // speed using PrecisionFromfloat32() to check for overflows, etc.
+```
+
+## System Requirements
+* Tested on Go 1.11, 1.12, and 1.13 but it should also work with older versions.
+* Tested on amd64 but it should also work on all little-endian platforms supported by Go.
+
+## Special Thanks
+Special thanks to Kathryn Long (starkat99) for creating [half-rs](https://github.com/starkat99/half-rs), a very nice rust implementation of float16.
+
+## License
+Copyright (c) 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker
+
+Licensed under [MIT License](LICENSE)
diff --git a/vendor/github.com/x448/float16/float16.go b/vendor/github.com/x448/float16/float16.go
new file mode 100644
index 000000000..1a0e6dad0
--- /dev/null
+++ b/vendor/github.com/x448/float16/float16.go
@@ -0,0 +1,302 @@
+// Copyright 2019 Montgomery Edwards⁴⁴⁸ and Faye Amacker
+//
+// Special thanks to Kathryn Long for her Rust implementation
+// of float16 at github.com/starkat99/half-rs (MIT license)
+
+package float16
+
+import (
+ "math"
+ "strconv"
+)
+
+// Float16 represents IEEE 754 half-precision floating-point numbers (binary16).
+type Float16 uint16
+
+// Precision indicates whether the conversion to Float16 is
+// exact, subnormal without dropped bits, inexact, underflow, or overflow.
+type Precision int
+
+const (
+
+ // PrecisionExact is for non-subnormals that don't drop bits during conversion.
+ // All of these can round-trip. Should always convert to float16.
+ PrecisionExact Precision = iota
+
+ // PrecisionUnknown is for subnormals that don't drop bits during conversion but
+ // not all of these can round-trip so precision is unknown without more effort.
+ // Only 2046 of these can round-trip and the rest cannot round-trip.
+ PrecisionUnknown
+
+ // PrecisionInexact is for dropped significand bits and cannot round-trip.
+ // Some of these are subnormals. Cannot round-trip float32->float16->float32.
+ PrecisionInexact
+
+ // PrecisionUnderflow is for Underflows. Cannot round-trip float32->float16->float32.
+ PrecisionUnderflow
+
+ // PrecisionOverflow is for Overflows. Cannot round-trip float32->float16->float32.
+ PrecisionOverflow
+)
+
+// PrecisionFromfloat32 returns Precision without performing
+// the conversion. Conversions from both Infinity and NaN
+// values will always report PrecisionExact even if NaN payload
+// or NaN-Quiet-Bit is lost. This function is kept simple to
+// allow inlining and run < 0.5 ns/op, to serve as a fast filter.
+func PrecisionFromfloat32(f32 float32) Precision {
+ u32 := math.Float32bits(f32)
+
+ if u32 == 0 || u32 == 0x80000000 {
+ // +- zero will always be exact conversion
+ return PrecisionExact
+ }
+
+ const COEFMASK uint32 = 0x7fffff // 23 least significant bits
+ const EXPSHIFT uint32 = 23
+ const EXPBIAS uint32 = 127
+ const EXPMASK uint32 = uint32(0xff) << EXPSHIFT
+ const DROPMASK uint32 = COEFMASK >> 10
+
+ exp := int32(((u32 & EXPMASK) >> EXPSHIFT) - EXPBIAS)
+ coef := u32 & COEFMASK
+
+ if exp == 128 {
+ // +- infinity or NaN
+ // apps may want to do extra checks for NaN separately
+ return PrecisionExact
+ }
+
+ // https://en.wikipedia.org/wiki/Half-precision_floating-point_format says,
+ // "Decimals between 2^−24 (minimum positive subnormal) and 2^−14 (maximum subnormal): fixed interval 2^−24"
+ if exp < -24 {
+ return PrecisionUnderflow
+ }
+ if exp > 15 {
+ return PrecisionOverflow
+ }
+ if (coef & DROPMASK) != uint32(0) {
+ // these include subnormals and non-subnormals that dropped bits
+ return PrecisionInexact
+ }
+
+ if exp < -14 {
+ // Subnormals. Caller may want to test these further.
+ // There are 2046 subnormals that can successfully round-trip f32->f16->f32
+ // and 20 of those 2046 have 32-bit input coef == 0.
+ // RFC 7049 and 7049bis Draft 12 don't precisely define "preserves value"
+ // so some protocols and libraries will choose to handle subnormals differently
+ // when deciding to encode them to CBOR float32 vs float16.
+ return PrecisionUnknown
+ }
+
+ return PrecisionExact
+}
+
+// Frombits returns the float16 number corresponding to the IEEE 754 binary16
+// representation u16, with the sign bit of u16 and the result in the same bit
+// position. Frombits(Bits(x)) == x.
+func Frombits(u16 uint16) Float16 {
+ return Float16(u16)
+}
+
+// Fromfloat32 returns a Float16 value converted from f32. Conversion uses
+// IEEE default rounding (nearest int, with ties to even).
+func Fromfloat32(f32 float32) Float16 {
+ return Float16(f32bitsToF16bits(math.Float32bits(f32)))
+}
+
+// ErrInvalidNaNValue indicates a NaN was not received.
+const ErrInvalidNaNValue = float16Error("float16: invalid NaN value, expected IEEE 754 NaN")
+
+type float16Error string
+
+func (e float16Error) Error() string { return string(e) }
+
+// FromNaN32ps converts nan to IEEE binary16 NaN while preserving both
+// signaling and payload. Unlike Fromfloat32(), which can only return
+// qNaN because it sets quiet bit = 1, this can return both sNaN and qNaN.
+// If the result is infinity (sNaN with empty payload), then the
+// lowest bit of payload is set to make the result a NaN.
+// Returns ErrInvalidNaNValue and 0x7c01 (sNaN) if nan isn't IEEE 754 NaN.
+// This function was kept simple to be able to inline.
+func FromNaN32ps(nan float32) (Float16, error) {
+ const SNAN = Float16(uint16(0x7c01)) // signalling NaN
+
+ u32 := math.Float32bits(nan)
+ sign := u32 & 0x80000000
+ exp := u32 & 0x7f800000
+ coef := u32 & 0x007fffff
+
+ if (exp != 0x7f800000) || (coef == 0) {
+ return SNAN, ErrInvalidNaNValue
+ }
+
+ u16 := uint16((sign >> 16) | uint32(0x7c00) | (coef >> 13))
+
+ if (u16 & 0x03ff) == 0 {
+ // result became infinity, make it NaN by setting lowest bit in payload
+ u16 = u16 | 0x0001
+ }
+
+ return Float16(u16), nil
+}
+
+// NaN returns a Float16 of IEEE 754 binary16 not-a-number (NaN).
+// Returned NaN value 0x7e01 has all exponent bits = 1 with the
+// first and last bits = 1 in the significand. This is consistent
+// with Go's 64-bit math.NaN(). Canonical CBOR in RFC 7049 uses 0x7e00.
+func NaN() Float16 {
+ return Float16(0x7e01)
+}
+
+// Inf returns a Float16 with an infinity value with the specified sign.
+// A sign >= returns positive infinity.
+// A sign < 0 returns negative infinity.
+func Inf(sign int) Float16 {
+ if sign >= 0 {
+ return Float16(0x7c00)
+ }
+ return Float16(0x8000 | 0x7c00)
+}
+
+// Float32 returns a float32 converted from f (Float16).
+// This is a lossless conversion.
+func (f Float16) Float32() float32 {
+ u32 := f16bitsToF32bits(uint16(f))
+ return math.Float32frombits(u32)
+}
+
+// Bits returns the IEEE 754 binary16 representation of f, with the sign bit
+// of f and the result in the same bit position. Bits(Frombits(x)) == x.
+func (f Float16) Bits() uint16 {
+ return uint16(f)
+}
+
+// IsNaN reports whether f is an IEEE 754 binary16 “not-a-number” value.
+func (f Float16) IsNaN() bool {
+ return (f&0x7c00 == 0x7c00) && (f&0x03ff != 0)
+}
+
+// IsQuietNaN reports whether f is a quiet (non-signaling) IEEE 754 binary16
+// “not-a-number” value.
+func (f Float16) IsQuietNaN() bool {
+ return (f&0x7c00 == 0x7c00) && (f&0x03ff != 0) && (f&0x0200 != 0)
+}
+
+// IsInf reports whether f is an infinity (inf).
+// A sign > 0 reports whether f is positive inf.
+// A sign < 0 reports whether f is negative inf.
+// A sign == 0 reports whether f is either inf.
+func (f Float16) IsInf(sign int) bool {
+ return ((f == 0x7c00) && sign >= 0) ||
+ (f == 0xfc00 && sign <= 0)
+}
+
+// IsFinite returns true if f is neither infinite nor NaN.
+func (f Float16) IsFinite() bool {
+ return (uint16(f) & uint16(0x7c00)) != uint16(0x7c00)
+}
+
+// IsNormal returns true if f is neither zero, infinite, subnormal, or NaN.
+func (f Float16) IsNormal() bool {
+ exp := uint16(f) & uint16(0x7c00)
+ return (exp != uint16(0x7c00)) && (exp != 0)
+}
+
+// Signbit reports whether f is negative or negative zero.
+func (f Float16) Signbit() bool {
+ return (uint16(f) & uint16(0x8000)) != 0
+}
+
+// String satisfies the fmt.Stringer interface.
+func (f Float16) String() string {
+ return strconv.FormatFloat(float64(f.Float32()), 'f', -1, 32)
+}
+
+// f16bitsToF32bits returns uint32 (float32 bits) converted from specified uint16.
+func f16bitsToF32bits(in uint16) uint32 {
+ // All 65536 conversions with this were confirmed to be correct
+ // by Montgomery Edwards⁴⁴⁸ (github.com/x448).
+
+ sign := uint32(in&0x8000) << 16 // sign for 32-bit
+ exp := uint32(in&0x7c00) >> 10 // exponenent for 16-bit
+ coef := uint32(in&0x03ff) << 13 // significand for 32-bit
+
+ if exp == 0x1f {
+ if coef == 0 {
+ // infinity
+ return sign | 0x7f800000 | coef
+ }
+ // NaN
+ return sign | 0x7fc00000 | coef
+ }
+
+ if exp == 0 {
+ if coef == 0 {
+ // zero
+ return sign
+ }
+
+ // normalize subnormal numbers
+ exp++
+ for coef&0x7f800000 == 0 {
+ coef <<= 1
+ exp--
+ }
+ coef &= 0x007fffff
+ }
+
+ return sign | ((exp + (0x7f - 0xf)) << 23) | coef
+}
+
+// f32bitsToF16bits returns uint16 (Float16 bits) converted from the specified float32.
+// Conversion rounds to nearest integer with ties to even.
+func f32bitsToF16bits(u32 uint32) uint16 {
+ // Translated from Rust to Go by Montgomery Edwards⁴⁴⁸ (github.com/x448).
+ // All 4294967296 conversions with this were confirmed to be correct by x448.
+ // Original Rust implementation is by Kathryn Long (github.com/starkat99) with MIT license.
+
+ sign := u32 & 0x80000000
+ exp := u32 & 0x7f800000
+ coef := u32 & 0x007fffff
+
+ if exp == 0x7f800000 {
+ // NaN or Infinity
+ nanBit := uint32(0)
+ if coef != 0 {
+ nanBit = uint32(0x0200)
+ }
+ return uint16((sign >> 16) | uint32(0x7c00) | nanBit | (coef >> 13))
+ }
+
+ halfSign := sign >> 16
+
+ unbiasedExp := int32(exp>>23) - 127
+ halfExp := unbiasedExp + 15
+
+ if halfExp >= 0x1f {
+ return uint16(halfSign | uint32(0x7c00))
+ }
+
+ if halfExp <= 0 {
+ if 14-halfExp > 24 {
+ return uint16(halfSign)
+ }
+ coef := coef | uint32(0x00800000)
+ halfCoef := coef >> uint32(14-halfExp)
+ roundBit := uint32(1) << uint32(13-halfExp)
+ if (coef&roundBit) != 0 && (coef&(3*roundBit-1)) != 0 {
+ halfCoef++
+ }
+ return uint16(halfSign | halfCoef)
+ }
+
+ uHalfExp := uint32(halfExp) << 10
+ halfCoef := coef >> 13
+ roundBit := uint32(0x00001000)
+ if (coef&roundBit) != 0 && (coef&(3*roundBit-1)) != 0 {
+ return uint16((halfSign | uHalfExp | halfCoef) + 1)
+ }
+ return uint16(halfSign | uHalfExp | halfCoef)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
index 155648acb..1a9f5e770 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS
@@ -2,7 +2,6 @@
reviewers:
- thockin
- - lavalamp
- smarterclayton
- wojtek-t
- deads2k
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go b/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
index 60c8209de..cbdf2eeb8 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go
@@ -22,14 +22,15 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
-// SetStatusCondition sets the corresponding condition in conditions to newCondition.
+// SetStatusCondition sets the corresponding condition in conditions to newCondition and returns true
+// if the conditions are changed by this call.
// conditions must be non-nil.
// 1. if the condition of the specified type already exists (all fields of the existing condition are updated to
// newCondition, LastTransitionTime is set to now if the new status differs from the old status)
// 2. if a condition of the specified type does not exist (LastTransitionTime is set to now() if unset, and newCondition is appended)
-func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Condition) {
+func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Condition) (changed bool) {
if conditions == nil {
- return
+ return false
}
existingCondition := FindStatusCondition(*conditions, newCondition.Type)
if existingCondition == nil {
@@ -37,7 +38,7 @@ func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Cond
newCondition.LastTransitionTime = metav1.NewTime(time.Now())
}
*conditions = append(*conditions, newCondition)
- return
+ return true
}
if existingCondition.Status != newCondition.Status {
@@ -47,18 +48,31 @@ func SetStatusCondition(conditions *[]metav1.Condition, newCondition metav1.Cond
} else {
existingCondition.LastTransitionTime = metav1.NewTime(time.Now())
}
+ changed = true
}
- existingCondition.Reason = newCondition.Reason
- existingCondition.Message = newCondition.Message
- existingCondition.ObservedGeneration = newCondition.ObservedGeneration
+ if existingCondition.Reason != newCondition.Reason {
+ existingCondition.Reason = newCondition.Reason
+ changed = true
+ }
+ if existingCondition.Message != newCondition.Message {
+ existingCondition.Message = newCondition.Message
+ changed = true
+ }
+ if existingCondition.ObservedGeneration != newCondition.ObservedGeneration {
+ existingCondition.ObservedGeneration = newCondition.ObservedGeneration
+ changed = true
+ }
+
+ return changed
}
-// RemoveStatusCondition removes the corresponding conditionType from conditions.
+// RemoveStatusCondition removes the corresponding conditionType from conditions if present. Returns
+// true if it was present and got removed.
// conditions must be non-nil.
-func RemoveStatusCondition(conditions *[]metav1.Condition, conditionType string) {
+func RemoveStatusCondition(conditions *[]metav1.Condition, conditionType string) (removed bool) {
if conditions == nil || len(*conditions) == 0 {
- return
+ return false
}
newConditions := make([]metav1.Condition, 0, len(*conditions)-1)
for _, condition := range *conditions {
@@ -67,7 +81,10 @@ func RemoveStatusCondition(conditions *[]metav1.Condition, conditionType string)
}
}
+ removed = len(*conditions) != len(newConditions)
*conditions = newConditions
+
+ return removed
}
// FindStatusCondition finds the conditionType in conditions.
diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/help.go b/vendor/k8s.io/apimachinery/pkg/api/meta/help.go
index 899d3e8a6..1fdd32c4b 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/meta/help.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/meta/help.go
@@ -40,8 +40,7 @@ var (
// IsListType returns true if the provided Object has a slice called Items.
// TODO: Replace the code in this check with an interface comparison by
-//
-// creating and enforcing that lists implement a list accessor.
+// creating and enforcing that lists implement a list accessor.
func IsListType(obj runtime.Object) bool {
switch t := obj.(type) {
case runtime.Unstructured:
@@ -113,8 +112,27 @@ func getItemsPtr(list runtime.Object) (interface{}, error) {
// EachListItem invokes fn on each runtime.Object in the list. Any error immediately terminates
// the loop.
+//
+// If items passed to fn are retained for different durations, and you want to avoid
+// retaining all items in obj as long as any item is referenced, use EachListItemWithAlloc instead.
func EachListItem(obj runtime.Object, fn func(runtime.Object) error) error {
+ return eachListItem(obj, fn, false)
+}
+
+// EachListItemWithAlloc works like EachListItem, but avoids retaining references to the items slice in obj.
+// It does this by making a shallow copy of non-pointer items in obj.
+//
+// If the items passed to fn are not retained, or are retained for the same duration, use EachListItem instead for memory efficiency.
+func EachListItemWithAlloc(obj runtime.Object, fn func(runtime.Object) error) error {
+ return eachListItem(obj, fn, true)
+}
+
+// allocNew: Whether shallow copy is required when the elements in Object.Items are struct
+func eachListItem(obj runtime.Object, fn func(runtime.Object) error, allocNew bool) error {
if unstructured, ok := obj.(runtime.Unstructured); ok {
+ if allocNew {
+ return unstructured.EachListItemWithAlloc(fn)
+ }
return unstructured.EachListItem(fn)
}
// TODO: Change to an interface call?
@@ -141,8 +159,19 @@ func EachListItem(obj runtime.Object, fn func(runtime.Object) error) error {
for i := 0; i < len; i++ {
raw := items.Index(i)
if takeAddr {
- raw = raw.Addr()
+ if allocNew {
+ // shallow copy to avoid retaining a reference to the original list item
+ itemCopy := reflect.New(raw.Type())
+ // assign to itemCopy and type-assert
+ itemCopy.Elem().Set(raw)
+ // reflect.New will guarantee that itemCopy must be a pointer.
+ raw = itemCopy
+ } else {
+ raw = raw.Addr()
+ }
}
+ // raw must be a pointer or an interface
+ // allocate a pointer is cheap
switch item := raw.Interface().(type) {
case *runtime.RawExtension:
if err := fn(item.Object); err != nil {
@@ -167,7 +196,23 @@ func EachListItem(obj runtime.Object, fn func(runtime.Object) error) error {
// ExtractList returns obj's Items element as an array of runtime.Objects.
// Returns an error if obj is not a List type (does not have an Items member).
+//
+// If items in the returned list are retained for different durations, and you want to avoid
+// retaining all items in obj as long as any item is referenced, use ExtractListWithAlloc instead.
func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
+ return extractList(obj, false)
+}
+
+// ExtractListWithAlloc works like ExtractList, but avoids retaining references to the items slice in obj.
+// It does this by making a shallow copy of non-pointer items in obj.
+//
+// If the items in the returned list are not retained, or are retained for the same duration, use ExtractList instead for memory efficiency.
+func ExtractListWithAlloc(obj runtime.Object) ([]runtime.Object, error) {
+ return extractList(obj, true)
+}
+
+// allocNew: Whether shallow copy is required when the elements in Object.Items are struct
+func extractList(obj runtime.Object, allocNew bool) ([]runtime.Object, error) {
itemsPtr, err := GetItemsPtr(obj)
if err != nil {
return nil, err
@@ -177,10 +222,17 @@ func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
return nil, err
}
list := make([]runtime.Object, items.Len())
+ if len(list) == 0 {
+ return list, nil
+ }
+ elemType := items.Type().Elem()
+ isRawExtension := elemType == rawExtensionObjectType
+ implementsObject := elemType.Implements(objectType)
for i := range list {
raw := items.Index(i)
- switch item := raw.Interface().(type) {
- case runtime.RawExtension:
+ switch {
+ case isRawExtension:
+ item := raw.Interface().(runtime.RawExtension)
switch {
case item.Object != nil:
list[i] = item.Object
@@ -190,8 +242,18 @@ func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
default:
list[i] = nil
}
- case runtime.Object:
- list[i] = item
+ case implementsObject:
+ list[i] = raw.Interface().(runtime.Object)
+ case allocNew:
+ // shallow copy to avoid retaining a reference to the original list item
+ itemCopy := reflect.New(raw.Type())
+ // assign to itemCopy and type-assert
+ itemCopy.Elem().Set(raw)
+ var ok bool
+ // reflect.New will guarantee that itemCopy must be a pointer.
+ if list[i], ok = itemCopy.Interface().(runtime.Object); !ok {
+ return nil, fmt.Errorf("%v: item[%v]: Expected object, got %#v(%s)", obj, i, raw.Interface(), raw.Kind())
+ }
default:
var found bool
if list[i], found = raw.Addr().Interface().(runtime.Object); !found {
@@ -202,8 +264,12 @@ func ExtractList(obj runtime.Object) ([]runtime.Object, error) {
return list, nil
}
-// objectSliceType is the type of a slice of Objects
-var objectSliceType = reflect.TypeOf([]runtime.Object{})
+var (
+ // objectSliceType is the type of a slice of Objects
+ objectSliceType = reflect.TypeOf([]runtime.Object{})
+ objectType = reflect.TypeOf((*runtime.Object)(nil)).Elem()
+ rawExtensionObjectType = reflect.TypeOf(runtime.RawExtension{})
+)
// LenList returns the length of this list or 0 if it is not a list.
func LenList(list runtime.Object) int {
@@ -238,7 +304,7 @@ func SetList(list runtime.Object, objects []runtime.Object) error {
slice := reflect.MakeSlice(items.Type(), len(objects), len(objects))
for i := range objects {
dest := slice.Index(i)
- if dest.Type() == reflect.TypeOf(runtime.RawExtension{}) {
+ if dest.Type() == rawExtensionObjectType {
dest = dest.FieldByName("Object")
}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS
index d1c9f5307..063fd285d 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS
@@ -2,7 +2,6 @@
reviewers:
- thockin
- - lavalamp
- smarterclayton
- wojtek-t
- derekwaynecarr
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go b/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go
index a8866a43e..2eebec667 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/amount.go
@@ -203,6 +203,44 @@ func (a *int64Amount) Sub(b int64Amount) bool {
return a.Add(int64Amount{value: -b.value, scale: b.scale})
}
+// Mul multiplies the provided b to the current amount, or
+// returns false if overflow or underflow would result.
+func (a *int64Amount) Mul(b int64) bool {
+ switch {
+ case a.value == 0:
+ return true
+ case b == 0:
+ a.value = 0
+ a.scale = 0
+ return true
+ case a.scale == 0:
+ c, ok := int64Multiply(a.value, b)
+ if !ok {
+ return false
+ }
+ a.value = c
+ case a.scale > 0:
+ c, ok := int64Multiply(a.value, b)
+ if !ok {
+ return false
+ }
+ if _, ok = positiveScaleInt64(c, a.scale); !ok {
+ return false
+ }
+ a.value = c
+ default:
+ c, ok := int64Multiply(a.value, b)
+ if !ok {
+ return false
+ }
+ if _, ok = negativeScaleInt64(c, -a.scale); !ok {
+ return false
+ }
+ a.value = c
+ }
+ return true
+}
+
// AsScale adjusts this amount to set a minimum scale, rounding up, and returns true iff no precision
// was lost. (1.1e5).AsScale(5) would return 1.1e5, but (1.1e5).AsScale(6) would return 1e6.
func (a int64Amount) AsScale(scale Scale) (int64Amount, bool) {
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
index 53a25d344..c3a272168 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto
+// source: k8s.io/apimachinery/pkg/api/resource/generated.proto
package resource
@@ -41,7 +41,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *Quantity) Reset() { *m = Quantity{} }
func (*Quantity) ProtoMessage() {}
func (*Quantity) Descriptor() ([]byte, []int) {
- return fileDescriptor_612bba87bd70906c, []int{0}
+ return fileDescriptor_7288c78ff45111e9, []int{0}
}
func (m *Quantity) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Quantity.Unmarshal(m, b)
@@ -64,7 +64,7 @@ var xxx_messageInfo_Quantity proto.InternalMessageInfo
func (m *QuantityValue) Reset() { *m = QuantityValue{} }
func (*QuantityValue) ProtoMessage() {}
func (*QuantityValue) Descriptor() ([]byte, []int) {
- return fileDescriptor_612bba87bd70906c, []int{1}
+ return fileDescriptor_7288c78ff45111e9, []int{1}
}
func (m *QuantityValue) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_QuantityValue.Unmarshal(m, b)
@@ -90,25 +90,24 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto", fileDescriptor_612bba87bd70906c)
+ proto.RegisterFile("k8s.io/apimachinery/pkg/api/resource/generated.proto", fileDescriptor_7288c78ff45111e9)
}
-var fileDescriptor_612bba87bd70906c = []byte{
- // 254 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xf2, 0xcd, 0xb6, 0x28, 0xd6,
- 0xcb, 0xcc, 0xd7, 0xcf, 0x2e, 0x4d, 0x4a, 0x2d, 0xca, 0x4b, 0x2d, 0x49, 0x2d, 0xd6, 0x2f, 0x4b,
- 0xcd, 0x4b, 0xc9, 0x2f, 0xd2, 0x87, 0x4a, 0x24, 0x16, 0x64, 0xe6, 0x26, 0x26, 0x67, 0x64, 0xe6,
- 0xa5, 0x16, 0x55, 0xea, 0x17, 0x64, 0xa7, 0x83, 0x04, 0xf4, 0x8b, 0x52, 0x8b, 0xf3, 0x4b, 0x8b,
- 0x92, 0x53, 0xf5, 0xd3, 0x53, 0xf3, 0x52, 0x8b, 0x12, 0x4b, 0x52, 0x53, 0xf4, 0x0a, 0x8a, 0xf2,
- 0x4b, 0xf2, 0x85, 0x54, 0x20, 0xba, 0xf4, 0x90, 0x75, 0xe9, 0x15, 0x64, 0xa7, 0x83, 0x04, 0xf4,
- 0x60, 0xba, 0xa4, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3,
- 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0x9a, 0x93, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x18,
- 0xaa, 0x64, 0xc1, 0xc5, 0x11, 0x58, 0x9a, 0x98, 0x57, 0x92, 0x59, 0x52, 0x29, 0x24, 0xc6, 0xc5,
- 0x56, 0x5c, 0x52, 0x94, 0x99, 0x97, 0x2e, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe5, 0x59,
- 0x89, 0xcc, 0x58, 0x20, 0xcf, 0xd0, 0xb1, 0x50, 0x9e, 0x61, 0xc2, 0x42, 0x79, 0x86, 0x05, 0x0b,
- 0xe5, 0x19, 0x1a, 0xee, 0x28, 0x30, 0x28, 0xd9, 0x72, 0xf1, 0xc2, 0x74, 0x86, 0x25, 0xe6, 0x94,
- 0xa6, 0x92, 0xa6, 0xdd, 0xc9, 0xeb, 0xc4, 0x43, 0x39, 0x86, 0x0b, 0x0f, 0xe5, 0x18, 0x6e, 0x3c,
- 0x94, 0x63, 0x68, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x37,
- 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0x43, 0x94, 0x0a, 0x31, 0x21,
- 0x05, 0x08, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x70, 0x98, 0xa3, 0x69, 0x01, 0x00, 0x00,
+var fileDescriptor_7288c78ff45111e9 = []byte{
+ // 234 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xc9, 0xb6, 0x28, 0xd6,
+ 0xcb, 0xcc, 0xd7, 0x4f, 0x2c, 0xc8, 0xcc, 0x4d, 0x4c, 0xce, 0xc8, 0xcc, 0x4b, 0x2d, 0xaa, 0xd4,
+ 0x2f, 0xc8, 0x4e, 0x07, 0x09, 0xe8, 0x17, 0xa5, 0x16, 0xe7, 0x97, 0x16, 0x25, 0xa7, 0xea, 0xa7,
+ 0xa7, 0xe6, 0xa5, 0x16, 0x25, 0x96, 0xa4, 0xa6, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xa9,
+ 0x40, 0x74, 0xe9, 0x21, 0xeb, 0xd2, 0x2b, 0xc8, 0x4e, 0x07, 0x09, 0xe8, 0xc1, 0x74, 0x49, 0xe9,
+ 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7, 0xeb,
+ 0x83, 0x35, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0x31, 0x54, 0xc9, 0x82, 0x8b,
+ 0x23, 0xb0, 0x34, 0x31, 0xaf, 0x24, 0xb3, 0xa4, 0x52, 0x48, 0x8c, 0x8b, 0xad, 0xb8, 0xa4, 0x28,
+ 0x33, 0x2f, 0x5d, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xca, 0xb3, 0x12, 0x99, 0xb1, 0x40,
+ 0x9e, 0xa1, 0x63, 0xa1, 0x3c, 0xc3, 0x84, 0x85, 0xf2, 0x0c, 0x0b, 0x16, 0xca, 0x33, 0x34, 0xdc,
+ 0x51, 0x60, 0x50, 0xb2, 0xe5, 0xe2, 0x85, 0xe9, 0x0c, 0x4b, 0xcc, 0x29, 0x4d, 0x25, 0x4d, 0xbb,
+ 0x93, 0xd7, 0x89, 0x87, 0x72, 0x0c, 0x17, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 0xc7, 0xd0, 0xf0,
+ 0x48, 0x8e, 0xf1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c,
+ 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x28, 0x15, 0x62, 0x42, 0x0a, 0x10, 0x00, 0x00,
+ 0xff, 0xff, 0x50, 0x91, 0xd0, 0x9c, 0x50, 0x01, 0x00, 0x00,
}
diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
index b47d554b3..50af8334f 100644
--- a/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
+++ b/vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go
@@ -25,6 +25,8 @@ import (
"strconv"
"strings"
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
+
inf "gopkg.in/inf.v0"
)
@@ -592,6 +594,16 @@ func (q *Quantity) Sub(y Quantity) {
q.ToDec().d.Dec.Sub(q.d.Dec, y.AsDec())
}
+// Mul multiplies the provided y to the current value.
+// It will return false if the result is inexact. Otherwise, it will return true.
+func (q *Quantity) Mul(y int64) bool {
+ q.s = ""
+ if q.d.Dec == nil && q.i.Mul(y) {
+ return true
+ }
+ return q.ToDec().d.Dec.Mul(q.d.Dec, inf.NewDec(y, inf.Scale(0))).UnscaledBig().IsInt64()
+}
+
// Cmp returns 0 if the quantity is equal to y, -1 if the quantity is less than y, or 1 if the
// quantity is greater than y.
func (q *Quantity) Cmp(y Quantity) int {
@@ -673,6 +685,12 @@ func (q Quantity) MarshalJSON() ([]byte, error) {
return result, nil
}
+func (q Quantity) MarshalCBOR() ([]byte, error) {
+ // The call to String() should never return the string "" because the receiver's
+ // address will never be nil.
+ return cbor.Marshal(q.String())
+}
+
// ToUnstructured implements the value.UnstructuredConverter interface.
func (q Quantity) ToUnstructured() interface{} {
return q.String()
@@ -701,6 +719,27 @@ func (q *Quantity) UnmarshalJSON(value []byte) error {
return nil
}
+func (q *Quantity) UnmarshalCBOR(value []byte) error {
+ var s *string
+ if err := cbor.Unmarshal(value, &s); err != nil {
+ return err
+ }
+
+ if s == nil {
+ q.d.Dec = nil
+ q.i = int64Amount{}
+ return nil
+ }
+
+ parsed, err := ParseQuantity(strings.TrimSpace(*s))
+ if err != nil {
+ return err
+ }
+
+ *q = parsed
+ return nil
+}
+
// NewDecimalQuantity returns a new Quantity representing the given
// value in the given format.
func NewDecimalQuantity(b inf.Dec, format Format) *Quantity {
diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/validation/OWNERS
new file mode 100644
index 000000000..402373247
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/api/validation/OWNERS
@@ -0,0 +1,11 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+# Disable inheritance as this is an api owners file
+options:
+ no_parent_owners: true
+approvers:
+ - api-approvers
+reviewers:
+ - api-reviewers
+labels:
+ - kind/api-change
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go
new file mode 100644
index 000000000..29c6a48b6
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/defaults.go
@@ -0,0 +1,38 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internalversion
+
+import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+// SetListOptionsDefaults sets defaults on the provided ListOptions if applicable.
+//
+// TODO(#115478): once the watch-list fg is always on we register this function in the scheme (via AddTypeDefaultingFunc).
+// TODO(#115478): when the function is registered in the scheme remove all callers of this method.
+func SetListOptionsDefaults(obj *ListOptions, isWatchListFeatureEnabled bool) {
+ if !isWatchListFeatureEnabled {
+ return
+ }
+ if obj.SendInitialEvents != nil || len(obj.ResourceVersionMatch) != 0 {
+ return
+ }
+ legacy := obj.ResourceVersion == "" || obj.ResourceVersion == "0"
+ if obj.Watch && legacy {
+ turnOnInitialEvents := true
+ obj.SendInitialEvents = &turnOnInitialEvents
+ obj.ResourceVersionMatch = metav1.ResourceVersionMatchNotOlderThan
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go
index a49b5f2be..00d2b8c68 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go
@@ -66,6 +66,31 @@ type ListOptions struct {
// it does not recognize and will return a 410 error if the token can no longer be used because
// it has expired.
Continue string
+
+ // `sendInitialEvents=true` may be set together with `watch=true`.
+ // In that case, the watch stream will begin with synthetic events to
+ // produce the current state of objects in the collection. Once all such
+ // events have been sent, a synthetic "Bookmark" event will be sent.
+ // The bookmark will report the ResourceVersion (RV) corresponding to the
+ // set of objects, and be marked with `"k8s.io/initial-events-end": "true"` annotation.
+ // Afterwards, the watch stream will proceed as usual, sending watch events
+ // corresponding to changes (subsequent to the RV) to objects watched.
+ //
+ // When `sendInitialEvents` option is set, we require `resourceVersionMatch`
+ // option to also be set. The semantic of the watch request is as following:
+ // - `resourceVersionMatch` = NotOlderThan
+ // is interpreted as "data at least as new as the provided `resourceVersion`"
+ // and the bookmark event is send when the state is synced
+ // to a `resourceVersion` at least as fresh as the one provided by the ListOptions.
+ // If `resourceVersion` is unset, this is interpreted as "consistent read" and the
+ // bookmark event is send when the state is synced at least to the moment
+ // when request started being processed.
+ // - `resourceVersionMatch` set to any other value or unset
+ // Invalid error is returned.
+ //
+ // Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward
+ // compatibility reasons) and to false otherwise.
+ SendInitialEvents *bool
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/validation/validation.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/validation/validation.go
index 8403d1a86..2734a8f3b 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/validation/validation.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/validation/validation.go
@@ -17,18 +17,20 @@ limitations under the License.
package validation
import (
+ "fmt"
+
"k8s.io/apimachinery/pkg/apis/meta/internalversion"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
)
// ValidateListOptions returns all validation errors found while validating the ListOptions.
-func ValidateListOptions(options *internalversion.ListOptions) field.ErrorList {
+func ValidateListOptions(options *internalversion.ListOptions, isWatchListFeatureEnabled bool) field.ErrorList {
+ if options.Watch {
+ return validateWatchOptions(options, isWatchListFeatureEnabled)
+ }
allErrs := field.ErrorList{}
if match := options.ResourceVersionMatch; len(match) > 0 {
- if options.Watch {
- allErrs = append(allErrs, field.Forbidden(field.NewPath("resourceVersionMatch"), "resourceVersionMatch is forbidden for watch"))
- }
if len(options.ResourceVersion) == 0 {
allErrs = append(allErrs, field.Forbidden(field.NewPath("resourceVersionMatch"), "resourceVersionMatch is forbidden unless resourceVersion is provided"))
}
@@ -42,5 +44,33 @@ func ValidateListOptions(options *internalversion.ListOptions) field.ErrorList {
allErrs = append(allErrs, field.Forbidden(field.NewPath("resourceVersionMatch"), "resourceVersionMatch \"exact\" is forbidden for resourceVersion \"0\""))
}
}
+ if options.SendInitialEvents != nil {
+ allErrs = append(allErrs, field.Forbidden(field.NewPath("sendInitialEvents"), "sendInitialEvents is forbidden for list"))
+ }
+ return allErrs
+}
+
+func validateWatchOptions(options *internalversion.ListOptions, isWatchListFeatureEnabled bool) field.ErrorList {
+ allErrs := field.ErrorList{}
+ match := options.ResourceVersionMatch
+ if options.SendInitialEvents != nil {
+ if match != metav1.ResourceVersionMatchNotOlderThan {
+ allErrs = append(allErrs, field.Forbidden(field.NewPath("resourceVersionMatch"), fmt.Sprintf("sendInitialEvents requires setting resourceVersionMatch to %s", metav1.ResourceVersionMatchNotOlderThan)))
+ }
+ if !isWatchListFeatureEnabled {
+ allErrs = append(allErrs, field.Forbidden(field.NewPath("sendInitialEvents"), "sendInitialEvents is forbidden for watch unless the WatchList feature gate is enabled"))
+ }
+ }
+ if len(match) > 0 {
+ if options.SendInitialEvents == nil {
+ allErrs = append(allErrs, field.Forbidden(field.NewPath("resourceVersionMatch"), "resourceVersionMatch is forbidden for watch unless sendInitialEvents is provided"))
+ }
+ if match != metav1.ResourceVersionMatchNotOlderThan {
+ allErrs = append(allErrs, field.NotSupported(field.NewPath("resourceVersionMatch"), match, []string{string(metav1.ResourceVersionMatchNotOlderThan)}))
+ }
+ if len(options.Continue) > 0 {
+ allErrs = append(allErrs, field.Forbidden(field.NewPath("resourceVersionMatch"), "resourceVersionMatch is forbidden when continue is provided"))
+ }
+ }
return allErrs
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
index 6d212b846..a6552c276 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go
@@ -115,6 +115,7 @@ func autoConvert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions,
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
out.Limit = in.Limit
out.Continue = in.Continue
+ out.SendInitialEvents = (*bool)(unsafe.Pointer(in.SendInitialEvents))
return nil
}
@@ -137,6 +138,7 @@ func autoConvert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOption
out.TimeoutSeconds = (*int64)(unsafe.Pointer(in.TimeoutSeconds))
out.Limit = in.Limit
out.Continue = in.Continue
+ out.SendInitialEvents = (*bool)(unsafe.Pointer(in.SendInitialEvents))
return nil
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go
index 6e1eac5c7..af66a2ac4 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go
@@ -75,6 +75,11 @@ func (in *ListOptions) DeepCopyInto(out *ListOptions) {
*out = new(int64)
**out = **in
}
+ if in.SendInitialEvents != nil {
+ in, out := &in.SendInitialEvents, &out.SendInitialEvents
+ *out = new(bool)
+ **out = **in
+ }
return
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go
index 15b45ffa8..5005beb12 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go
@@ -18,6 +18,7 @@ package v1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/utils/ptr"
)
// IsControlledBy checks if the object has a controllerRef set to the given owner
@@ -36,10 +37,14 @@ func GetControllerOf(controllee Object) *OwnerReference {
return nil
}
cp := *ref
+ cp.Controller = ptr.To(*ref.Controller)
+ if ref.BlockOwnerDeletion != nil {
+ cp.BlockOwnerDeletion = ptr.To(*ref.BlockOwnerDeletion)
+ }
return &cp
}
-// GetControllerOf returns a pointer to the controllerRef if controllee has a controller
+// GetControllerOfNoCopy returns a pointer to the controllerRef if controllee has a controller
func GetControllerOfNoCopy(controllee Object) *OwnerReference {
refs := controllee.GetOwnerReferences()
for i := range refs {
@@ -52,14 +57,12 @@ func GetControllerOfNoCopy(controllee Object) *OwnerReference {
// NewControllerRef creates an OwnerReference pointing to the given owner.
func NewControllerRef(owner Object, gvk schema.GroupVersionKind) *OwnerReference {
- blockOwnerDeletion := true
- isController := true
return &OwnerReference{
APIVersion: gvk.GroupVersion().String(),
Kind: gvk.Kind,
Name: owner.GetName(),
UID: owner.GetUID(),
- BlockOwnerDeletion: &blockOwnerDeletion,
- Controller: &isController,
+ BlockOwnerDeletion: ptr.To(true),
+ Controller: ptr.To(true),
}
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
index 7e00eb7d9..229ea2c2c 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
+// source: k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
package v1
@@ -52,7 +52,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *APIGroup) Reset() { *m = APIGroup{} }
func (*APIGroup) ProtoMessage() {}
func (*APIGroup) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{0}
+ return fileDescriptor_a8431b6e0aeeb761, []int{0}
}
func (m *APIGroup) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -80,7 +80,7 @@ var xxx_messageInfo_APIGroup proto.InternalMessageInfo
func (m *APIGroupList) Reset() { *m = APIGroupList{} }
func (*APIGroupList) ProtoMessage() {}
func (*APIGroupList) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{1}
+ return fileDescriptor_a8431b6e0aeeb761, []int{1}
}
func (m *APIGroupList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -108,7 +108,7 @@ var xxx_messageInfo_APIGroupList proto.InternalMessageInfo
func (m *APIResource) Reset() { *m = APIResource{} }
func (*APIResource) ProtoMessage() {}
func (*APIResource) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{2}
+ return fileDescriptor_a8431b6e0aeeb761, []int{2}
}
func (m *APIResource) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -136,7 +136,7 @@ var xxx_messageInfo_APIResource proto.InternalMessageInfo
func (m *APIResourceList) Reset() { *m = APIResourceList{} }
func (*APIResourceList) ProtoMessage() {}
func (*APIResourceList) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{3}
+ return fileDescriptor_a8431b6e0aeeb761, []int{3}
}
func (m *APIResourceList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -164,7 +164,7 @@ var xxx_messageInfo_APIResourceList proto.InternalMessageInfo
func (m *APIVersions) Reset() { *m = APIVersions{} }
func (*APIVersions) ProtoMessage() {}
func (*APIVersions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{4}
+ return fileDescriptor_a8431b6e0aeeb761, []int{4}
}
func (m *APIVersions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -192,7 +192,7 @@ var xxx_messageInfo_APIVersions proto.InternalMessageInfo
func (m *ApplyOptions) Reset() { *m = ApplyOptions{} }
func (*ApplyOptions) ProtoMessage() {}
func (*ApplyOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{5}
+ return fileDescriptor_a8431b6e0aeeb761, []int{5}
}
func (m *ApplyOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -220,7 +220,7 @@ var xxx_messageInfo_ApplyOptions proto.InternalMessageInfo
func (m *Condition) Reset() { *m = Condition{} }
func (*Condition) ProtoMessage() {}
func (*Condition) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{6}
+ return fileDescriptor_a8431b6e0aeeb761, []int{6}
}
func (m *Condition) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -248,7 +248,7 @@ var xxx_messageInfo_Condition proto.InternalMessageInfo
func (m *CreateOptions) Reset() { *m = CreateOptions{} }
func (*CreateOptions) ProtoMessage() {}
func (*CreateOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{7}
+ return fileDescriptor_a8431b6e0aeeb761, []int{7}
}
func (m *CreateOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -276,7 +276,7 @@ var xxx_messageInfo_CreateOptions proto.InternalMessageInfo
func (m *DeleteOptions) Reset() { *m = DeleteOptions{} }
func (*DeleteOptions) ProtoMessage() {}
func (*DeleteOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{8}
+ return fileDescriptor_a8431b6e0aeeb761, []int{8}
}
func (m *DeleteOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -304,7 +304,7 @@ var xxx_messageInfo_DeleteOptions proto.InternalMessageInfo
func (m *Duration) Reset() { *m = Duration{} }
func (*Duration) ProtoMessage() {}
func (*Duration) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{9}
+ return fileDescriptor_a8431b6e0aeeb761, []int{9}
}
func (m *Duration) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -329,10 +329,38 @@ func (m *Duration) XXX_DiscardUnknown() {
var xxx_messageInfo_Duration proto.InternalMessageInfo
+func (m *FieldSelectorRequirement) Reset() { *m = FieldSelectorRequirement{} }
+func (*FieldSelectorRequirement) ProtoMessage() {}
+func (*FieldSelectorRequirement) Descriptor() ([]byte, []int) {
+ return fileDescriptor_a8431b6e0aeeb761, []int{10}
+}
+func (m *FieldSelectorRequirement) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *FieldSelectorRequirement) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+}
+func (m *FieldSelectorRequirement) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_FieldSelectorRequirement.Merge(m, src)
+}
+func (m *FieldSelectorRequirement) XXX_Size() int {
+ return m.Size()
+}
+func (m *FieldSelectorRequirement) XXX_DiscardUnknown() {
+ xxx_messageInfo_FieldSelectorRequirement.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_FieldSelectorRequirement proto.InternalMessageInfo
+
func (m *FieldsV1) Reset() { *m = FieldsV1{} }
func (*FieldsV1) ProtoMessage() {}
func (*FieldsV1) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{10}
+ return fileDescriptor_a8431b6e0aeeb761, []int{11}
}
func (m *FieldsV1) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -360,7 +388,7 @@ var xxx_messageInfo_FieldsV1 proto.InternalMessageInfo
func (m *GetOptions) Reset() { *m = GetOptions{} }
func (*GetOptions) ProtoMessage() {}
func (*GetOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{11}
+ return fileDescriptor_a8431b6e0aeeb761, []int{12}
}
func (m *GetOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -388,7 +416,7 @@ var xxx_messageInfo_GetOptions proto.InternalMessageInfo
func (m *GroupKind) Reset() { *m = GroupKind{} }
func (*GroupKind) ProtoMessage() {}
func (*GroupKind) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{12}
+ return fileDescriptor_a8431b6e0aeeb761, []int{13}
}
func (m *GroupKind) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -416,7 +444,7 @@ var xxx_messageInfo_GroupKind proto.InternalMessageInfo
func (m *GroupResource) Reset() { *m = GroupResource{} }
func (*GroupResource) ProtoMessage() {}
func (*GroupResource) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{13}
+ return fileDescriptor_a8431b6e0aeeb761, []int{14}
}
func (m *GroupResource) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -444,7 +472,7 @@ var xxx_messageInfo_GroupResource proto.InternalMessageInfo
func (m *GroupVersion) Reset() { *m = GroupVersion{} }
func (*GroupVersion) ProtoMessage() {}
func (*GroupVersion) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{14}
+ return fileDescriptor_a8431b6e0aeeb761, []int{15}
}
func (m *GroupVersion) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -472,7 +500,7 @@ var xxx_messageInfo_GroupVersion proto.InternalMessageInfo
func (m *GroupVersionForDiscovery) Reset() { *m = GroupVersionForDiscovery{} }
func (*GroupVersionForDiscovery) ProtoMessage() {}
func (*GroupVersionForDiscovery) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{15}
+ return fileDescriptor_a8431b6e0aeeb761, []int{16}
}
func (m *GroupVersionForDiscovery) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -500,7 +528,7 @@ var xxx_messageInfo_GroupVersionForDiscovery proto.InternalMessageInfo
func (m *GroupVersionKind) Reset() { *m = GroupVersionKind{} }
func (*GroupVersionKind) ProtoMessage() {}
func (*GroupVersionKind) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{16}
+ return fileDescriptor_a8431b6e0aeeb761, []int{17}
}
func (m *GroupVersionKind) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -528,7 +556,7 @@ var xxx_messageInfo_GroupVersionKind proto.InternalMessageInfo
func (m *GroupVersionResource) Reset() { *m = GroupVersionResource{} }
func (*GroupVersionResource) ProtoMessage() {}
func (*GroupVersionResource) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{17}
+ return fileDescriptor_a8431b6e0aeeb761, []int{18}
}
func (m *GroupVersionResource) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -556,7 +584,7 @@ var xxx_messageInfo_GroupVersionResource proto.InternalMessageInfo
func (m *LabelSelector) Reset() { *m = LabelSelector{} }
func (*LabelSelector) ProtoMessage() {}
func (*LabelSelector) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{18}
+ return fileDescriptor_a8431b6e0aeeb761, []int{19}
}
func (m *LabelSelector) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -584,7 +612,7 @@ var xxx_messageInfo_LabelSelector proto.InternalMessageInfo
func (m *LabelSelectorRequirement) Reset() { *m = LabelSelectorRequirement{} }
func (*LabelSelectorRequirement) ProtoMessage() {}
func (*LabelSelectorRequirement) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{19}
+ return fileDescriptor_a8431b6e0aeeb761, []int{20}
}
func (m *LabelSelectorRequirement) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -612,7 +640,7 @@ var xxx_messageInfo_LabelSelectorRequirement proto.InternalMessageInfo
func (m *List) Reset() { *m = List{} }
func (*List) ProtoMessage() {}
func (*List) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{20}
+ return fileDescriptor_a8431b6e0aeeb761, []int{21}
}
func (m *List) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -640,7 +668,7 @@ var xxx_messageInfo_List proto.InternalMessageInfo
func (m *ListMeta) Reset() { *m = ListMeta{} }
func (*ListMeta) ProtoMessage() {}
func (*ListMeta) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{21}
+ return fileDescriptor_a8431b6e0aeeb761, []int{22}
}
func (m *ListMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -668,7 +696,7 @@ var xxx_messageInfo_ListMeta proto.InternalMessageInfo
func (m *ListOptions) Reset() { *m = ListOptions{} }
func (*ListOptions) ProtoMessage() {}
func (*ListOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{22}
+ return fileDescriptor_a8431b6e0aeeb761, []int{23}
}
func (m *ListOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -696,7 +724,7 @@ var xxx_messageInfo_ListOptions proto.InternalMessageInfo
func (m *ManagedFieldsEntry) Reset() { *m = ManagedFieldsEntry{} }
func (*ManagedFieldsEntry) ProtoMessage() {}
func (*ManagedFieldsEntry) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{23}
+ return fileDescriptor_a8431b6e0aeeb761, []int{24}
}
func (m *ManagedFieldsEntry) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -724,7 +752,7 @@ var xxx_messageInfo_ManagedFieldsEntry proto.InternalMessageInfo
func (m *MicroTime) Reset() { *m = MicroTime{} }
func (*MicroTime) ProtoMessage() {}
func (*MicroTime) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{24}
+ return fileDescriptor_a8431b6e0aeeb761, []int{25}
}
func (m *MicroTime) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MicroTime.Unmarshal(m, b)
@@ -747,7 +775,7 @@ var xxx_messageInfo_MicroTime proto.InternalMessageInfo
func (m *ObjectMeta) Reset() { *m = ObjectMeta{} }
func (*ObjectMeta) ProtoMessage() {}
func (*ObjectMeta) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{25}
+ return fileDescriptor_a8431b6e0aeeb761, []int{26}
}
func (m *ObjectMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -775,7 +803,7 @@ var xxx_messageInfo_ObjectMeta proto.InternalMessageInfo
func (m *OwnerReference) Reset() { *m = OwnerReference{} }
func (*OwnerReference) ProtoMessage() {}
func (*OwnerReference) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{26}
+ return fileDescriptor_a8431b6e0aeeb761, []int{27}
}
func (m *OwnerReference) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -803,7 +831,7 @@ var xxx_messageInfo_OwnerReference proto.InternalMessageInfo
func (m *PartialObjectMetadata) Reset() { *m = PartialObjectMetadata{} }
func (*PartialObjectMetadata) ProtoMessage() {}
func (*PartialObjectMetadata) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{27}
+ return fileDescriptor_a8431b6e0aeeb761, []int{28}
}
func (m *PartialObjectMetadata) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -831,7 +859,7 @@ var xxx_messageInfo_PartialObjectMetadata proto.InternalMessageInfo
func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} }
func (*PartialObjectMetadataList) ProtoMessage() {}
func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{28}
+ return fileDescriptor_a8431b6e0aeeb761, []int{29}
}
func (m *PartialObjectMetadataList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -859,7 +887,7 @@ var xxx_messageInfo_PartialObjectMetadataList proto.InternalMessageInfo
func (m *Patch) Reset() { *m = Patch{} }
func (*Patch) ProtoMessage() {}
func (*Patch) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{29}
+ return fileDescriptor_a8431b6e0aeeb761, []int{30}
}
func (m *Patch) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -887,7 +915,7 @@ var xxx_messageInfo_Patch proto.InternalMessageInfo
func (m *PatchOptions) Reset() { *m = PatchOptions{} }
func (*PatchOptions) ProtoMessage() {}
func (*PatchOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{30}
+ return fileDescriptor_a8431b6e0aeeb761, []int{31}
}
func (m *PatchOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -915,7 +943,7 @@ var xxx_messageInfo_PatchOptions proto.InternalMessageInfo
func (m *Preconditions) Reset() { *m = Preconditions{} }
func (*Preconditions) ProtoMessage() {}
func (*Preconditions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{31}
+ return fileDescriptor_a8431b6e0aeeb761, []int{32}
}
func (m *Preconditions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -943,7 +971,7 @@ var xxx_messageInfo_Preconditions proto.InternalMessageInfo
func (m *RootPaths) Reset() { *m = RootPaths{} }
func (*RootPaths) ProtoMessage() {}
func (*RootPaths) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{32}
+ return fileDescriptor_a8431b6e0aeeb761, []int{33}
}
func (m *RootPaths) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -971,7 +999,7 @@ var xxx_messageInfo_RootPaths proto.InternalMessageInfo
func (m *ServerAddressByClientCIDR) Reset() { *m = ServerAddressByClientCIDR{} }
func (*ServerAddressByClientCIDR) ProtoMessage() {}
func (*ServerAddressByClientCIDR) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{33}
+ return fileDescriptor_a8431b6e0aeeb761, []int{34}
}
func (m *ServerAddressByClientCIDR) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -999,7 +1027,7 @@ var xxx_messageInfo_ServerAddressByClientCIDR proto.InternalMessageInfo
func (m *Status) Reset() { *m = Status{} }
func (*Status) ProtoMessage() {}
func (*Status) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{34}
+ return fileDescriptor_a8431b6e0aeeb761, []int{35}
}
func (m *Status) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1027,7 +1055,7 @@ var xxx_messageInfo_Status proto.InternalMessageInfo
func (m *StatusCause) Reset() { *m = StatusCause{} }
func (*StatusCause) ProtoMessage() {}
func (*StatusCause) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{35}
+ return fileDescriptor_a8431b6e0aeeb761, []int{36}
}
func (m *StatusCause) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1055,7 +1083,7 @@ var xxx_messageInfo_StatusCause proto.InternalMessageInfo
func (m *StatusDetails) Reset() { *m = StatusDetails{} }
func (*StatusDetails) ProtoMessage() {}
func (*StatusDetails) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{36}
+ return fileDescriptor_a8431b6e0aeeb761, []int{37}
}
func (m *StatusDetails) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1083,7 +1111,7 @@ var xxx_messageInfo_StatusDetails proto.InternalMessageInfo
func (m *TableOptions) Reset() { *m = TableOptions{} }
func (*TableOptions) ProtoMessage() {}
func (*TableOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{37}
+ return fileDescriptor_a8431b6e0aeeb761, []int{38}
}
func (m *TableOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1111,7 +1139,7 @@ var xxx_messageInfo_TableOptions proto.InternalMessageInfo
func (m *Time) Reset() { *m = Time{} }
func (*Time) ProtoMessage() {}
func (*Time) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{38}
+ return fileDescriptor_a8431b6e0aeeb761, []int{39}
}
func (m *Time) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Time.Unmarshal(m, b)
@@ -1134,7 +1162,7 @@ var xxx_messageInfo_Time proto.InternalMessageInfo
func (m *Timestamp) Reset() { *m = Timestamp{} }
func (*Timestamp) ProtoMessage() {}
func (*Timestamp) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{39}
+ return fileDescriptor_a8431b6e0aeeb761, []int{40}
}
func (m *Timestamp) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1162,7 +1190,7 @@ var xxx_messageInfo_Timestamp proto.InternalMessageInfo
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
func (*TypeMeta) ProtoMessage() {}
func (*TypeMeta) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{40}
+ return fileDescriptor_a8431b6e0aeeb761, []int{41}
}
func (m *TypeMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1190,7 +1218,7 @@ var xxx_messageInfo_TypeMeta proto.InternalMessageInfo
func (m *UpdateOptions) Reset() { *m = UpdateOptions{} }
func (*UpdateOptions) ProtoMessage() {}
func (*UpdateOptions) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{41}
+ return fileDescriptor_a8431b6e0aeeb761, []int{42}
}
func (m *UpdateOptions) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1218,7 +1246,7 @@ var xxx_messageInfo_UpdateOptions proto.InternalMessageInfo
func (m *Verbs) Reset() { *m = Verbs{} }
func (*Verbs) ProtoMessage() {}
func (*Verbs) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{42}
+ return fileDescriptor_a8431b6e0aeeb761, []int{43}
}
func (m *Verbs) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1246,7 +1274,7 @@ var xxx_messageInfo_Verbs proto.InternalMessageInfo
func (m *WatchEvent) Reset() { *m = WatchEvent{} }
func (*WatchEvent) ProtoMessage() {}
func (*WatchEvent) Descriptor() ([]byte, []int) {
- return fileDescriptor_cf52fa777ced5367, []int{43}
+ return fileDescriptor_a8431b6e0aeeb761, []int{44}
}
func (m *WatchEvent) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -1282,6 +1310,7 @@ func init() {
proto.RegisterType((*CreateOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.CreateOptions")
proto.RegisterType((*DeleteOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.DeleteOptions")
proto.RegisterType((*Duration)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.Duration")
+ proto.RegisterType((*FieldSelectorRequirement)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.FieldSelectorRequirement")
proto.RegisterType((*FieldsV1)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.FieldsV1")
proto.RegisterType((*GetOptions)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.GetOptions")
proto.RegisterType((*GroupKind)(nil), "k8s.io.apimachinery.pkg.apis.meta.v1.GroupKind")
@@ -1322,189 +1351,191 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto", fileDescriptor_cf52fa777ced5367)
-}
-
-var fileDescriptor_cf52fa777ced5367 = []byte{
- // 2842 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x1a, 0x4b, 0x6f, 0x24, 0x47,
- 0xd9, 0x3d, 0x0f, 0x7b, 0xe6, 0x9b, 0x19, 0x3f, 0x6a, 0xbd, 0x30, 0x6b, 0x84, 0xc7, 0xe9, 0x44,
- 0xd1, 0x06, 0x92, 0x71, 0x76, 0x09, 0xd1, 0x66, 0x43, 0x02, 0x1e, 0xcf, 0x7a, 0xe3, 0x64, 0x1d,
- 0x5b, 0xe5, 0xdd, 0x05, 0x42, 0x84, 0xd2, 0x9e, 0x2e, 0x8f, 0x1b, 0xf7, 0x74, 0x4f, 0xaa, 0x7a,
- 0xbc, 0x19, 0x38, 0x90, 0x03, 0x08, 0x90, 0x50, 0x14, 0x6e, 0x9c, 0x50, 0x22, 0xf8, 0x01, 0x88,
- 0x0b, 0xdc, 0x41, 0x22, 0xc7, 0x20, 0x2e, 0x91, 0x40, 0xa3, 0xc4, 0x1c, 0x38, 0x22, 0xae, 0xbe,
- 0x80, 0xea, 0xd1, 0xdd, 0xd5, 0xf3, 0x58, 0xf7, 0x64, 0x97, 0x88, 0xdb, 0xf4, 0xf7, 0xae, 0xaa,
- 0xaf, 0xbe, 0x47, 0x7d, 0x03, 0x3b, 0xc7, 0xd7, 0x58, 0xdd, 0xf1, 0xd7, 0x8f, 0x7b, 0x07, 0x84,
- 0x7a, 0x24, 0x20, 0x6c, 0xfd, 0x84, 0x78, 0xb6, 0x4f, 0xd7, 0x15, 0xc2, 0xea, 0x3a, 0x1d, 0xab,
- 0x75, 0xe4, 0x78, 0x84, 0xf6, 0xd7, 0xbb, 0xc7, 0x6d, 0x0e, 0x60, 0xeb, 0x1d, 0x12, 0x58, 0xeb,
- 0x27, 0x57, 0xd6, 0xdb, 0xc4, 0x23, 0xd4, 0x0a, 0x88, 0x5d, 0xef, 0x52, 0x3f, 0xf0, 0xd1, 0x63,
- 0x92, 0xab, 0xae, 0x73, 0xd5, 0xbb, 0xc7, 0x6d, 0x0e, 0x60, 0x75, 0xce, 0x55, 0x3f, 0xb9, 0xb2,
- 0xf2, 0x54, 0xdb, 0x09, 0x8e, 0x7a, 0x07, 0xf5, 0x96, 0xdf, 0x59, 0x6f, 0xfb, 0x6d, 0x7f, 0x5d,
- 0x30, 0x1f, 0xf4, 0x0e, 0xc5, 0x97, 0xf8, 0x10, 0xbf, 0xa4, 0xd0, 0x95, 0x89, 0xa6, 0xd0, 0x9e,
- 0x17, 0x38, 0x1d, 0x32, 0x6c, 0xc5, 0xca, 0xb3, 0xe7, 0x31, 0xb0, 0xd6, 0x11, 0xe9, 0x58, 0xc3,
- 0x7c, 0xe6, 0x9f, 0xb3, 0x50, 0xd8, 0xd8, 0xdb, 0xbe, 0x49, 0xfd, 0x5e, 0x17, 0xad, 0x41, 0xce,
- 0xb3, 0x3a, 0xa4, 0x6a, 0xac, 0x19, 0x97, 0x8b, 0x8d, 0xf2, 0x07, 0x83, 0xda, 0xcc, 0xe9, 0xa0,
- 0x96, 0x7b, 0xd5, 0xea, 0x10, 0x2c, 0x30, 0xc8, 0x85, 0xc2, 0x09, 0xa1, 0xcc, 0xf1, 0x3d, 0x56,
- 0xcd, 0xac, 0x65, 0x2f, 0x97, 0xae, 0xbe, 0x58, 0x4f, 0xb3, 0xfe, 0xba, 0x50, 0x70, 0x57, 0xb2,
- 0x6e, 0xf9, 0xb4, 0xe9, 0xb0, 0x96, 0x7f, 0x42, 0x68, 0xbf, 0xb1, 0xa8, 0xb4, 0x14, 0x14, 0x92,
- 0xe1, 0x48, 0x03, 0xfa, 0x91, 0x01, 0x8b, 0x5d, 0x4a, 0x0e, 0x09, 0xa5, 0xc4, 0x56, 0xf8, 0x6a,
- 0x76, 0xcd, 0x78, 0x08, 0x6a, 0xab, 0x4a, 0xed, 0xe2, 0xde, 0x90, 0x7c, 0x3c, 0xa2, 0x11, 0xfd,
- 0xda, 0x80, 0x15, 0x46, 0xe8, 0x09, 0xa1, 0x1b, 0xb6, 0x4d, 0x09, 0x63, 0x8d, 0xfe, 0xa6, 0xeb,
- 0x10, 0x2f, 0xd8, 0xdc, 0x6e, 0x62, 0x56, 0xcd, 0x89, 0x7d, 0xf8, 0x7a, 0x3a, 0x83, 0xf6, 0x27,
- 0xc9, 0x69, 0x98, 0xca, 0xa2, 0x95, 0x89, 0x24, 0x0c, 0xdf, 0xc7, 0x0c, 0xf3, 0x10, 0xca, 0xe1,
- 0x41, 0xde, 0x72, 0x58, 0x80, 0xee, 0xc2, 0x6c, 0x9b, 0x7f, 0xb0, 0xaa, 0x21, 0x0c, 0xac, 0xa7,
- 0x33, 0x30, 0x94, 0xd1, 0x98, 0x57, 0xf6, 0xcc, 0x8a, 0x4f, 0x86, 0x95, 0x34, 0xf3, 0x67, 0x39,
- 0x28, 0x6d, 0xec, 0x6d, 0x63, 0xc2, 0xfc, 0x1e, 0x6d, 0x91, 0x14, 0x4e, 0x73, 0x0d, 0xca, 0xcc,
- 0xf1, 0xda, 0x3d, 0xd7, 0xa2, 0x1c, 0x5a, 0x9d, 0x15, 0x94, 0xcb, 0x8a, 0xb2, 0xbc, 0xaf, 0xe1,
- 0x70, 0x82, 0x12, 0x5d, 0x05, 0xe0, 0x12, 0x58, 0xd7, 0x6a, 0x11, 0xbb, 0x9a, 0x59, 0x33, 0x2e,
- 0x17, 0x1a, 0x48, 0xf1, 0xc1, 0xab, 0x11, 0x06, 0x6b, 0x54, 0xe8, 0x51, 0xc8, 0x0b, 0x4b, 0xab,
- 0x05, 0xa1, 0xa6, 0xa2, 0xc8, 0xf3, 0x62, 0x19, 0x58, 0xe2, 0xd0, 0x13, 0x30, 0xa7, 0xbc, 0xac,
- 0x5a, 0x14, 0x64, 0x0b, 0x8a, 0x6c, 0x2e, 0x74, 0x83, 0x10, 0xcf, 0xd7, 0x77, 0xec, 0x78, 0xb6,
- 0xf0, 0x3b, 0x6d, 0x7d, 0xaf, 0x38, 0x9e, 0x8d, 0x05, 0x06, 0xdd, 0x82, 0xfc, 0x09, 0xa1, 0x07,
- 0xdc, 0x13, 0xb8, 0x6b, 0x7e, 0x39, 0xdd, 0x46, 0xdf, 0xe5, 0x2c, 0x8d, 0x22, 0x37, 0x4d, 0xfc,
- 0xc4, 0x52, 0x08, 0xaa, 0x03, 0xb0, 0x23, 0x9f, 0x06, 0x62, 0x79, 0xd5, 0xfc, 0x5a, 0xf6, 0x72,
- 0xb1, 0x31, 0xcf, 0xd7, 0xbb, 0x1f, 0x41, 0xb1, 0x46, 0xc1, 0xe9, 0x5b, 0x56, 0x40, 0xda, 0x3e,
- 0x75, 0x08, 0xab, 0xce, 0xc5, 0xf4, 0x9b, 0x11, 0x14, 0x6b, 0x14, 0xe8, 0x65, 0x40, 0x2c, 0xf0,
- 0xa9, 0xd5, 0x26, 0x6a, 0xa9, 0x2f, 0x59, 0xec, 0xa8, 0x0a, 0x62, 0x75, 0x2b, 0x6a, 0x75, 0x68,
- 0x7f, 0x84, 0x02, 0x8f, 0xe1, 0x32, 0x7f, 0x67, 0xc0, 0x82, 0xe6, 0x0b, 0xc2, 0xef, 0xae, 0x41,
- 0xb9, 0xad, 0xdd, 0x3a, 0xe5, 0x17, 0xd1, 0x69, 0xeb, 0x37, 0x12, 0x27, 0x28, 0x11, 0x81, 0x22,
- 0x55, 0x92, 0xc2, 0xe8, 0x72, 0x25, 0xb5, 0xd3, 0x86, 0x36, 0xc4, 0x9a, 0x34, 0x20, 0xc3, 0xb1,
- 0x64, 0xf3, 0x9f, 0x86, 0x70, 0xe0, 0x30, 0xde, 0xa0, 0xcb, 0x5a, 0x4c, 0x33, 0xc4, 0xf6, 0x95,
- 0x27, 0xc4, 0xa3, 0x73, 0x02, 0x41, 0xe6, 0xff, 0x22, 0x10, 0x5c, 0x2f, 0xfc, 0xf2, 0xbd, 0xda,
- 0xcc, 0xdb, 0x7f, 0x5f, 0x9b, 0x31, 0x7f, 0x61, 0x40, 0x79, 0xa3, 0xdb, 0x75, 0xfb, 0xbb, 0xdd,
- 0x40, 0x2c, 0xc0, 0x84, 0x59, 0x9b, 0xf6, 0x71, 0xcf, 0x53, 0x0b, 0x05, 0x7e, 0xbf, 0x9b, 0x02,
- 0x82, 0x15, 0x86, 0xdf, 0x9f, 0x43, 0x9f, 0xb6, 0x88, 0xba, 0x6e, 0xd1, 0xfd, 0xd9, 0xe2, 0x40,
- 0x2c, 0x71, 0xfc, 0x90, 0x0f, 0x1d, 0xe2, 0xda, 0x3b, 0x96, 0x67, 0xb5, 0x09, 0x55, 0x97, 0x23,
- 0xda, 0xfa, 0x2d, 0x0d, 0x87, 0x13, 0x94, 0xe6, 0x7f, 0x32, 0x50, 0xdc, 0xf4, 0x3d, 0xdb, 0x09,
- 0xd4, 0xe5, 0x0a, 0xfa, 0xdd, 0x91, 0xe0, 0x71, 0xbb, 0xdf, 0x25, 0x58, 0x60, 0xd0, 0x73, 0x30,
- 0xcb, 0x02, 0x2b, 0xe8, 0x31, 0x61, 0x4f, 0xb1, 0xf1, 0x48, 0x18, 0x96, 0xf6, 0x05, 0xf4, 0x6c,
- 0x50, 0x5b, 0x88, 0xc4, 0x49, 0x10, 0x56, 0x0c, 0xdc, 0xd3, 0xfd, 0x03, 0xb1, 0x51, 0xf6, 0x4d,
- 0x99, 0xf6, 0xc2, 0xfc, 0x91, 0x8d, 0x3d, 0x7d, 0x77, 0x84, 0x02, 0x8f, 0xe1, 0x42, 0x27, 0x80,
- 0x5c, 0x8b, 0x05, 0xb7, 0xa9, 0xe5, 0x31, 0xa1, 0xeb, 0xb6, 0xd3, 0x21, 0xea, 0xc2, 0x7f, 0x29,
- 0xdd, 0x89, 0x73, 0x8e, 0x58, 0xef, 0xad, 0x11, 0x69, 0x78, 0x8c, 0x06, 0xf4, 0x38, 0xcc, 0x52,
- 0x62, 0x31, 0xdf, 0xab, 0xe6, 0xc5, 0xf2, 0xa3, 0xa8, 0x8c, 0x05, 0x14, 0x2b, 0x2c, 0x0f, 0x68,
- 0x1d, 0xc2, 0x98, 0xd5, 0x0e, 0xc3, 0x6b, 0x14, 0xd0, 0x76, 0x24, 0x18, 0x87, 0x78, 0xf3, 0xb7,
- 0x06, 0x54, 0x36, 0x29, 0xb1, 0x02, 0x32, 0x8d, 0x5b, 0x7c, 0xea, 0x13, 0x47, 0x1b, 0xb0, 0x20,
- 0xbe, 0xef, 0x5a, 0xae, 0x63, 0xcb, 0x33, 0xc8, 0x09, 0xe6, 0xcf, 0x2b, 0xe6, 0x85, 0xad, 0x24,
- 0x1a, 0x0f, 0xd3, 0x9b, 0x3f, 0xc9, 0x42, 0xa5, 0x49, 0x5c, 0x12, 0x9b, 0xbc, 0x05, 0xa8, 0x4d,
- 0xad, 0x16, 0xd9, 0x23, 0xd4, 0xf1, 0xed, 0x7d, 0xd2, 0xf2, 0x3d, 0x9b, 0x09, 0x37, 0xca, 0x36,
- 0x3e, 0xc7, 0xf7, 0xf7, 0xe6, 0x08, 0x16, 0x8f, 0xe1, 0x40, 0x2e, 0x54, 0xba, 0x54, 0xfc, 0x16,
- 0x7b, 0x2e, 0xbd, 0xac, 0x74, 0xf5, 0x2b, 0xe9, 0x8e, 0x74, 0x4f, 0x67, 0x6d, 0x2c, 0x9d, 0x0e,
- 0x6a, 0x95, 0x04, 0x08, 0x27, 0x85, 0xa3, 0x6f, 0xc0, 0xa2, 0x4f, 0xbb, 0x47, 0x96, 0xd7, 0x24,
- 0x5d, 0xe2, 0xd9, 0xc4, 0x0b, 0x98, 0xd8, 0xc8, 0x42, 0x63, 0x99, 0xd7, 0x22, 0xbb, 0x43, 0x38,
- 0x3c, 0x42, 0x8d, 0x5e, 0x83, 0xa5, 0x2e, 0xf5, 0xbb, 0x56, 0x5b, 0x6c, 0xcc, 0x9e, 0xef, 0x3a,
- 0xad, 0xbe, 0xda, 0xce, 0x27, 0x4f, 0x07, 0xb5, 0xa5, 0xbd, 0x61, 0xe4, 0xd9, 0xa0, 0x76, 0x41,
- 0x6c, 0x1d, 0x87, 0xc4, 0x48, 0x3c, 0x2a, 0x46, 0x73, 0x83, 0xfc, 0x24, 0x37, 0x30, 0xb7, 0xa1,
- 0xd0, 0xec, 0xa9, 0x3b, 0xf1, 0x02, 0x14, 0x6c, 0xf5, 0x5b, 0xed, 0x7c, 0x78, 0x39, 0x23, 0x9a,
- 0xb3, 0x41, 0xad, 0xc2, 0xcb, 0xcf, 0x7a, 0x08, 0xc0, 0x11, 0x8b, 0xf9, 0x38, 0x14, 0xc4, 0xc1,
- 0xb3, 0xbb, 0x57, 0xd0, 0x22, 0x64, 0xb1, 0x75, 0x4f, 0x48, 0x29, 0x63, 0xfe, 0x53, 0x8b, 0x62,
- 0xbb, 0x00, 0x37, 0x49, 0x10, 0x1e, 0xfc, 0x06, 0x2c, 0x84, 0xa1, 0x3c, 0x99, 0x61, 0x22, 0x6f,
- 0xc2, 0x49, 0x34, 0x1e, 0xa6, 0x37, 0x5f, 0x87, 0xa2, 0xc8, 0x42, 0x3c, 0x85, 0xc7, 0xe5, 0x82,
- 0x71, 0x9f, 0x72, 0x21, 0xac, 0x01, 0x32, 0x93, 0x6a, 0x00, 0xcd, 0x5c, 0x17, 0x2a, 0x92, 0x37,
- 0x2c, 0x90, 0x52, 0x69, 0x78, 0x12, 0x0a, 0xa1, 0x99, 0x4a, 0x4b, 0x54, 0x18, 0x87, 0x82, 0x70,
- 0x44, 0xa1, 0x69, 0x3b, 0x82, 0x44, 0x46, 0x4d, 0xa7, 0x4c, 0xab, 0x7e, 0x32, 0xf7, 0xaf, 0x7e,
- 0x34, 0x4d, 0x3f, 0x84, 0xea, 0xa4, 0x6a, 0xfa, 0x01, 0x72, 0x7e, 0x7a, 0x53, 0xcc, 0x77, 0x0c,
- 0x58, 0xd4, 0x25, 0xa5, 0x3f, 0xbe, 0xf4, 0x4a, 0xce, 0xaf, 0xf6, 0xb4, 0x1d, 0xf9, 0x95, 0x01,
- 0xcb, 0x89, 0xa5, 0x4d, 0x75, 0xe2, 0x53, 0x18, 0xa5, 0x3b, 0x47, 0x76, 0x0a, 0xe7, 0xf8, 0x6b,
- 0x06, 0x2a, 0xb7, 0xac, 0x03, 0xe2, 0xee, 0x13, 0x97, 0xb4, 0x02, 0x9f, 0xa2, 0x1f, 0x40, 0xa9,
- 0x63, 0x05, 0xad, 0x23, 0x01, 0x0d, 0x3b, 0x83, 0x66, 0xba, 0x60, 0x97, 0x90, 0x54, 0xdf, 0x89,
- 0xc5, 0xdc, 0xf0, 0x02, 0xda, 0x6f, 0x5c, 0x50, 0x26, 0x95, 0x34, 0x0c, 0xd6, 0xb5, 0x89, 0x76,
- 0x4e, 0x7c, 0xdf, 0x78, 0xab, 0xcb, 0xcb, 0x96, 0xe9, 0xbb, 0xc8, 0x84, 0x09, 0x98, 0xbc, 0xd9,
- 0x73, 0x28, 0xe9, 0x10, 0x2f, 0x88, 0xdb, 0xb9, 0x9d, 0x21, 0xf9, 0x78, 0x44, 0xe3, 0xca, 0x8b,
- 0xb0, 0x38, 0x6c, 0x3c, 0x8f, 0x3f, 0xc7, 0xa4, 0x2f, 0xcf, 0x0b, 0xf3, 0x9f, 0x68, 0x19, 0xf2,
- 0x27, 0x96, 0xdb, 0x53, 0xb7, 0x11, 0xcb, 0x8f, 0xeb, 0x99, 0x6b, 0x86, 0xf9, 0x1b, 0x03, 0xaa,
- 0x93, 0x0c, 0x41, 0x5f, 0xd4, 0x04, 0x35, 0x4a, 0xca, 0xaa, 0xec, 0x2b, 0xa4, 0x2f, 0xa5, 0xde,
- 0x80, 0x82, 0xdf, 0xe5, 0x35, 0x85, 0x4f, 0xd5, 0xa9, 0x3f, 0x11, 0x9e, 0xe4, 0xae, 0x82, 0x9f,
- 0x0d, 0x6a, 0x17, 0x13, 0xe2, 0x43, 0x04, 0x8e, 0x58, 0x79, 0xa4, 0x16, 0xf6, 0xf0, 0xec, 0x11,
- 0x45, 0xea, 0xbb, 0x02, 0x82, 0x15, 0xc6, 0xfc, 0x83, 0x01, 0x39, 0x51, 0x90, 0xbf, 0x0e, 0x05,
- 0xbe, 0x7f, 0xb6, 0x15, 0x58, 0xc2, 0xae, 0xd4, 0xad, 0x20, 0xe7, 0xde, 0x21, 0x81, 0x15, 0x7b,
- 0x5b, 0x08, 0xc1, 0x91, 0x44, 0x84, 0x21, 0xef, 0x04, 0xa4, 0x13, 0x1e, 0xe4, 0x53, 0x13, 0x45,
- 0xab, 0x87, 0x88, 0x3a, 0xb6, 0xee, 0xdd, 0x78, 0x2b, 0x20, 0x1e, 0x3f, 0x8c, 0xf8, 0x6a, 0x6c,
- 0x73, 0x19, 0x58, 0x8a, 0x32, 0xff, 0x6d, 0x40, 0xa4, 0x8a, 0x3b, 0x3f, 0x23, 0xee, 0xe1, 0x2d,
- 0xc7, 0x3b, 0x56, 0xdb, 0x1a, 0x99, 0xb3, 0xaf, 0xe0, 0x38, 0xa2, 0x18, 0x97, 0x1e, 0x32, 0xd3,
- 0xa5, 0x07, 0xae, 0xb0, 0xe5, 0x7b, 0x81, 0xe3, 0xf5, 0x46, 0x6e, 0xdb, 0xa6, 0x82, 0xe3, 0x88,
- 0x82, 0x17, 0x22, 0x94, 0x74, 0x2c, 0xc7, 0x73, 0xbc, 0x36, 0x5f, 0xc4, 0xa6, 0xdf, 0xf3, 0x02,
- 0x91, 0x91, 0x55, 0x21, 0x82, 0x47, 0xb0, 0x78, 0x0c, 0x87, 0xf9, 0xfb, 0x1c, 0x94, 0xf8, 0x9a,
- 0xc3, 0x3c, 0xf7, 0x3c, 0x54, 0x5c, 0xdd, 0x0b, 0xd4, 0xda, 0x2f, 0x2a, 0x53, 0x92, 0xf7, 0x1a,
- 0x27, 0x69, 0x39, 0xb3, 0x28, 0xa1, 0x22, 0xe6, 0x4c, 0x92, 0x79, 0x4b, 0x47, 0xe2, 0x24, 0x2d,
- 0x8f, 0x5e, 0xf7, 0xf8, 0xfd, 0x50, 0x95, 0x49, 0x74, 0x44, 0xdf, 0xe4, 0x40, 0x2c, 0x71, 0x68,
- 0x07, 0x2e, 0x58, 0xae, 0xeb, 0xdf, 0x13, 0xc0, 0x86, 0xef, 0x1f, 0x77, 0x2c, 0x7a, 0xcc, 0x44,
- 0x33, 0x5d, 0x68, 0x7c, 0x41, 0xb1, 0x5c, 0xd8, 0x18, 0x25, 0xc1, 0xe3, 0xf8, 0xc6, 0x1d, 0x5b,
- 0x6e, 0xca, 0x63, 0x3b, 0x82, 0xe5, 0x21, 0x90, 0xb8, 0xe5, 0xaa, 0xb3, 0x7d, 0x46, 0xc9, 0x59,
- 0xc6, 0x63, 0x68, 0xce, 0x26, 0xc0, 0xf1, 0x58, 0x89, 0xe8, 0x3a, 0xcc, 0x73, 0x4f, 0xf6, 0x7b,
- 0x41, 0x58, 0x77, 0xe6, 0xc5, 0x71, 0xa3, 0xd3, 0x41, 0x6d, 0xfe, 0x76, 0x02, 0x83, 0x87, 0x28,
- 0xf9, 0xe6, 0xba, 0x4e, 0xc7, 0x09, 0xaa, 0x73, 0x82, 0x25, 0xda, 0xdc, 0x5b, 0x1c, 0x88, 0x25,
- 0x2e, 0xe1, 0x81, 0x85, 0xf3, 0x3c, 0xd0, 0xfc, 0x4b, 0x16, 0x90, 0xac, 0xb5, 0x6d, 0x59, 0x4f,
- 0xc9, 0x90, 0xc6, 0x3b, 0x02, 0x55, 0xab, 0x1b, 0x43, 0x1d, 0x81, 0x2a, 0xd3, 0x43, 0x3c, 0xda,
- 0x81, 0xa2, 0x0c, 0x2d, 0xf1, 0x75, 0x59, 0x57, 0xc4, 0xc5, 0xdd, 0x10, 0x71, 0x36, 0xa8, 0xad,
- 0x24, 0xd4, 0x44, 0x18, 0xd1, 0xad, 0xc5, 0x12, 0xd0, 0x55, 0x00, 0xab, 0xeb, 0xe8, 0xef, 0x75,
- 0xc5, 0xf8, 0xd5, 0x26, 0xee, 0xbc, 0xb1, 0x46, 0x85, 0x5e, 0x82, 0x5c, 0xf0, 0xe9, 0x3a, 0xaa,
- 0x82, 0x68, 0x18, 0x79, 0xff, 0x24, 0x24, 0x70, 0xed, 0xc2, 0x9f, 0x19, 0x37, 0x4b, 0x35, 0x43,
- 0x91, 0xf6, 0xad, 0x08, 0x83, 0x35, 0x2a, 0xf4, 0x2d, 0x28, 0x1c, 0xaa, 0x52, 0x54, 0x1c, 0x4c,
- 0xea, 0x10, 0x19, 0x16, 0xb0, 0xf2, 0xc9, 0x20, 0xfc, 0xc2, 0x91, 0x34, 0xf4, 0x55, 0x28, 0xb1,
- 0xde, 0x41, 0x94, 0xbd, 0xe5, 0x69, 0x46, 0xa9, 0x72, 0x3f, 0x46, 0x61, 0x9d, 0xce, 0x7c, 0x13,
- 0x8a, 0x3b, 0x4e, 0x8b, 0xfa, 0xa2, 0x07, 0x7c, 0x02, 0xe6, 0x58, 0xa2, 0xc1, 0x89, 0x4e, 0x32,
- 0xf4, 0xb2, 0x10, 0xcf, 0xdd, 0xcb, 0xb3, 0x3c, 0x5f, 0xb6, 0x31, 0xf9, 0xd8, 0xbd, 0x5e, 0xe5,
- 0x40, 0x2c, 0x71, 0xd7, 0x97, 0x79, 0x81, 0xf0, 0xd3, 0xf7, 0x6b, 0x33, 0xef, 0xbe, 0x5f, 0x9b,
- 0x79, 0xef, 0x7d, 0x55, 0x2c, 0xfc, 0x11, 0x00, 0x76, 0x0f, 0xbe, 0x47, 0x5a, 0x32, 0xec, 0xa6,
- 0x7a, 0xd6, 0x0b, 0x5f, 0x93, 0xc5, 0xb3, 0x5e, 0x66, 0xa8, 0xe8, 0xd3, 0x70, 0x38, 0x41, 0x89,
- 0xd6, 0xa1, 0x18, 0x3d, 0xd8, 0x29, 0xff, 0x58, 0x0a, 0xfd, 0x2d, 0x7a, 0xd5, 0xc3, 0x31, 0x4d,
- 0x22, 0x07, 0xe4, 0xce, 0xcd, 0x01, 0x0d, 0xc8, 0xf6, 0x1c, 0x5b, 0x35, 0xcc, 0x4f, 0x87, 0x39,
- 0xf8, 0xce, 0x76, 0xf3, 0x6c, 0x50, 0x7b, 0x64, 0xd2, 0x3b, 0x79, 0xd0, 0xef, 0x12, 0x56, 0xbf,
- 0xb3, 0xdd, 0xc4, 0x9c, 0x79, 0x5c, 0x40, 0x9a, 0x9d, 0x32, 0x20, 0x5d, 0x05, 0x68, 0xc7, 0xcf,
- 0x0e, 0xf2, 0xbe, 0x47, 0x8e, 0xa8, 0x3d, 0x37, 0x68, 0x54, 0x88, 0xc1, 0x52, 0x8b, 0xb7, 0xe6,
- 0xaa, 0xfd, 0x67, 0x81, 0xd5, 0x91, 0x0f, 0x99, 0xd3, 0xdd, 0x89, 0x4b, 0x4a, 0xcd, 0xd2, 0xe6,
- 0xb0, 0x30, 0x3c, 0x2a, 0x1f, 0xf9, 0xb0, 0x64, 0xab, 0x0e, 0x31, 0x56, 0x5a, 0x9c, 0x5a, 0xe9,
- 0x45, 0xae, 0xb0, 0x39, 0x2c, 0x08, 0x8f, 0xca, 0x46, 0xdf, 0x85, 0x95, 0x10, 0x38, 0xda, 0xa6,
- 0x8b, 0x80, 0x9d, 0x6d, 0xac, 0x9e, 0x0e, 0x6a, 0x2b, 0xcd, 0x89, 0x54, 0xf8, 0x3e, 0x12, 0x90,
- 0x0d, 0xb3, 0xae, 0x2c, 0x70, 0x4b, 0xa2, 0x28, 0xf9, 0x5a, 0xba, 0x55, 0xc4, 0xde, 0x5f, 0xd7,
- 0x0b, 0xdb, 0xe8, 0xc9, 0x45, 0xd5, 0xb4, 0x4a, 0x36, 0x7a, 0x0b, 0x4a, 0x96, 0xe7, 0xf9, 0x81,
- 0x25, 0x1f, 0x0e, 0xca, 0x42, 0xd5, 0xc6, 0xd4, 0xaa, 0x36, 0x62, 0x19, 0x43, 0x85, 0xb4, 0x86,
- 0xc1, 0xba, 0x2a, 0x74, 0x0f, 0x16, 0xfc, 0x7b, 0x1e, 0xa1, 0x98, 0x1c, 0x12, 0x4a, 0xbc, 0x16,
- 0x61, 0xd5, 0x8a, 0xd0, 0xfe, 0x4c, 0x4a, 0xed, 0x09, 0xe6, 0xd8, 0xa5, 0x93, 0x70, 0x86, 0x87,
- 0xb5, 0xa0, 0x3a, 0x8f, 0xad, 0x9e, 0xe5, 0x3a, 0xdf, 0x27, 0x94, 0x55, 0xe7, 0xe3, 0xb7, 0xe6,
- 0xad, 0x08, 0x8a, 0x35, 0x0a, 0xd4, 0x83, 0x4a, 0x47, 0x4f, 0x19, 0xd5, 0x25, 0x61, 0xe6, 0xb5,
- 0x74, 0x66, 0x8e, 0x26, 0xb5, 0xb8, 0x82, 0x49, 0xe0, 0x70, 0x52, 0xcb, 0xca, 0x73, 0x50, 0xfa,
- 0x94, 0xc5, 0x3d, 0x6f, 0x0e, 0x86, 0x0f, 0x64, 0xaa, 0xe6, 0xe0, 0x4f, 0x19, 0x98, 0x4f, 0x6e,
- 0xe3, 0x50, 0x3a, 0xcc, 0xa7, 0x4a, 0x87, 0x61, 0x1b, 0x6a, 0x4c, 0x1c, 0x3a, 0x84, 0xf1, 0x39,
- 0x3b, 0x31, 0x3e, 0xab, 0x30, 0x98, 0x7b, 0x90, 0x30, 0x58, 0x07, 0xe0, 0x75, 0x06, 0xf5, 0x5d,
- 0x97, 0x50, 0x11, 0x01, 0x0b, 0x6a, 0xb8, 0x10, 0x41, 0xb1, 0x46, 0xc1, 0xab, 0xe1, 0x03, 0xd7,
- 0x6f, 0x1d, 0x8b, 0x2d, 0x08, 0x6f, 0xaf, 0x88, 0x7d, 0x05, 0x59, 0x0d, 0x37, 0x46, 0xb0, 0x78,
- 0x0c, 0x87, 0xd9, 0x87, 0x8b, 0x7b, 0x16, 0x0d, 0x1c, 0xcb, 0x8d, 0x6f, 0x8a, 0x68, 0x37, 0xde,
- 0x18, 0x69, 0x66, 0x9e, 0x9e, 0xf6, 0xc6, 0xc5, 0x9b, 0x1f, 0xc3, 0xe2, 0x86, 0xc6, 0xfc, 0x9b,
- 0x01, 0x97, 0xc6, 0xea, 0xfe, 0x0c, 0x9a, 0xa9, 0x37, 0x92, 0xcd, 0xd4, 0xf3, 0x29, 0x5f, 0x21,
- 0xc7, 0x59, 0x3b, 0xa1, 0xb5, 0x9a, 0x83, 0xfc, 0x1e, 0x2f, 0x62, 0xcd, 0x0f, 0x0d, 0x28, 0x8b,
- 0x5f, 0xd3, 0x3c, 0x02, 0xd7, 0x92, 0xb3, 0x81, 0xe2, 0xc3, 0x9b, 0x0b, 0x3c, 0x8c, 0x57, 0xe2,
- 0x77, 0x0c, 0x48, 0x3e, 0xbf, 0xa2, 0x17, 0xe5, 0x15, 0x30, 0xa2, 0xf7, 0xd1, 0x29, 0xdd, 0xff,
- 0x85, 0x49, 0xdd, 0xe4, 0x85, 0x54, 0x0f, 0x8d, 0x4f, 0x42, 0x11, 0xfb, 0x7e, 0xb0, 0x67, 0x05,
- 0x47, 0x8c, 0xef, 0x5d, 0x97, 0xff, 0x50, 0xdb, 0x2b, 0xf6, 0x4e, 0x60, 0xb0, 0x84, 0x9b, 0x3f,
- 0x37, 0xe0, 0xd2, 0xc4, 0x91, 0x0f, 0x8f, 0x22, 0xad, 0xe8, 0x4b, 0xad, 0x28, 0x72, 0xe4, 0x98,
- 0x0e, 0x6b, 0x54, 0xbc, 0x0d, 0x4c, 0xcc, 0x89, 0x86, 0xdb, 0xc0, 0x84, 0x36, 0x9c, 0xa4, 0x35,
- 0xff, 0x95, 0x01, 0x35, 0x63, 0xf9, 0x1f, 0x3b, 0xfd, 0xe3, 0x43, 0x13, 0x9e, 0xf9, 0xe4, 0x84,
- 0x27, 0x1a, 0xe7, 0x68, 0x23, 0x8e, 0xec, 0xfd, 0x47, 0x1c, 0xe8, 0xd9, 0x68, 0x6a, 0x22, 0x7d,
- 0x68, 0x35, 0x39, 0x35, 0x39, 0x1b, 0xd4, 0xca, 0x4a, 0x78, 0x72, 0x8a, 0xf2, 0x1a, 0xcc, 0xd9,
- 0x24, 0xb0, 0x1c, 0x57, 0xb6, 0x74, 0xa9, 0xe7, 0x00, 0x52, 0x58, 0x53, 0xb2, 0x36, 0x4a, 0xdc,
- 0x26, 0xf5, 0x81, 0x43, 0x81, 0x3c, 0x60, 0xb7, 0x7c, 0x5b, 0x76, 0x24, 0xf9, 0x38, 0x60, 0x6f,
- 0xfa, 0x36, 0xc1, 0x02, 0x63, 0xbe, 0x6b, 0x40, 0x49, 0x4a, 0xda, 0xb4, 0x7a, 0x8c, 0xa0, 0x2b,
- 0xd1, 0x2a, 0xe4, 0x71, 0x5f, 0xd2, 0xc7, 0x63, 0x67, 0x83, 0x5a, 0x51, 0x90, 0x89, 0x66, 0x66,
- 0xcc, 0x18, 0x28, 0x73, 0xce, 0x1e, 0x3d, 0x0a, 0x79, 0x71, 0x81, 0xd4, 0x66, 0xc6, 0x73, 0x3e,
- 0x0e, 0xc4, 0x12, 0x67, 0x7e, 0x9c, 0x81, 0x4a, 0x62, 0x71, 0x29, 0xfa, 0x82, 0xe8, 0xf5, 0x33,
- 0x93, 0xe2, 0x45, 0x7d, 0xf2, 0x54, 0x5d, 0xa5, 0xaf, 0xd9, 0x07, 0x49, 0x5f, 0xdf, 0x86, 0xd9,
- 0x16, 0xdf, 0xa3, 0xf0, 0x4f, 0x1a, 0x57, 0xa6, 0x39, 0x4e, 0xb1, 0xbb, 0xb1, 0x37, 0x8a, 0x4f,
- 0x86, 0x95, 0x40, 0x74, 0x13, 0x96, 0x28, 0x09, 0x68, 0x7f, 0xe3, 0x30, 0x20, 0x54, 0x7f, 0x07,
- 0xc8, 0xc7, 0xd5, 0x37, 0x1e, 0x26, 0xc0, 0xa3, 0x3c, 0xe6, 0x01, 0x94, 0x6f, 0x5b, 0x07, 0x6e,
- 0x34, 0xd9, 0xc2, 0x50, 0x71, 0xbc, 0x96, 0xdb, 0xb3, 0x89, 0x0c, 0xe8, 0x61, 0xf4, 0x0a, 0x2f,
- 0xed, 0xb6, 0x8e, 0x3c, 0x1b, 0xd4, 0x2e, 0x24, 0x00, 0x72, 0x94, 0x83, 0x93, 0x22, 0x4c, 0x17,
- 0x72, 0x9f, 0x61, 0x27, 0xf9, 0x1d, 0x28, 0xc6, 0xb5, 0xfe, 0x43, 0x56, 0x69, 0xbe, 0x01, 0x05,
- 0xee, 0xf1, 0x61, 0x8f, 0x7a, 0x4e, 0x95, 0x94, 0xac, 0xbd, 0x32, 0x69, 0x6a, 0x2f, 0x31, 0x1f,
- 0xbd, 0xd3, 0xb5, 0x1f, 0x70, 0x3e, 0x9a, 0x79, 0x90, 0xcc, 0x97, 0x9d, 0x32, 0xf3, 0x5d, 0x05,
- 0xf9, 0x1f, 0x12, 0x9e, 0x64, 0x64, 0x01, 0xa1, 0x25, 0x19, 0x3d, 0xff, 0x6b, 0xc3, 0x81, 0x1f,
- 0x1b, 0x00, 0xe2, 0x15, 0xee, 0xc6, 0x09, 0xf1, 0x82, 0x14, 0x93, 0xf8, 0x3b, 0x30, 0xeb, 0x4b,
- 0x8f, 0x94, 0x33, 0xd2, 0x29, 0x9f, 0x7a, 0xa3, 0x8b, 0x24, 0x7d, 0x12, 0x2b, 0x61, 0x8d, 0x97,
- 0x3f, 0xf8, 0x64, 0x75, 0xe6, 0xc3, 0x4f, 0x56, 0x67, 0x3e, 0xfa, 0x64, 0x75, 0xe6, 0xed, 0xd3,
- 0x55, 0xe3, 0x83, 0xd3, 0x55, 0xe3, 0xc3, 0xd3, 0x55, 0xe3, 0xa3, 0xd3, 0x55, 0xe3, 0xe3, 0xd3,
- 0x55, 0xe3, 0xdd, 0x7f, 0xac, 0xce, 0xbc, 0xf6, 0x58, 0x9a, 0xff, 0xe6, 0xfd, 0x37, 0x00, 0x00,
- 0xff, 0xff, 0x0b, 0x4d, 0x51, 0xc5, 0xdb, 0x27, 0x00, 0x00,
+ proto.RegisterFile("k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto", fileDescriptor_a8431b6e0aeeb761)
+}
+
+var fileDescriptor_a8431b6e0aeeb761 = []byte{
+ // 2873 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x1a, 0x5d, 0x6f, 0x23, 0x57,
+ 0x35, 0x63, 0xc7, 0x89, 0x7d, 0x6c, 0xe7, 0xe3, 0x6e, 0x16, 0xbc, 0x41, 0xc4, 0xe9, 0xb4, 0xaa,
+ 0xb6, 0xd0, 0x3a, 0xdd, 0xa5, 0x54, 0xdb, 0x2d, 0x2d, 0xc4, 0xf1, 0x66, 0x9b, 0x76, 0xd3, 0x44,
+ 0x37, 0xbb, 0x0b, 0x94, 0x0a, 0x75, 0xe2, 0xb9, 0x71, 0x86, 0x8c, 0x67, 0xdc, 0x7b, 0xc7, 0x49,
+ 0x0d, 0x0f, 0xf4, 0x01, 0x04, 0x48, 0xa8, 0x2a, 0x6f, 0x3c, 0xa1, 0x56, 0xf0, 0x03, 0x10, 0x4f,
+ 0xbc, 0x83, 0x44, 0x1f, 0x8b, 0x78, 0xa9, 0x04, 0xb2, 0xba, 0xe1, 0x81, 0x47, 0xc4, 0x6b, 0x84,
+ 0x04, 0xba, 0x1f, 0x33, 0x73, 0xc7, 0x1f, 0x9b, 0xf1, 0xee, 0x52, 0xf1, 0xe6, 0x39, 0xdf, 0xf7,
+ 0xde, 0x73, 0xce, 0x3d, 0xe7, 0x5c, 0xc3, 0x73, 0x47, 0xd7, 0x58, 0xcd, 0xf1, 0xd7, 0xac, 0x8e,
+ 0xd3, 0xb6, 0x9a, 0x87, 0x8e, 0x47, 0x68, 0x6f, 0xad, 0x73, 0xd4, 0xe2, 0x00, 0xb6, 0xd6, 0x26,
+ 0x81, 0xb5, 0x76, 0x7c, 0x65, 0xad, 0x45, 0x3c, 0x42, 0xad, 0x80, 0xd8, 0xb5, 0x0e, 0xf5, 0x03,
+ 0x1f, 0x3d, 0x21, 0xb9, 0x6a, 0x3a, 0x57, 0xad, 0x73, 0xd4, 0xe2, 0x00, 0x56, 0xe3, 0x5c, 0xb5,
+ 0xe3, 0x2b, 0xcb, 0xcf, 0xb4, 0x9c, 0xe0, 0xb0, 0xbb, 0x5f, 0x6b, 0xfa, 0xed, 0xb5, 0x96, 0xdf,
+ 0xf2, 0xd7, 0x04, 0xf3, 0x7e, 0xf7, 0x40, 0x7c, 0x89, 0x0f, 0xf1, 0x4b, 0x0a, 0x5d, 0x5e, 0x1b,
+ 0x67, 0x0a, 0xed, 0x7a, 0x81, 0xd3, 0x26, 0x83, 0x56, 0x2c, 0x3f, 0x7f, 0x1e, 0x03, 0x6b, 0x1e,
+ 0x92, 0xb6, 0x35, 0xc8, 0x67, 0xfe, 0x29, 0x0b, 0xf9, 0xf5, 0xdd, 0xad, 0x9b, 0xd4, 0xef, 0x76,
+ 0xd0, 0x2a, 0x4c, 0x7b, 0x56, 0x9b, 0x54, 0x8c, 0x55, 0xe3, 0x72, 0xa1, 0x5e, 0xfa, 0xa8, 0x5f,
+ 0x9d, 0x3a, 0xed, 0x57, 0xa7, 0x5f, 0xb7, 0xda, 0x04, 0x0b, 0x0c, 0x72, 0x21, 0x7f, 0x4c, 0x28,
+ 0x73, 0x7c, 0x8f, 0x55, 0x32, 0xab, 0xd9, 0xcb, 0xc5, 0xab, 0x2f, 0xd7, 0xd2, 0xac, 0xbf, 0x26,
+ 0x14, 0xdc, 0x95, 0xac, 0x9b, 0x3e, 0x6d, 0x38, 0xac, 0xe9, 0x1f, 0x13, 0xda, 0xab, 0x2f, 0x28,
+ 0x2d, 0x79, 0x85, 0x64, 0x38, 0xd2, 0x80, 0x7e, 0x64, 0xc0, 0x42, 0x87, 0x92, 0x03, 0x42, 0x29,
+ 0xb1, 0x15, 0xbe, 0x92, 0x5d, 0x35, 0x1e, 0x81, 0xda, 0x8a, 0x52, 0xbb, 0xb0, 0x3b, 0x20, 0x1f,
+ 0x0f, 0x69, 0x44, 0xbf, 0x36, 0x60, 0x99, 0x11, 0x7a, 0x4c, 0xe8, 0xba, 0x6d, 0x53, 0xc2, 0x58,
+ 0xbd, 0xb7, 0xe1, 0x3a, 0xc4, 0x0b, 0x36, 0xb6, 0x1a, 0x98, 0x55, 0xa6, 0xc5, 0x3e, 0x7c, 0x3d,
+ 0x9d, 0x41, 0x7b, 0xe3, 0xe4, 0xd4, 0x4d, 0x65, 0xd1, 0xf2, 0x58, 0x12, 0x86, 0xef, 0x63, 0x86,
+ 0x79, 0x00, 0xa5, 0xf0, 0x20, 0x6f, 0x39, 0x2c, 0x40, 0x77, 0x61, 0xa6, 0xc5, 0x3f, 0x58, 0xc5,
+ 0x10, 0x06, 0xd6, 0xd2, 0x19, 0x18, 0xca, 0xa8, 0xcf, 0x29, 0x7b, 0x66, 0xc4, 0x27, 0xc3, 0x4a,
+ 0x9a, 0xf9, 0xb3, 0x69, 0x28, 0xae, 0xef, 0x6e, 0x61, 0xc2, 0xfc, 0x2e, 0x6d, 0x92, 0x14, 0x4e,
+ 0x73, 0x0d, 0x4a, 0xcc, 0xf1, 0x5a, 0x5d, 0xd7, 0xa2, 0x1c, 0x5a, 0x99, 0x11, 0x94, 0x4b, 0x8a,
+ 0xb2, 0xb4, 0xa7, 0xe1, 0x70, 0x82, 0x12, 0x5d, 0x05, 0xe0, 0x12, 0x58, 0xc7, 0x6a, 0x12, 0xbb,
+ 0x92, 0x59, 0x35, 0x2e, 0xe7, 0xeb, 0x48, 0xf1, 0xc1, 0xeb, 0x11, 0x06, 0x6b, 0x54, 0xe8, 0x71,
+ 0xc8, 0x09, 0x4b, 0x2b, 0x79, 0xa1, 0xa6, 0xac, 0xc8, 0x73, 0x62, 0x19, 0x58, 0xe2, 0xd0, 0x53,
+ 0x30, 0xab, 0xbc, 0xac, 0x52, 0x10, 0x64, 0xf3, 0x8a, 0x6c, 0x36, 0x74, 0x83, 0x10, 0xcf, 0xd7,
+ 0x77, 0xe4, 0x78, 0xb6, 0xf0, 0x3b, 0x6d, 0x7d, 0xaf, 0x39, 0x9e, 0x8d, 0x05, 0x06, 0xdd, 0x82,
+ 0xdc, 0x31, 0xa1, 0xfb, 0xdc, 0x13, 0xb8, 0x6b, 0x7e, 0x39, 0xdd, 0x46, 0xdf, 0xe5, 0x2c, 0xf5,
+ 0x02, 0x37, 0x4d, 0xfc, 0xc4, 0x52, 0x08, 0xaa, 0x01, 0xb0, 0x43, 0x9f, 0x06, 0x62, 0x79, 0x95,
+ 0xdc, 0x6a, 0xf6, 0x72, 0xa1, 0x3e, 0xc7, 0xd7, 0xbb, 0x17, 0x41, 0xb1, 0x46, 0xc1, 0xe9, 0x9b,
+ 0x56, 0x40, 0x5a, 0x3e, 0x75, 0x08, 0xab, 0xcc, 0xc6, 0xf4, 0x1b, 0x11, 0x14, 0x6b, 0x14, 0xe8,
+ 0x55, 0x40, 0x2c, 0xf0, 0xa9, 0xd5, 0x22, 0x6a, 0xa9, 0xaf, 0x58, 0xec, 0xb0, 0x02, 0x62, 0x75,
+ 0xcb, 0x6a, 0x75, 0x68, 0x6f, 0x88, 0x02, 0x8f, 0xe0, 0x32, 0x7f, 0x67, 0xc0, 0xbc, 0xe6, 0x0b,
+ 0xc2, 0xef, 0xae, 0x41, 0xa9, 0xa5, 0x45, 0x9d, 0xf2, 0x8b, 0xe8, 0xb4, 0xf5, 0x88, 0xc4, 0x09,
+ 0x4a, 0x44, 0xa0, 0x40, 0x95, 0xa4, 0x30, 0xbb, 0x5c, 0x49, 0xed, 0xb4, 0xa1, 0x0d, 0xb1, 0x26,
+ 0x0d, 0xc8, 0x70, 0x2c, 0xd9, 0xfc, 0x87, 0x21, 0x1c, 0x38, 0xcc, 0x37, 0xe8, 0xb2, 0x96, 0xd3,
+ 0x0c, 0xb1, 0x7d, 0xa5, 0x31, 0xf9, 0xe8, 0x9c, 0x44, 0x90, 0xf9, 0xbf, 0x48, 0x04, 0xd7, 0xf3,
+ 0xbf, 0xfc, 0xa0, 0x3a, 0xf5, 0xee, 0xdf, 0x56, 0xa7, 0xcc, 0x5f, 0x18, 0x50, 0x5a, 0xef, 0x74,
+ 0xdc, 0xde, 0x4e, 0x27, 0x10, 0x0b, 0x30, 0x61, 0xc6, 0xa6, 0x3d, 0xdc, 0xf5, 0xd4, 0x42, 0x81,
+ 0xc7, 0x77, 0x43, 0x40, 0xb0, 0xc2, 0xf0, 0xf8, 0x39, 0xf0, 0x69, 0x93, 0xa8, 0x70, 0x8b, 0xe2,
+ 0x67, 0x93, 0x03, 0xb1, 0xc4, 0xf1, 0x43, 0x3e, 0x70, 0x88, 0x6b, 0x6f, 0x5b, 0x9e, 0xd5, 0x22,
+ 0x54, 0x05, 0x47, 0xb4, 0xf5, 0x9b, 0x1a, 0x0e, 0x27, 0x28, 0xcd, 0xff, 0x64, 0xa0, 0xb0, 0xe1,
+ 0x7b, 0xb6, 0x13, 0xa8, 0xe0, 0x0a, 0x7a, 0x9d, 0xa1, 0xe4, 0x71, 0xbb, 0xd7, 0x21, 0x58, 0x60,
+ 0xd0, 0x0b, 0x30, 0xc3, 0x02, 0x2b, 0xe8, 0x32, 0x61, 0x4f, 0xa1, 0xfe, 0x58, 0x98, 0x96, 0xf6,
+ 0x04, 0xf4, 0xac, 0x5f, 0x9d, 0x8f, 0xc4, 0x49, 0x10, 0x56, 0x0c, 0xdc, 0xd3, 0xfd, 0x7d, 0xb1,
+ 0x51, 0xf6, 0x4d, 0x79, 0xed, 0x85, 0xf7, 0x47, 0x36, 0xf6, 0xf4, 0x9d, 0x21, 0x0a, 0x3c, 0x82,
+ 0x0b, 0x1d, 0x03, 0x72, 0x2d, 0x16, 0xdc, 0xa6, 0x96, 0xc7, 0x84, 0xae, 0xdb, 0x4e, 0x9b, 0xa8,
+ 0x80, 0xff, 0x52, 0xba, 0x13, 0xe7, 0x1c, 0xb1, 0xde, 0x5b, 0x43, 0xd2, 0xf0, 0x08, 0x0d, 0xe8,
+ 0x49, 0x98, 0xa1, 0xc4, 0x62, 0xbe, 0x57, 0xc9, 0x89, 0xe5, 0x47, 0x59, 0x19, 0x0b, 0x28, 0x56,
+ 0x58, 0x9e, 0xd0, 0xda, 0x84, 0x31, 0xab, 0x15, 0xa6, 0xd7, 0x28, 0xa1, 0x6d, 0x4b, 0x30, 0x0e,
+ 0xf1, 0xe6, 0x6f, 0x0d, 0x28, 0x6f, 0x50, 0x62, 0x05, 0x64, 0x12, 0xb7, 0x78, 0xe0, 0x13, 0x47,
+ 0xeb, 0x30, 0x2f, 0xbe, 0xef, 0x5a, 0xae, 0x63, 0xcb, 0x33, 0x98, 0x16, 0xcc, 0x9f, 0x57, 0xcc,
+ 0xf3, 0x9b, 0x49, 0x34, 0x1e, 0xa4, 0x37, 0x7f, 0x92, 0x85, 0x72, 0x83, 0xb8, 0x24, 0x36, 0x79,
+ 0x13, 0x50, 0x8b, 0x5a, 0x4d, 0xb2, 0x4b, 0xa8, 0xe3, 0xdb, 0x7b, 0xa4, 0xe9, 0x7b, 0x36, 0x13,
+ 0x6e, 0x94, 0xad, 0x7f, 0x8e, 0xef, 0xef, 0xcd, 0x21, 0x2c, 0x1e, 0xc1, 0x81, 0x5c, 0x28, 0x77,
+ 0xa8, 0xf8, 0x2d, 0xf6, 0x5c, 0x7a, 0x59, 0xf1, 0xea, 0x57, 0xd2, 0x1d, 0xe9, 0xae, 0xce, 0x5a,
+ 0x5f, 0x3c, 0xed, 0x57, 0xcb, 0x09, 0x10, 0x4e, 0x0a, 0x47, 0xdf, 0x80, 0x05, 0x9f, 0x76, 0x0e,
+ 0x2d, 0xaf, 0x41, 0x3a, 0xc4, 0xb3, 0x89, 0x17, 0x30, 0xb1, 0x91, 0xf9, 0xfa, 0x12, 0xaf, 0x45,
+ 0x76, 0x06, 0x70, 0x78, 0x88, 0x1a, 0xbd, 0x01, 0x8b, 0x1d, 0xea, 0x77, 0xac, 0x96, 0xd8, 0x98,
+ 0x5d, 0xdf, 0x75, 0x9a, 0x3d, 0xb5, 0x9d, 0x4f, 0x9f, 0xf6, 0xab, 0x8b, 0xbb, 0x83, 0xc8, 0xb3,
+ 0x7e, 0xf5, 0x82, 0xd8, 0x3a, 0x0e, 0x89, 0x91, 0x78, 0x58, 0x8c, 0xe6, 0x06, 0xb9, 0x71, 0x6e,
+ 0x60, 0x6e, 0x41, 0xbe, 0xd1, 0x55, 0x31, 0xf1, 0x12, 0xe4, 0x6d, 0xf5, 0x5b, 0xed, 0x7c, 0x18,
+ 0x9c, 0x11, 0xcd, 0x59, 0xbf, 0x5a, 0xe6, 0xe5, 0x67, 0x2d, 0x04, 0xe0, 0x88, 0xc5, 0xfc, 0x8d,
+ 0x01, 0x15, 0x71, 0xf2, 0x7b, 0xc4, 0x25, 0xcd, 0xc0, 0xa7, 0x98, 0xbc, 0xdd, 0x75, 0x28, 0x69,
+ 0x13, 0x2f, 0x40, 0x5f, 0x84, 0xec, 0x11, 0xe9, 0xa9, 0xbc, 0x50, 0x54, 0x62, 0xb3, 0xaf, 0x91,
+ 0x1e, 0xe6, 0x70, 0x74, 0x03, 0xf2, 0x7e, 0x87, 0xc7, 0xa6, 0x4f, 0x55, 0x5e, 0x78, 0x2a, 0x54,
+ 0xbd, 0xa3, 0xe0, 0x67, 0xfd, 0xea, 0xc5, 0x84, 0xf8, 0x10, 0x81, 0x23, 0x56, 0xbe, 0xe2, 0x63,
+ 0xcb, 0xed, 0x12, 0x7e, 0x0a, 0xd1, 0x8a, 0xef, 0x0a, 0x08, 0x56, 0x18, 0xf3, 0x49, 0xc8, 0x0b,
+ 0x31, 0xec, 0xee, 0x15, 0xb4, 0x00, 0x59, 0x6c, 0x9d, 0x08, 0xab, 0x4a, 0x98, 0xff, 0xd4, 0x92,
+ 0xed, 0x0e, 0xc0, 0x4d, 0x12, 0x84, 0xfe, 0xb9, 0x0e, 0xf3, 0xe1, 0x8d, 0x93, 0xbc, 0x08, 0x23,
+ 0xa7, 0xc7, 0x49, 0x34, 0x1e, 0xa4, 0x37, 0xdf, 0x84, 0x82, 0xb8, 0x2c, 0x79, 0xa5, 0x11, 0x57,
+ 0x35, 0xc6, 0x7d, 0xaa, 0x9a, 0xb0, 0x54, 0xc9, 0x8c, 0x2b, 0x55, 0x34, 0x73, 0x5d, 0x28, 0x4b,
+ 0xde, 0xb0, 0x8e, 0x4b, 0xa5, 0xe1, 0x69, 0xc8, 0x87, 0x66, 0x2a, 0x2d, 0x51, 0xfd, 0x1e, 0x0a,
+ 0xc2, 0x11, 0x85, 0xa6, 0xed, 0x10, 0x12, 0x17, 0x7f, 0x3a, 0x65, 0x5a, 0x91, 0x96, 0xb9, 0x7f,
+ 0x91, 0xa6, 0x69, 0xfa, 0x21, 0x54, 0xc6, 0x15, 0xfd, 0x0f, 0x51, 0x9a, 0xa4, 0x37, 0xc5, 0x7c,
+ 0xcf, 0x80, 0x05, 0x5d, 0x52, 0xfa, 0xe3, 0x4b, 0xaf, 0xe4, 0xfc, 0xa2, 0x54, 0xdb, 0x91, 0x5f,
+ 0x19, 0xb0, 0x94, 0x58, 0xda, 0x44, 0x27, 0x3e, 0x81, 0x51, 0xba, 0x73, 0x64, 0x27, 0x70, 0x8e,
+ 0xbf, 0x64, 0xa0, 0x7c, 0xcb, 0xda, 0x27, 0x6e, 0x18, 0xa9, 0xe8, 0x07, 0x50, 0x6c, 0x5b, 0x41,
+ 0xf3, 0x50, 0x40, 0xc3, 0x06, 0xa6, 0x91, 0x2e, 0x27, 0x27, 0x24, 0xd5, 0xb6, 0x63, 0x31, 0x37,
+ 0xbc, 0x80, 0xf6, 0xea, 0x17, 0x94, 0x49, 0x45, 0x0d, 0x83, 0x75, 0x6d, 0xa2, 0xeb, 0x14, 0xdf,
+ 0x37, 0xde, 0xe9, 0xf0, 0xea, 0x6a, 0xf2, 0x66, 0x37, 0x61, 0x82, 0x96, 0xd5, 0xe2, 0xae, 0x73,
+ 0x7b, 0x40, 0x3e, 0x1e, 0xd2, 0xb8, 0xfc, 0x32, 0x2c, 0x0c, 0x1a, 0xcf, 0xf3, 0x4f, 0x94, 0x15,
+ 0x65, 0x22, 0x5c, 0x82, 0x9c, 0xc8, 0x53, 0xf2, 0x70, 0xb0, 0xfc, 0xb8, 0x9e, 0xb9, 0x66, 0x88,
+ 0xf4, 0x3a, 0xce, 0x90, 0x47, 0x94, 0x5e, 0x13, 0xe2, 0x1f, 0x30, 0xbd, 0xfe, 0xde, 0x80, 0x69,
+ 0xd1, 0x37, 0xbc, 0x09, 0x79, 0xbe, 0x7f, 0xb6, 0x15, 0x58, 0xc2, 0xae, 0xd4, 0x1d, 0x2b, 0xe7,
+ 0xde, 0x26, 0x81, 0x15, 0x7b, 0x5b, 0x08, 0xc1, 0x91, 0x44, 0x84, 0x21, 0xe7, 0x04, 0xa4, 0x1d,
+ 0x1e, 0xe4, 0x33, 0x63, 0x45, 0xab, 0x79, 0x49, 0x0d, 0x5b, 0x27, 0x37, 0xde, 0x09, 0x88, 0xc7,
+ 0x0f, 0x23, 0x0e, 0x8d, 0x2d, 0x2e, 0x03, 0x4b, 0x51, 0xe6, 0xbf, 0x0c, 0x88, 0x54, 0x71, 0xe7,
+ 0x67, 0xc4, 0x3d, 0xb8, 0xe5, 0x78, 0x47, 0x6a, 0x5b, 0x23, 0x73, 0xf6, 0x14, 0x1c, 0x47, 0x14,
+ 0xa3, 0xae, 0x87, 0xcc, 0x64, 0xd7, 0x03, 0x57, 0xd8, 0xf4, 0xbd, 0xc0, 0xf1, 0xba, 0x43, 0xd1,
+ 0xb6, 0xa1, 0xe0, 0x38, 0xa2, 0xe0, 0xf5, 0x12, 0x25, 0x6d, 0xcb, 0xf1, 0x1c, 0xaf, 0xc5, 0x17,
+ 0xb1, 0xe1, 0x77, 0xbd, 0x40, 0x14, 0x0e, 0xaa, 0x5e, 0xc2, 0x43, 0x58, 0x3c, 0x82, 0xc3, 0xfc,
+ 0xf7, 0x34, 0x14, 0xf9, 0x9a, 0xc3, 0x7b, 0xee, 0x45, 0x28, 0xbb, 0xba, 0x17, 0xa8, 0xb5, 0x5f,
+ 0x54, 0xa6, 0x24, 0xe3, 0x1a, 0x27, 0x69, 0x39, 0xf3, 0x81, 0x7e, 0x43, 0xab, 0x3d, 0x88, 0x98,
+ 0x93, 0xd5, 0x41, 0x92, 0x96, 0x67, 0xaf, 0x13, 0x1e, 0x1f, 0xaa, 0x80, 0x8a, 0x8e, 0xe8, 0x9b,
+ 0x1c, 0x88, 0x25, 0x0e, 0x6d, 0xc3, 0x05, 0xcb, 0x75, 0xfd, 0x13, 0x01, 0xac, 0xfb, 0xfe, 0x51,
+ 0xdb, 0xa2, 0x47, 0x4c, 0xf4, 0xfc, 0xf9, 0xfa, 0x17, 0x14, 0xcb, 0x85, 0xf5, 0x61, 0x12, 0x3c,
+ 0x8a, 0x6f, 0xd4, 0xb1, 0x4d, 0x4f, 0x78, 0x6c, 0x87, 0xb0, 0x34, 0x00, 0x12, 0x51, 0xae, 0x1a,
+ 0xf0, 0xe7, 0x94, 0x9c, 0x25, 0x3c, 0x82, 0xe6, 0x6c, 0x0c, 0x1c, 0x8f, 0x94, 0x88, 0xae, 0xc3,
+ 0x1c, 0xf7, 0x64, 0xbf, 0x1b, 0x84, 0xe5, 0x71, 0x4e, 0x1c, 0x37, 0x3a, 0xed, 0x57, 0xe7, 0x6e,
+ 0x27, 0x30, 0x78, 0x80, 0x92, 0x6f, 0xae, 0xeb, 0xb4, 0x9d, 0xa0, 0x32, 0x2b, 0x58, 0xa2, 0xcd,
+ 0xbd, 0xc5, 0x81, 0x58, 0xe2, 0x12, 0x1e, 0x98, 0x3f, 0xd7, 0x03, 0x37, 0x60, 0x91, 0x11, 0xcf,
+ 0xde, 0xf2, 0x9c, 0xc0, 0xb1, 0xdc, 0x1b, 0xc7, 0xa2, 0xf8, 0x2d, 0x8a, 0x83, 0xb8, 0xc8, 0x2b,
+ 0xd7, 0xbd, 0x41, 0x24, 0x1e, 0xa6, 0x37, 0xff, 0x9c, 0x05, 0x24, 0xfb, 0x0a, 0x5b, 0x16, 0x65,
+ 0x32, 0x2f, 0xf2, 0xee, 0x47, 0xf5, 0x25, 0xc6, 0x40, 0xf7, 0xa3, 0x5a, 0x92, 0x10, 0x8f, 0xb6,
+ 0xa1, 0x20, 0xf3, 0x53, 0x1c, 0x73, 0x6b, 0x8a, 0xb8, 0xb0, 0x13, 0x22, 0xce, 0xfa, 0xd5, 0xe5,
+ 0x84, 0x9a, 0x08, 0x23, 0x3a, 0xd3, 0x58, 0x02, 0xba, 0x0a, 0x60, 0x75, 0x1c, 0x7d, 0x36, 0x59,
+ 0x88, 0x27, 0x54, 0xf1, 0x94, 0x01, 0x6b, 0x54, 0xe8, 0x15, 0x98, 0x0e, 0x1e, 0xac, 0x7b, 0xcc,
+ 0x8b, 0xe6, 0x98, 0xf7, 0x8a, 0x42, 0x02, 0xd7, 0x2e, 0x82, 0x82, 0x71, 0xb3, 0x54, 0xe3, 0x17,
+ 0x69, 0xdf, 0x8c, 0x30, 0x58, 0xa3, 0x42, 0xdf, 0x82, 0xfc, 0x81, 0xaa, 0x67, 0xc5, 0xe9, 0xa6,
+ 0xce, 0xb3, 0x61, 0x15, 0x2c, 0xc7, 0x23, 0xe1, 0x17, 0x8e, 0xa4, 0xa1, 0xaf, 0x42, 0x91, 0x75,
+ 0xf7, 0xa3, 0x12, 0x40, 0xba, 0x44, 0x74, 0xdf, 0xee, 0xc5, 0x28, 0xac, 0xd3, 0x99, 0x6f, 0x43,
+ 0x61, 0xdb, 0x69, 0x52, 0x5f, 0xf4, 0xbb, 0x4f, 0xc1, 0x2c, 0x4b, 0x34, 0x73, 0xd1, 0x49, 0x86,
+ 0xae, 0x1a, 0xe2, 0xb9, 0x8f, 0x7a, 0x96, 0xe7, 0xcb, 0x96, 0x2d, 0x17, 0xfb, 0xe8, 0xeb, 0x1c,
+ 0x88, 0x25, 0xee, 0xfa, 0x12, 0xaf, 0x32, 0x7e, 0xfa, 0x61, 0x75, 0xea, 0xfd, 0x0f, 0xab, 0x53,
+ 0x1f, 0x7c, 0xa8, 0x2a, 0x8e, 0x3f, 0x00, 0xc0, 0xce, 0xfe, 0xf7, 0x48, 0x53, 0xe6, 0xee, 0x54,
+ 0x23, 0xcc, 0x70, 0x72, 0x2e, 0x46, 0x98, 0x99, 0x81, 0xca, 0x51, 0xc3, 0xe1, 0x04, 0x25, 0x5a,
+ 0x83, 0x42, 0x34, 0x9c, 0x54, 0xfe, 0xb1, 0x18, 0xfa, 0x5b, 0x34, 0xc1, 0xc4, 0x31, 0x4d, 0xe2,
+ 0x22, 0x99, 0x3e, 0xf7, 0x22, 0xa9, 0x43, 0xb6, 0xeb, 0xd8, 0x6a, 0x38, 0xf0, 0x6c, 0x78, 0x91,
+ 0xdf, 0xd9, 0x6a, 0x9c, 0xf5, 0xab, 0x8f, 0x8d, 0x7b, 0x13, 0x08, 0x7a, 0x1d, 0xc2, 0x6a, 0x77,
+ 0xb6, 0x1a, 0x98, 0x33, 0x8f, 0xca, 0x6a, 0x33, 0x13, 0x66, 0xb5, 0xab, 0x00, 0xad, 0x78, 0xc4,
+ 0x22, 0x93, 0x46, 0xe4, 0x88, 0xda, 0x68, 0x45, 0xa3, 0x42, 0x0c, 0x16, 0x9b, 0x94, 0x58, 0xe1,
+ 0xa8, 0x83, 0x05, 0x56, 0x5b, 0x0e, 0x6d, 0x27, 0x8b, 0x89, 0x4b, 0x4a, 0xcd, 0xe2, 0xc6, 0xa0,
+ 0x30, 0x3c, 0x2c, 0x1f, 0xf9, 0xb0, 0x68, 0xab, 0x6e, 0x38, 0x56, 0x5a, 0x98, 0x58, 0xa9, 0xc8,
+ 0x58, 0x8d, 0x41, 0x41, 0x78, 0x58, 0x36, 0xfa, 0x2e, 0x2c, 0x87, 0xc0, 0xe1, 0x91, 0x84, 0xc8,
+ 0xfa, 0xd9, 0xfa, 0xca, 0x69, 0xbf, 0xba, 0xdc, 0x18, 0x4b, 0x85, 0xef, 0x23, 0x01, 0xd9, 0x30,
+ 0xe3, 0xca, 0x2a, 0xb9, 0x28, 0x2a, 0x9b, 0xaf, 0xa5, 0x5b, 0x45, 0xec, 0xfd, 0x35, 0xbd, 0x3a,
+ 0x8e, 0xc6, 0x4b, 0xaa, 0x30, 0x56, 0xb2, 0xd1, 0x3b, 0x50, 0xb4, 0x3c, 0xcf, 0x0f, 0x2c, 0x39,
+ 0x24, 0x29, 0x09, 0x55, 0xeb, 0x13, 0xab, 0x5a, 0x8f, 0x65, 0x0c, 0x54, 0xe3, 0x1a, 0x06, 0xeb,
+ 0xaa, 0xd0, 0x09, 0xcc, 0xfb, 0x27, 0x1e, 0xa1, 0x98, 0x1c, 0x10, 0x4a, 0xbc, 0x26, 0x61, 0x95,
+ 0xb2, 0xd0, 0xfe, 0x5c, 0x4a, 0xed, 0x09, 0xe6, 0xd8, 0xa5, 0x93, 0x70, 0x86, 0x07, 0xb5, 0xa0,
+ 0x1a, 0xcf, 0xad, 0x9e, 0xe5, 0x3a, 0xdf, 0x27, 0x94, 0x55, 0xe6, 0xe2, 0xb9, 0xfa, 0x66, 0x04,
+ 0xc5, 0x1a, 0x05, 0xea, 0x42, 0xb9, 0xad, 0x5f, 0x19, 0x95, 0x45, 0x61, 0xe6, 0xb5, 0x74, 0x66,
+ 0x0e, 0x5f, 0x6a, 0x71, 0x19, 0x94, 0xc0, 0xe1, 0xa4, 0x96, 0xe5, 0x17, 0xa0, 0xf8, 0x80, 0x1d,
+ 0x02, 0xef, 0x30, 0x06, 0x0f, 0x64, 0xa2, 0x0e, 0xe3, 0x8f, 0x19, 0x98, 0x4b, 0x6e, 0xe3, 0xc0,
+ 0x75, 0x98, 0x4b, 0x75, 0x1d, 0x86, 0xbd, 0xac, 0x31, 0xf6, 0x81, 0x25, 0xcc, 0xcf, 0xd9, 0xb1,
+ 0xf9, 0x59, 0xa5, 0xc1, 0xe9, 0x87, 0x49, 0x83, 0x35, 0x00, 0x5e, 0xac, 0x50, 0xdf, 0x75, 0x09,
+ 0x15, 0x19, 0x30, 0xaf, 0x1e, 0x52, 0x22, 0x28, 0xd6, 0x28, 0x78, 0x49, 0xbd, 0xef, 0xfa, 0xcd,
+ 0x23, 0xb1, 0x05, 0x61, 0xf4, 0x8a, 0xdc, 0x97, 0x97, 0x25, 0x75, 0x7d, 0x08, 0x8b, 0x47, 0x70,
+ 0x98, 0x3d, 0xb8, 0xb8, 0x6b, 0x51, 0x5e, 0xe4, 0xc4, 0x91, 0x22, 0x7a, 0x96, 0xb7, 0x86, 0x3a,
+ 0xa2, 0x67, 0x27, 0x8d, 0xb8, 0x78, 0xf3, 0x63, 0x58, 0xdc, 0x15, 0x99, 0x7f, 0x35, 0xe0, 0xd2,
+ 0x48, 0xdd, 0x9f, 0x41, 0x47, 0xf6, 0x56, 0xb2, 0x23, 0x7b, 0x31, 0xe5, 0xc4, 0x75, 0x94, 0xb5,
+ 0x63, 0xfa, 0xb3, 0x59, 0xc8, 0xed, 0xf2, 0x4a, 0xd8, 0xfc, 0xd8, 0x80, 0x92, 0xf8, 0x35, 0xc9,
+ 0xc0, 0xbb, 0x9a, 0x7c, 0x07, 0x29, 0x3c, 0xba, 0x37, 0x90, 0x47, 0x31, 0x11, 0x7f, 0xcf, 0x80,
+ 0xe4, 0xa8, 0x19, 0xbd, 0x2c, 0x43, 0xc0, 0x88, 0x66, 0xc1, 0x13, 0xba, 0xff, 0x4b, 0xe3, 0x5a,
+ 0xd2, 0x0b, 0xa9, 0xa6, 0x95, 0x4f, 0x43, 0x01, 0xfb, 0x7e, 0xb0, 0x6b, 0x05, 0x87, 0x8c, 0xef,
+ 0x5d, 0x87, 0xff, 0x50, 0xdb, 0x2b, 0xf6, 0x4e, 0x60, 0xb0, 0x84, 0x9b, 0x3f, 0x37, 0xe0, 0xd2,
+ 0xd8, 0xe7, 0x2d, 0x9e, 0x45, 0x9a, 0xd1, 0x97, 0x5a, 0x51, 0xe4, 0xc8, 0x31, 0x1d, 0xd6, 0xa8,
+ 0x78, 0x2f, 0x99, 0x78, 0x13, 0x1b, 0xec, 0x25, 0x13, 0xda, 0x70, 0x92, 0xd6, 0xfc, 0x67, 0x06,
+ 0xd4, 0x7b, 0xd2, 0xff, 0xd8, 0xe9, 0x9f, 0x1c, 0x78, 0xcd, 0x9a, 0x4b, 0xbe, 0x66, 0x45, 0x4f,
+ 0x57, 0xda, 0x73, 0x4e, 0xf6, 0xfe, 0xcf, 0x39, 0xe8, 0xf9, 0xe8, 0x85, 0x48, 0xfa, 0xd0, 0x4a,
+ 0xf2, 0x85, 0xe8, 0xac, 0x5f, 0x2d, 0x29, 0xe1, 0xc9, 0x17, 0xa3, 0x37, 0x60, 0xd6, 0x26, 0x81,
+ 0xe5, 0xb8, 0xb2, 0x2f, 0x4c, 0xfd, 0xe6, 0x21, 0x85, 0x35, 0x24, 0x6b, 0xbd, 0xc8, 0x6d, 0x52,
+ 0x1f, 0x38, 0x14, 0xc8, 0x13, 0x76, 0xd3, 0xb7, 0x65, 0x47, 0x92, 0x8b, 0x13, 0xf6, 0x86, 0x6f,
+ 0x13, 0x2c, 0x30, 0xe6, 0xfb, 0x06, 0x14, 0xa5, 0xa4, 0x0d, 0xab, 0xcb, 0x08, 0xba, 0x12, 0xad,
+ 0x42, 0x1e, 0xf7, 0x25, 0xfd, 0x29, 0xf0, 0xac, 0x5f, 0x2d, 0x08, 0x32, 0xd1, 0xcc, 0x8c, 0x78,
+ 0xf2, 0xca, 0x9c, 0xb3, 0x47, 0x8f, 0x43, 0x4e, 0x04, 0x90, 0xda, 0xcc, 0xf8, 0x4d, 0x93, 0x03,
+ 0xb1, 0xc4, 0x99, 0x9f, 0x66, 0xa0, 0x9c, 0x58, 0x5c, 0x8a, 0xbe, 0x20, 0x1a, 0xa1, 0x66, 0x52,
+ 0x8c, 0xe5, 0xc7, 0xff, 0x83, 0x40, 0x5d, 0x5f, 0x33, 0x0f, 0x73, 0x7d, 0x7d, 0x1b, 0x66, 0x9a,
+ 0x7c, 0x8f, 0xc2, 0x3f, 0xa4, 0x5c, 0x99, 0xe4, 0x38, 0xc5, 0xee, 0xc6, 0xde, 0x28, 0x3e, 0x19,
+ 0x56, 0x02, 0xd1, 0x4d, 0x58, 0xa4, 0x24, 0xa0, 0xbd, 0xf5, 0x83, 0x80, 0x50, 0x7d, 0x98, 0x90,
+ 0x8b, 0xab, 0x6f, 0x3c, 0x48, 0x80, 0x87, 0x79, 0xcc, 0x7d, 0x28, 0xdd, 0xb6, 0xf6, 0xdd, 0xe8,
+ 0x15, 0x0f, 0x43, 0xd9, 0xf1, 0x9a, 0x6e, 0xd7, 0x26, 0x32, 0xa1, 0x87, 0xd9, 0x2b, 0x0c, 0xda,
+ 0x2d, 0x1d, 0x79, 0xd6, 0xaf, 0x5e, 0x48, 0x00, 0xe4, 0xb3, 0x15, 0x4e, 0x8a, 0x30, 0x5d, 0x98,
+ 0xfe, 0x0c, 0x3b, 0xc9, 0xef, 0x40, 0x21, 0xae, 0xf5, 0x1f, 0xb1, 0x4a, 0xf3, 0x2d, 0xc8, 0x73,
+ 0x8f, 0x0f, 0x7b, 0xd4, 0x73, 0xaa, 0xa4, 0x64, 0xed, 0x95, 0x49, 0x53, 0x7b, 0x89, 0xb7, 0xe0,
+ 0x3b, 0x1d, 0xfb, 0x21, 0xdf, 0x82, 0x33, 0x0f, 0x73, 0xf3, 0x65, 0x27, 0xbc, 0xf9, 0xae, 0x82,
+ 0xfc, 0xbf, 0x0c, 0xbf, 0x64, 0x64, 0x01, 0xa1, 0x5d, 0x32, 0xfa, 0xfd, 0xaf, 0xbd, 0x30, 0xfc,
+ 0xd8, 0x00, 0x10, 0xa3, 0x3c, 0x31, 0x46, 0x4a, 0xf1, 0xaf, 0x83, 0x3b, 0x30, 0xe3, 0x4b, 0x8f,
+ 0x94, 0xef, 0xc1, 0x13, 0xce, 0x8b, 0xa3, 0x40, 0x92, 0x3e, 0x89, 0x95, 0xb0, 0xfa, 0xab, 0x1f,
+ 0xdd, 0x5b, 0x99, 0xfa, 0xf8, 0xde, 0xca, 0xd4, 0x27, 0xf7, 0x56, 0xa6, 0xde, 0x3d, 0x5d, 0x31,
+ 0x3e, 0x3a, 0x5d, 0x31, 0x3e, 0x3e, 0x5d, 0x31, 0x3e, 0x39, 0x5d, 0x31, 0x3e, 0x3d, 0x5d, 0x31,
+ 0xde, 0xff, 0xfb, 0xca, 0xd4, 0x1b, 0x4f, 0xa4, 0xf9, 0x1f, 0xe2, 0x7f, 0x03, 0x00, 0x00, 0xff,
+ 0xff, 0xd3, 0xee, 0xe4, 0x1c, 0xae, 0x28, 0x00, 0x00,
}
func (m *APIGroup) Marshal() (dAtA []byte, err error) {
@@ -2024,6 +2055,48 @@ func (m *Duration) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *FieldSelectorRequirement) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *FieldSelectorRequirement) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *FieldSelectorRequirement) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Values) > 0 {
+ for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- {
+ i -= len(m.Values[iNdEx])
+ copy(dAtA[i:], m.Values[iNdEx])
+ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Values[iNdEx])))
+ i--
+ dAtA[i] = 0x1a
+ }
+ }
+ i -= len(m.Operator)
+ copy(dAtA[i:], m.Operator)
+ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Operator)))
+ i--
+ dAtA[i] = 0x12
+ i -= len(m.Key)
+ copy(dAtA[i:], m.Key)
+ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key)))
+ i--
+ dAtA[i] = 0xa
+ return len(dAtA) - i, nil
+}
+
func (m *FieldsV1) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -2503,6 +2576,16 @@ func (m *ListOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
+ if m.SendInitialEvents != nil {
+ i--
+ if *m.SendInitialEvents {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x58
+ }
i -= len(m.ResourceVersionMatch)
copy(dAtA[i:], m.ResourceVersionMatch)
i = encodeVarintGenerated(dAtA, i, uint64(len(m.ResourceVersionMatch)))
@@ -3703,6 +3786,25 @@ func (m *Duration) Size() (n int) {
return n
}
+func (m *FieldSelectorRequirement) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ l = len(m.Key)
+ n += 1 + l + sovGenerated(uint64(l))
+ l = len(m.Operator)
+ n += 1 + l + sovGenerated(uint64(l))
+ if len(m.Values) > 0 {
+ for _, s := range m.Values {
+ l = len(s)
+ n += 1 + l + sovGenerated(uint64(l))
+ }
+ }
+ return n
+}
+
func (m *FieldsV1) Size() (n int) {
if m == nil {
return 0
@@ -3908,6 +4010,9 @@ func (m *ListOptions) Size() (n int) {
n += 2
l = len(m.ResourceVersionMatch)
n += 1 + l + sovGenerated(uint64(l))
+ if m.SendInitialEvents != nil {
+ n += 2
+ }
return n
}
@@ -4415,6 +4520,18 @@ func (this *Duration) String() string {
}, "")
return s
}
+func (this *FieldSelectorRequirement) String() string {
+ if this == nil {
+ return "nil"
+ }
+ s := strings.Join([]string{`&FieldSelectorRequirement{`,
+ `Key:` + fmt.Sprintf("%v", this.Key) + `,`,
+ `Operator:` + fmt.Sprintf("%v", this.Operator) + `,`,
+ `Values:` + fmt.Sprintf("%v", this.Values) + `,`,
+ `}`,
+ }, "")
+ return s
+}
func (this *GetOptions) String() string {
if this == nil {
return "nil"
@@ -4517,6 +4634,7 @@ func (this *ListOptions) String() string {
`Continue:` + fmt.Sprintf("%v", this.Continue) + `,`,
`AllowWatchBookmarks:` + fmt.Sprintf("%v", this.AllowWatchBookmarks) + `,`,
`ResourceVersionMatch:` + fmt.Sprintf("%v", this.ResourceVersionMatch) + `,`,
+ `SendInitialEvents:` + valueToStringGenerated(this.SendInitialEvents) + `,`,
`}`,
}, "")
return s
@@ -6428,6 +6546,152 @@ func (m *Duration) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *FieldSelectorRequirement) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: FieldSelectorRequirement: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: FieldSelectorRequirement: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Key = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Operator = FieldSelectorOperator(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 3:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Values = append(m.Values, string(dAtA[iNdEx:postIndex]))
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipGenerated(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthGenerated
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *FieldsV1) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -8250,6 +8514,27 @@ func (m *ListOptions) Unmarshal(dAtA []byte) error {
}
m.ResourceVersionMatch = ResourceVersionMatch(dAtA[iNdEx:postIndex])
iNdEx = postIndex
+ case 11:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field SendInitialEvents", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowGenerated
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ b := bool(v != 0)
+ m.SendInitialEvents = &b
default:
iNdEx = preIndex
skippy, err := skipGenerated(dAtA[iNdEx:])
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
index 2be188a6a..18dd0b067 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto
@@ -34,6 +34,7 @@ message APIGroup {
optional string name = 1;
// versions are the versions supported in this group.
+ // +listType=atomic
repeated GroupVersionForDiscovery versions = 2;
// preferredVersion is the version preferred by the API server, which
@@ -49,6 +50,7 @@ message APIGroup {
// For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
// Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
// +optional
+ // +listType=atomic
repeated ServerAddressByClientCIDR serverAddressByClientCIDRs = 4;
}
@@ -56,6 +58,7 @@ message APIGroup {
// /apis.
message APIGroupList {
// groups is a list of APIGroup.
+ // +listType=atomic
repeated APIGroup groups = 1;
}
@@ -88,9 +91,11 @@ message APIResource {
optional Verbs verbs = 4;
// shortNames is a list of suggested short names of the resource.
+ // +listType=atomic
repeated string shortNames = 5;
// categories is a list of the grouped resources this resource belongs to (e.g. 'all')
+ // +listType=atomic
repeated string categories = 7;
// The hash value of the storage version, the version this resource is
@@ -112,6 +117,7 @@ message APIResourceList {
optional string groupVersion = 1;
// resources contains the name of the resources and if they are namespaced.
+ // +listType=atomic
repeated APIResource resources = 2;
}
@@ -122,6 +128,7 @@ message APIResourceList {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
message APIVersions {
// versions are the api versions that are available.
+ // +listType=atomic
repeated string versions = 1;
// a map of client CIDR to server address that is serving this group.
@@ -131,6 +138,7 @@ message APIVersions {
// The server returns only those CIDRs that it thinks that the client can match.
// For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
// Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
+ // +listType=atomic
repeated ServerAddressByClientCIDR serverAddressByClientCIDRs = 2;
}
@@ -145,6 +153,7 @@ message ApplyOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 1;
// Force is going to "force" Apply requests. It means user will
@@ -235,6 +244,7 @@ message CreateOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 1;
// fieldManager is a name associated with the actor or entity
@@ -246,19 +256,16 @@ message CreateOptions {
// fieldValidation instructs the server on how to handle
// objects in the request (POST/PUT/PATCH) containing unknown
- // or duplicate fields, provided that the `ServerSideFieldValidation`
- // feature gate is also enabled. Valid values are:
+ // or duplicate fields. Valid values are:
// - Ignore: This will ignore any unknown fields that are silently
// dropped from the object, and will ignore all but the last duplicate
// field that the decoder encounters. This is the default behavior
- // prior to v1.23 and is the default behavior when the
- // `ServerSideFieldValidation` feature gate is disabled.
+ // prior to v1.23.
// - Warn: This will send a warning via the standard warning response
// header for each unknown field that is dropped from the object, and
// for each duplicate field that is encountered. The request will
// still succeed if there are no other errors, and will only persist
- // the last of any duplicate fields. This is the default when the
- // `ServerSideFieldValidation` feature gate is enabled.
+ // the last of any duplicate fields. This is the default in v1.23+
// - Strict: This will fail the request with a BadRequest error if
// any unknown fields would be dropped from the object, or if any
// duplicate fields are present. The error returned from the server
@@ -306,6 +313,7 @@ message DeleteOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 5;
}
@@ -316,6 +324,25 @@ message Duration {
optional int64 duration = 1;
}
+// FieldSelectorRequirement is a selector that contains values, a key, and an operator that
+// relates the key and values.
+message FieldSelectorRequirement {
+ // key is the field selector key that the requirement applies to.
+ optional string key = 1;
+
+ // operator represents a key's relationship to a set of values.
+ // Valid operators are In, NotIn, Exists, DoesNotExist.
+ // The list of operators may grow in the future.
+ optional string operator = 2;
+
+ // values is an array of string values.
+ // If the operator is In or NotIn, the values array must be non-empty.
+ // If the operator is Exists or DoesNotExist, the values array must be empty.
+ // +optional
+ // +listType=atomic
+ repeated string values = 3;
+}
+
// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.
//
// Each key is either a '.' representing the field itself, and will always map to an empty set,
@@ -421,6 +448,7 @@ message LabelSelector {
// matchExpressions is a list of label selector requirements. The requirements are ANDed.
// +optional
+ // +listType=atomic
repeated LabelSelectorRequirement matchExpressions = 2;
}
@@ -428,8 +456,6 @@ message LabelSelector {
// relates the key and values.
message LabelSelectorRequirement {
// key is the label key that the selector applies to.
- // +patchMergeKey=key
- // +patchStrategy=merge
optional string key = 1;
// operator represents a key's relationship to a set of values.
@@ -441,6 +467,7 @@ message LabelSelectorRequirement {
// the values array must be empty. This array is replaced during a strategic
// merge patch.
// +optional
+ // +listType=atomic
repeated string values = 3;
}
@@ -452,7 +479,7 @@ message List {
optional ListMeta metadata = 1;
// List of objects
- repeated k8s.io.apimachinery.pkg.runtime.RawExtension items = 2;
+ repeated .k8s.io.apimachinery.pkg.runtime.RawExtension items = 2;
}
// ListMeta describes metadata that synthetic resources must have, including lists and
@@ -575,6 +602,32 @@ message ListOptions {
// This field is not supported when watch is true. Clients may start a watch from the last
// resourceVersion value returned by the server and not miss any modifications.
optional string continue = 8;
+
+ // `sendInitialEvents=true` may be set together with `watch=true`.
+ // In that case, the watch stream will begin with synthetic events to
+ // produce the current state of objects in the collection. Once all such
+ // events have been sent, a synthetic "Bookmark" event will be sent.
+ // The bookmark will report the ResourceVersion (RV) corresponding to the
+ // set of objects, and be marked with `"k8s.io/initial-events-end": "true"` annotation.
+ // Afterwards, the watch stream will proceed as usual, sending watch events
+ // corresponding to changes (subsequent to the RV) to objects watched.
+ //
+ // When `sendInitialEvents` option is set, we require `resourceVersionMatch`
+ // option to also be set. The semantic of the watch request is as following:
+ // - `resourceVersionMatch` = NotOlderThan
+ // is interpreted as "data at least as new as the provided `resourceVersion`"
+ // and the bookmark event is send when the state is synced
+ // to a `resourceVersion` at least as fresh as the one provided by the ListOptions.
+ // If `resourceVersion` is unset, this is interpreted as "consistent read" and the
+ // bookmark event is send when the state is synced at least to the moment
+ // when request started being processed.
+ // - `resourceVersionMatch` set to any other value or unset
+ // Invalid error is returned.
+ //
+ // Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward
+ // compatibility reasons) and to false otherwise.
+ // +optional
+ optional bool sendInitialEvents = 11;
}
// ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource
@@ -645,7 +698,7 @@ message ObjectMeta {
// automatically. Name is primarily intended for creation idempotence and configuration
// definition.
// Cannot be updated.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#names
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
// +optional
optional string name = 1;
@@ -671,7 +724,7 @@ message ObjectMeta {
//
// Must be a DNS_LABEL.
// Cannot be updated.
- // More info: http://kubernetes.io/docs/user-guide/namespaces
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces
// +optional
optional string namespace = 3;
@@ -685,7 +738,7 @@ message ObjectMeta {
//
// Populated by the system.
// Read-only.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
// +optional
optional string uid = 5;
@@ -749,14 +802,14 @@ message ObjectMeta {
// Map of string keys and values that can be used to organize and categorize
// (scope and select) objects. May match selectors of replication controllers
// and services.
- // More info: http://kubernetes.io/docs/user-guide/labels
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
// +optional
map labels = 11;
// Annotations is an unstructured key value map stored with a resource that may be
// set by external tools to store and retrieve arbitrary metadata. They are not
// queryable and should be preserved when modifying objects.
- // More info: http://kubernetes.io/docs/user-guide/annotations
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
// +optional
map annotations = 12;
@@ -767,6 +820,8 @@ message ObjectMeta {
// +optional
// +patchMergeKey=uid
// +patchStrategy=merge
+ // +listType=map
+ // +listMapKey=uid
repeated OwnerReference ownerReferences = 13;
// Must be empty before the object is deleted from the registry. Each entry
@@ -784,6 +839,7 @@ message ObjectMeta {
// are not vulnerable to ordering changes in the list.
// +optional
// +patchStrategy=merge
+ // +listType=set
repeated string finalizers = 14;
// ManagedFields maps workflow-id and version to the set of fields
@@ -795,6 +851,7 @@ message ObjectMeta {
// workflow used when modifying the object.
//
// +optional
+ // +listType=atomic
repeated ManagedFieldsEntry managedFields = 17;
}
@@ -811,11 +868,11 @@ message OwnerReference {
optional string kind = 1;
// Name of the referent.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#names
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
optional string name = 3;
// UID of the referent.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
optional string uid = 4;
// If true, this reference points to the managing controller.
@@ -869,6 +926,7 @@ message PatchOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 1;
// Force is going to "force" Apply requests. It means user will
@@ -889,19 +947,16 @@ message PatchOptions {
// fieldValidation instructs the server on how to handle
// objects in the request (POST/PUT/PATCH) containing unknown
- // or duplicate fields, provided that the `ServerSideFieldValidation`
- // feature gate is also enabled. Valid values are:
+ // or duplicate fields. Valid values are:
// - Ignore: This will ignore any unknown fields that are silently
// dropped from the object, and will ignore all but the last duplicate
// field that the decoder encounters. This is the default behavior
- // prior to v1.23 and is the default behavior when the
- // `ServerSideFieldValidation` feature gate is disabled.
+ // prior to v1.23.
// - Warn: This will send a warning via the standard warning response
// header for each unknown field that is dropped from the object, and
// for each duplicate field that is encountered. The request will
// still succeed if there are no other errors, and will only persist
- // the last of any duplicate fields. This is the default when the
- // `ServerSideFieldValidation` feature gate is enabled.
+ // the last of any duplicate fields. This is the default in v1.23+
// - Strict: This will fail the request with a BadRequest error if
// any unknown fields would be dropped from the object, or if any
// duplicate fields are present. The error returned from the server
@@ -925,6 +980,7 @@ message Preconditions {
// For example: "/healthz", "/apis".
message RootPaths {
// paths are the paths available at root.
+ // +listType=atomic
repeated string paths = 1;
}
@@ -967,6 +1023,7 @@ message Status {
// is not guaranteed to conform to any schema except that defined by
// the reason type.
// +optional
+ // +listType=atomic
optional StatusDetails details = 5;
// Suggested HTTP return code for this status, 0 if not set.
@@ -1024,13 +1081,14 @@ message StatusDetails {
// UID of the resource.
// (when there is a single resource which can be described).
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
// +optional
optional string uid = 6;
// The Causes array includes more details associated with the StatusReason
// failure. Not all StatusReasons may provide detailed causes.
// +optional
+ // +listType=atomic
repeated StatusCause causes = 4;
// If specified, the time in seconds before the operation should be retried. Some errors may indicate
@@ -1117,6 +1175,7 @@ message UpdateOptions {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
repeated string dryRun = 1;
// fieldManager is a name associated with the actor or entity
@@ -1128,19 +1187,16 @@ message UpdateOptions {
// fieldValidation instructs the server on how to handle
// objects in the request (POST/PUT/PATCH) containing unknown
- // or duplicate fields, provided that the `ServerSideFieldValidation`
- // feature gate is also enabled. Valid values are:
+ // or duplicate fields. Valid values are:
// - Ignore: This will ignore any unknown fields that are silently
// dropped from the object, and will ignore all but the last duplicate
// field that the decoder encounters. This is the default behavior
- // prior to v1.23 and is the default behavior when the
- // `ServerSideFieldValidation` feature gate is disabled.
+ // prior to v1.23.
// - Warn: This will send a warning via the standard warning response
// header for each unknown field that is dropped from the object, and
// for each duplicate field that is encountered. The request will
// still succeed if there are no other errors, and will only persist
- // the last of any duplicate fields. This is the default when the
- // `ServerSideFieldValidation` feature gate is enabled.
+ // the last of any duplicate fields. This is the default in v1.23+
// - Strict: This will fail the request with a BadRequest error if
// any unknown fields would be dropped from the object, or if any
// duplicate fields are present. The error returned from the server
@@ -1172,6 +1228,6 @@ message WatchEvent {
// * If Type is Deleted: the state of the object immediately before deletion.
// * If Type is Error: *Status is recommended; other types may make sense
// depending on context.
- optional k8s.io.apimachinery.pkg.runtime.RawExtension object = 2;
+ optional .k8s.io.apimachinery.pkg.runtime.RawExtension object = 2;
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
index 592dcb8a7..c748071ed 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go
@@ -24,8 +24,10 @@ import (
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types"
+ utiljson "k8s.io/apimachinery/pkg/util/json"
)
// LabelSelectorAsSelector converts the LabelSelector api type into a struct that implements
@@ -280,13 +282,20 @@ func (f FieldsV1) MarshalJSON() ([]byte, error) {
if f.Raw == nil {
return []byte("null"), nil
}
+ if f.getContentType() == fieldsV1InvalidOrValidCBORObject {
+ var u map[string]interface{}
+ if err := cbor.Unmarshal(f.Raw, &u); err != nil {
+ return nil, fmt.Errorf("metav1.FieldsV1 cbor invalid: %w", err)
+ }
+ return utiljson.Marshal(u)
+ }
return f.Raw, nil
}
// UnmarshalJSON implements json.Unmarshaler
func (f *FieldsV1) UnmarshalJSON(b []byte) error {
if f == nil {
- return errors.New("metav1.Fields: UnmarshalJSON on nil pointer")
+ return errors.New("metav1.FieldsV1: UnmarshalJSON on nil pointer")
}
if !bytes.Equal(b, []byte("null")) {
f.Raw = append(f.Raw[0:0], b...)
@@ -296,3 +305,75 @@ func (f *FieldsV1) UnmarshalJSON(b []byte) error {
var _ json.Marshaler = FieldsV1{}
var _ json.Unmarshaler = &FieldsV1{}
+
+func (f FieldsV1) MarshalCBOR() ([]byte, error) {
+ if f.Raw == nil {
+ return cbor.Marshal(nil)
+ }
+ if f.getContentType() == fieldsV1InvalidOrValidJSONObject {
+ var u map[string]interface{}
+ if err := utiljson.Unmarshal(f.Raw, &u); err != nil {
+ return nil, fmt.Errorf("metav1.FieldsV1 json invalid: %w", err)
+ }
+ return cbor.Marshal(u)
+ }
+ return f.Raw, nil
+}
+
+var cborNull = []byte{0xf6}
+
+func (f *FieldsV1) UnmarshalCBOR(b []byte) error {
+ if f == nil {
+ return errors.New("metav1.FieldsV1: UnmarshalCBOR on nil pointer")
+ }
+ if !bytes.Equal(b, cborNull) {
+ f.Raw = append(f.Raw[0:0], b...)
+ }
+ return nil
+}
+
+const (
+ // fieldsV1InvalidOrEmpty indicates that a FieldsV1 either contains no raw bytes or its raw
+ // bytes don't represent an allowable value in any supported encoding.
+ fieldsV1InvalidOrEmpty = iota
+
+ // fieldsV1InvalidOrValidJSONObject indicates that a FieldV1 either contains raw bytes that
+ // are a valid JSON encoding of an allowable value or don't represent an allowable value in
+ // any supported encoding.
+ fieldsV1InvalidOrValidJSONObject
+
+ // fieldsV1InvalidOrValidCBORObject indicates that a FieldV1 either contains raw bytes that
+ // are a valid CBOR encoding of an allowable value or don't represent an allowable value in
+ // any supported encoding.
+ fieldsV1InvalidOrValidCBORObject
+)
+
+// getContentType returns one of fieldsV1InvalidOrEmpty, fieldsV1InvalidOrValidJSONObject,
+// fieldsV1InvalidOrValidCBORObject based on the value of Raw.
+//
+// Raw can be encoded in JSON or CBOR and is only valid if it is empty, null, or an object (map)
+// value. It is invalid if it contains a JSON string, number, boolean, or array. If Raw is nonempty
+// and represents an allowable value, then the initial byte unambiguously distinguishes a
+// JSON-encoded value from a CBOR-encoded value.
+//
+// A valid JSON-encoded value can begin with any of the four JSON whitespace characters, the first
+// character 'n' of null, or '{' (0x09, 0x0a, 0x0d, 0x20, 0x6e, or 0x7b, respectively). A valid
+// CBOR-encoded value can begin with the null simple value, an initial byte with major type "map",
+// or, if a tag-enclosed map, an initial byte with major type "tag" (0xf6, 0xa0...0xbf, or
+// 0xc6...0xdb). The two sets of valid initial bytes don't intersect.
+func (f FieldsV1) getContentType() int {
+ if len(f.Raw) > 0 {
+ p := f.Raw[0]
+ switch p {
+ case 'n', '{', '\t', '\r', '\n', ' ':
+ return fieldsV1InvalidOrValidJSONObject
+ case 0xf6: // null
+ return fieldsV1InvalidOrValidCBORObject
+ default:
+ if p >= 0xa0 && p <= 0xbf /* map */ || p >= 0xc6 && p <= 0xdb /* tag */ {
+ return fieldsV1InvalidOrValidCBORObject
+ }
+ }
+ }
+ return fieldsV1InvalidOrEmpty
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
index 8eb37f436..9f302b3f3 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
@@ -19,6 +19,8 @@ package v1
import (
"encoding/json"
"time"
+
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
)
const RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00"
@@ -129,6 +131,25 @@ func (t *MicroTime) UnmarshalJSON(b []byte) error {
return nil
}
+func (t *MicroTime) UnmarshalCBOR(b []byte) error {
+ var s *string
+ if err := cbor.Unmarshal(b, &s); err != nil {
+ return err
+ }
+ if s == nil {
+ t.Time = time.Time{}
+ return nil
+ }
+
+ parsed, err := time.Parse(RFC3339Micro, *s)
+ if err != nil {
+ return err
+ }
+
+ t.Time = parsed.Local()
+ return nil
+}
+
// UnmarshalQueryParameter converts from a URL query parameter value to an object
func (t *MicroTime) UnmarshalQueryParameter(str string) error {
if len(str) == 0 {
@@ -160,6 +181,13 @@ func (t MicroTime) MarshalJSON() ([]byte, error) {
return json.Marshal(t.UTC().Format(RFC3339Micro))
}
+func (t MicroTime) MarshalCBOR() ([]byte, error) {
+ if t.IsZero() {
+ return cbor.Marshal(nil)
+ }
+ return cbor.Marshal(t.UTC().Format(RFC3339Micro))
+}
+
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
index 421770d43..0333cfdb3 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go
@@ -19,6 +19,8 @@ package v1
import (
"encoding/json"
"time"
+
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
)
// Time is a wrapper around time.Time which supports correct
@@ -116,6 +118,25 @@ func (t *Time) UnmarshalJSON(b []byte) error {
return nil
}
+func (t *Time) UnmarshalCBOR(b []byte) error {
+ var s *string
+ if err := cbor.Unmarshal(b, &s); err != nil {
+ return err
+ }
+ if s == nil {
+ t.Time = time.Time{}
+ return nil
+ }
+
+ parsed, err := time.Parse(time.RFC3339, *s)
+ if err != nil {
+ return err
+ }
+
+ t.Time = parsed.Local()
+ return nil
+}
+
// UnmarshalQueryParameter converts from a URL query parameter value to an object
func (t *Time) UnmarshalQueryParameter(str string) error {
if len(str) == 0 {
@@ -151,6 +172,14 @@ func (t Time) MarshalJSON() ([]byte, error) {
return buf, nil
}
+func (t Time) MarshalCBOR() ([]byte, error) {
+ if t.IsZero() {
+ return cbor.Marshal(nil)
+ }
+
+ return cbor.Marshal(t.UTC().Format(time.RFC3339))
+}
+
// ToUnstructured implements the value.UnstructuredConverter interface.
func (t Time) ToUnstructured() interface{} {
if t.IsZero() {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
index 152f99296..473adb9ef 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go
@@ -114,7 +114,7 @@ type ObjectMeta struct {
// automatically. Name is primarily intended for creation idempotence and configuration
// definition.
// Cannot be updated.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#names
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
// +optional
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
@@ -140,7 +140,7 @@ type ObjectMeta struct {
//
// Must be a DNS_LABEL.
// Cannot be updated.
- // More info: http://kubernetes.io/docs/user-guide/namespaces
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces
// +optional
Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
@@ -154,7 +154,7 @@ type ObjectMeta struct {
//
// Populated by the system.
// Read-only.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
// +optional
UID types.UID `json:"uid,omitempty" protobuf:"bytes,5,opt,name=uid,casttype=k8s.io/kubernetes/pkg/types.UID"`
@@ -218,14 +218,14 @@ type ObjectMeta struct {
// Map of string keys and values that can be used to organize and categorize
// (scope and select) objects. May match selectors of replication controllers
// and services.
- // More info: http://kubernetes.io/docs/user-guide/labels
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
// +optional
Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,11,rep,name=labels"`
// Annotations is an unstructured key value map stored with a resource that may be
// set by external tools to store and retrieve arbitrary metadata. They are not
// queryable and should be preserved when modifying objects.
- // More info: http://kubernetes.io/docs/user-guide/annotations
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
// +optional
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,12,rep,name=annotations"`
@@ -236,6 +236,8 @@ type ObjectMeta struct {
// +optional
// +patchMergeKey=uid
// +patchStrategy=merge
+ // +listType=map
+ // +listMapKey=uid
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty" patchStrategy:"merge" patchMergeKey:"uid" protobuf:"bytes,13,rep,name=ownerReferences"`
// Must be empty before the object is deleted from the registry. Each entry
@@ -253,6 +255,7 @@ type ObjectMeta struct {
// are not vulnerable to ordering changes in the list.
// +optional
// +patchStrategy=merge
+ // +listType=set
Finalizers []string `json:"finalizers,omitempty" patchStrategy:"merge" protobuf:"bytes,14,rep,name=finalizers"`
// Tombstone: ClusterName was a legacy field that was always cleared by
@@ -268,6 +271,7 @@ type ObjectMeta struct {
// workflow used when modifying the object.
//
// +optional
+ // +listType=atomic
ManagedFields []ManagedFieldsEntry `json:"managedFields,omitempty" protobuf:"bytes,17,rep,name=managedFields"`
}
@@ -295,10 +299,10 @@ type OwnerReference struct {
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"`
// Name of the referent.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#names
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names
Name string `json:"name" protobuf:"bytes,3,opt,name=name"`
// UID of the referent.
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
UID types.UID `json:"uid" protobuf:"bytes,4,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
// If true, this reference points to the managing controller.
// +optional
@@ -400,8 +404,43 @@ type ListOptions struct {
// This field is not supported when watch is true. Clients may start a watch from the last
// resourceVersion value returned by the server and not miss any modifications.
Continue string `json:"continue,omitempty" protobuf:"bytes,8,opt,name=continue"`
+
+ // `sendInitialEvents=true` may be set together with `watch=true`.
+ // In that case, the watch stream will begin with synthetic events to
+ // produce the current state of objects in the collection. Once all such
+ // events have been sent, a synthetic "Bookmark" event will be sent.
+ // The bookmark will report the ResourceVersion (RV) corresponding to the
+ // set of objects, and be marked with `"k8s.io/initial-events-end": "true"` annotation.
+ // Afterwards, the watch stream will proceed as usual, sending watch events
+ // corresponding to changes (subsequent to the RV) to objects watched.
+ //
+ // When `sendInitialEvents` option is set, we require `resourceVersionMatch`
+ // option to also be set. The semantic of the watch request is as following:
+ // - `resourceVersionMatch` = NotOlderThan
+ // is interpreted as "data at least as new as the provided `resourceVersion`"
+ // and the bookmark event is send when the state is synced
+ // to a `resourceVersion` at least as fresh as the one provided by the ListOptions.
+ // If `resourceVersion` is unset, this is interpreted as "consistent read" and the
+ // bookmark event is send when the state is synced at least to the moment
+ // when request started being processed.
+ // - `resourceVersionMatch` set to any other value or unset
+ // Invalid error is returned.
+ //
+ // Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward
+ // compatibility reasons) and to false otherwise.
+ // +optional
+ SendInitialEvents *bool `json:"sendInitialEvents,omitempty" protobuf:"varint,11,opt,name=sendInitialEvents"`
}
+const (
+ // InitialEventsAnnotationKey the name of the key
+ // under which an annotation marking the end of
+ // a watchlist stream is stored.
+ //
+ // The annotation is added to a "Bookmark" event.
+ InitialEventsAnnotationKey = "k8s.io/initial-events-end"
+)
+
// resourceVersionMatch specifies how the resourceVersion parameter is applied. resourceVersionMatch
// may only be set if resourceVersion is also set.
//
@@ -505,6 +544,7 @@ type DeleteOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,5,rep,name=dryRun"`
}
@@ -530,6 +570,7 @@ type CreateOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
// +k8s:deprecated=includeUninitialized,protobuf=2
@@ -542,19 +583,16 @@ type CreateOptions struct {
// fieldValidation instructs the server on how to handle
// objects in the request (POST/PUT/PATCH) containing unknown
- // or duplicate fields, provided that the `ServerSideFieldValidation`
- // feature gate is also enabled. Valid values are:
+ // or duplicate fields. Valid values are:
// - Ignore: This will ignore any unknown fields that are silently
// dropped from the object, and will ignore all but the last duplicate
// field that the decoder encounters. This is the default behavior
- // prior to v1.23 and is the default behavior when the
- // `ServerSideFieldValidation` feature gate is disabled.
+ // prior to v1.23.
// - Warn: This will send a warning via the standard warning response
// header for each unknown field that is dropped from the object, and
// for each duplicate field that is encountered. The request will
// still succeed if there are no other errors, and will only persist
- // the last of any duplicate fields. This is the default when the
- // `ServerSideFieldValidation` feature gate is enabled.
+ // the last of any duplicate fields. This is the default in v1.23+
// - Strict: This will fail the request with a BadRequest error if
// any unknown fields would be dropped from the object, or if any
// duplicate fields are present. The error returned from the server
@@ -577,6 +615,7 @@ type PatchOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
// Force is going to "force" Apply requests. It means user will
@@ -597,19 +636,16 @@ type PatchOptions struct {
// fieldValidation instructs the server on how to handle
// objects in the request (POST/PUT/PATCH) containing unknown
- // or duplicate fields, provided that the `ServerSideFieldValidation`
- // feature gate is also enabled. Valid values are:
+ // or duplicate fields. Valid values are:
// - Ignore: This will ignore any unknown fields that are silently
// dropped from the object, and will ignore all but the last duplicate
// field that the decoder encounters. This is the default behavior
- // prior to v1.23 and is the default behavior when the
- // `ServerSideFieldValidation` feature gate is disabled.
+ // prior to v1.23.
// - Warn: This will send a warning via the standard warning response
// header for each unknown field that is dropped from the object, and
// for each duplicate field that is encountered. The request will
// still succeed if there are no other errors, and will only persist
- // the last of any duplicate fields. This is the default when the
- // `ServerSideFieldValidation` feature gate is enabled.
+ // the last of any duplicate fields. This is the default in v1.23+
// - Strict: This will fail the request with a BadRequest error if
// any unknown fields would be dropped from the object, or if any
// duplicate fields are present. The error returned from the server
@@ -631,6 +667,7 @@ type ApplyOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
// Force is going to "force" Apply requests. It means user will
@@ -663,6 +700,7 @@ type UpdateOptions struct {
// request. Valid values are:
// - All: all dry run stages will be processed
// +optional
+ // +listType=atomic
DryRun []string `json:"dryRun,omitempty" protobuf:"bytes,1,rep,name=dryRun"`
// fieldManager is a name associated with the actor or entity
@@ -674,19 +712,16 @@ type UpdateOptions struct {
// fieldValidation instructs the server on how to handle
// objects in the request (POST/PUT/PATCH) containing unknown
- // or duplicate fields, provided that the `ServerSideFieldValidation`
- // feature gate is also enabled. Valid values are:
+ // or duplicate fields. Valid values are:
// - Ignore: This will ignore any unknown fields that are silently
// dropped from the object, and will ignore all but the last duplicate
// field that the decoder encounters. This is the default behavior
- // prior to v1.23 and is the default behavior when the
- // `ServerSideFieldValidation` feature gate is disabled.
+ // prior to v1.23.
// - Warn: This will send a warning via the standard warning response
// header for each unknown field that is dropped from the object, and
// for each duplicate field that is encountered. The request will
// still succeed if there are no other errors, and will only persist
- // the last of any duplicate fields. This is the default when the
- // `ServerSideFieldValidation` feature gate is enabled.
+ // the last of any duplicate fields. This is the default in v1.23+
// - Strict: This will fail the request with a BadRequest error if
// any unknown fields would be dropped from the object, or if any
// duplicate fields are present. The error returned from the server
@@ -734,6 +769,7 @@ type Status struct {
// is not guaranteed to conform to any schema except that defined by
// the reason type.
// +optional
+ // +listType=atomic
Details *StatusDetails `json:"details,omitempty" protobuf:"bytes,5,opt,name=details"`
// Suggested HTTP return code for this status, 0 if not set.
// +optional
@@ -761,12 +797,13 @@ type StatusDetails struct {
Kind string `json:"kind,omitempty" protobuf:"bytes,3,opt,name=kind"`
// UID of the resource.
// (when there is a single resource which can be described).
- // More info: http://kubernetes.io/docs/user-guide/identifiers#uids
+ // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
// +optional
UID types.UID `json:"uid,omitempty" protobuf:"bytes,6,opt,name=uid,casttype=k8s.io/apimachinery/pkg/types.UID"`
// The Causes array includes more details associated with the StatusReason
// failure. Not all StatusReasons may provide detailed causes.
// +optional
+ // +listType=atomic
Causes []StatusCause `json:"causes,omitempty" protobuf:"bytes,4,rep,name=causes"`
// If specified, the time in seconds before the operation should be retried. Some errors may indicate
// the client must take an alternate action - for those errors this field may indicate how long to wait
@@ -978,6 +1015,24 @@ const (
// CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules)
// values that can not be handled (e.g. an enumerated string).
CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported"
+ // CauseTypeForbidden is used to report valid (as per formatting rules)
+ // values which would be accepted under some conditions, but which are not
+ // permitted by the current conditions (such as security policy). See
+ // Forbidden().
+ CauseTypeForbidden CauseType = "FieldValueForbidden"
+ // CauseTypeTooLong is used to report that the given value is too long.
+ // This is similar to ErrorTypeInvalid, but the error will not include the
+ // too-long value. See TooLong().
+ CauseTypeTooLong CauseType = "FieldValueTooLong"
+ // CauseTypeTooMany is used to report "too many". This is used to
+ // report that a given list has too many items. This is similar to FieldValueTooLong,
+ // but the error indicates quantity instead of length.
+ CauseTypeTooMany CauseType = "FieldValueTooMany"
+ // CauseTypeInternal is used to report other errors that are not related
+ // to user input. See InternalError().
+ CauseTypeInternal CauseType = "InternalError"
+ // CauseTypeTypeInvalid is for the value did not match the schema type for that field
+ CauseTypeTypeInvalid CauseType = "FieldValueTypeInvalid"
// CauseTypeUnexpectedServerResponse is used to report when the server responded to the client
// without the expected return type. The presence of this cause indicates the error may be
// due to an intervening proxy or the server software malfunctioning.
@@ -1012,6 +1067,7 @@ type List struct {
type APIVersions struct {
TypeMeta `json:",inline"`
// versions are the api versions that are available.
+ // +listType=atomic
Versions []string `json:"versions" protobuf:"bytes,1,rep,name=versions"`
// a map of client CIDR to server address that is serving this group.
// This is to help clients reach servers in the most network-efficient way possible.
@@ -1020,6 +1076,7 @@ type APIVersions struct {
// The server returns only those CIDRs that it thinks that the client can match.
// For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
// Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
+ // +listType=atomic
ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs" protobuf:"bytes,2,rep,name=serverAddressByClientCIDRs"`
}
@@ -1030,6 +1087,7 @@ type APIVersions struct {
type APIGroupList struct {
TypeMeta `json:",inline"`
// groups is a list of APIGroup.
+ // +listType=atomic
Groups []APIGroup `json:"groups" protobuf:"bytes,1,rep,name=groups"`
}
@@ -1042,6 +1100,7 @@ type APIGroup struct {
// name is the name of the group.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// versions are the versions supported in this group.
+ // +listType=atomic
Versions []GroupVersionForDiscovery `json:"versions" protobuf:"bytes,2,rep,name=versions"`
// preferredVersion is the version preferred by the API server, which
// probably is the storage version.
@@ -1055,6 +1114,7 @@ type APIGroup struct {
// For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP.
// Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP.
// +optional
+ // +listType=atomic
ServerAddressByClientCIDRs []ServerAddressByClientCIDR `json:"serverAddressByClientCIDRs,omitempty" protobuf:"bytes,4,rep,name=serverAddressByClientCIDRs"`
}
@@ -1099,8 +1159,10 @@ type APIResource struct {
// update, patch, delete, deletecollection, and proxy)
Verbs Verbs `json:"verbs" protobuf:"bytes,4,opt,name=verbs"`
// shortNames is a list of suggested short names of the resource.
+ // +listType=atomic
ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,5,rep,name=shortNames"`
// categories is a list of the grouped resources this resource belongs to (e.g. 'all')
+ // +listType=atomic
Categories []string `json:"categories,omitempty" protobuf:"bytes,7,rep,name=categories"`
// The hash value of the storage version, the version this resource is
// converted to when written to the data store. Value must be treated
@@ -1133,6 +1195,7 @@ type APIResourceList struct {
// groupVersion is the group and version this APIResourceList is for.
GroupVersion string `json:"groupVersion" protobuf:"bytes,1,opt,name=groupVersion"`
// resources contains the name of the resources and if they are namespaced.
+ // +listType=atomic
APIResources []APIResource `json:"resources" protobuf:"bytes,2,rep,name=resources"`
}
@@ -1140,6 +1203,7 @@ type APIResourceList struct {
// For example: "/healthz", "/apis".
type RootPaths struct {
// paths are the paths available at root.
+ // +listType=atomic
Paths []string `json:"paths" protobuf:"bytes,1,rep,name=paths"`
}
@@ -1183,6 +1247,7 @@ type LabelSelector struct {
MatchLabels map[string]string `json:"matchLabels,omitempty" protobuf:"bytes,1,rep,name=matchLabels"`
// matchExpressions is a list of label selector requirements. The requirements are ANDed.
// +optional
+ // +listType=atomic
MatchExpressions []LabelSelectorRequirement `json:"matchExpressions,omitempty" protobuf:"bytes,2,rep,name=matchExpressions"`
}
@@ -1190,9 +1255,7 @@ type LabelSelector struct {
// relates the key and values.
type LabelSelectorRequirement struct {
// key is the label key that the selector applies to.
- // +patchMergeKey=key
- // +patchStrategy=merge
- Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,1,opt,name=key"`
+ Key string `json:"key" protobuf:"bytes,1,opt,name=key"`
// operator represents a key's relationship to a set of values.
// Valid operators are In, NotIn, Exists and DoesNotExist.
Operator LabelSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=LabelSelectorOperator"`
@@ -1201,6 +1264,7 @@ type LabelSelectorRequirement struct {
// the values array must be empty. This array is replaced during a strategic
// merge patch.
// +optional
+ // +listType=atomic
Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"`
}
@@ -1214,6 +1278,33 @@ const (
LabelSelectorOpDoesNotExist LabelSelectorOperator = "DoesNotExist"
)
+// FieldSelectorRequirement is a selector that contains values, a key, and an operator that
+// relates the key and values.
+type FieldSelectorRequirement struct {
+ // key is the field selector key that the requirement applies to.
+ Key string `json:"key" protobuf:"bytes,1,opt,name=key"`
+ // operator represents a key's relationship to a set of values.
+ // Valid operators are In, NotIn, Exists, DoesNotExist.
+ // The list of operators may grow in the future.
+ Operator FieldSelectorOperator `json:"operator" protobuf:"bytes,2,opt,name=operator,casttype=FieldSelectorOperator"`
+ // values is an array of string values.
+ // If the operator is In or NotIn, the values array must be non-empty.
+ // If the operator is Exists or DoesNotExist, the values array must be empty.
+ // +optional
+ // +listType=atomic
+ Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"`
+}
+
+// A field selector operator is the set of operators that can be used in a selector requirement.
+type FieldSelectorOperator string
+
+const (
+ FieldSelectorOpIn FieldSelectorOperator = "In"
+ FieldSelectorOpNotIn FieldSelectorOperator = "NotIn"
+ FieldSelectorOpExists FieldSelectorOperator = "Exists"
+ FieldSelectorOpDoesNotExist FieldSelectorOperator = "DoesNotExist"
+)
+
// ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource
// that the fieldset applies to.
type ManagedFieldsEntry struct {
@@ -1302,8 +1393,10 @@ type Table struct {
// columnDefinitions describes each column in the returned items array. The number of cells per row
// will always match the number of column definitions.
+ // +listType=atomic
ColumnDefinitions []TableColumnDefinition `json:"columnDefinitions"`
// rows is the list of items in the table.
+ // +listType=atomic
Rows []TableRow `json:"rows"`
}
@@ -1336,12 +1429,14 @@ type TableRow struct {
// cells will be as wide as the column definitions array and may contain strings, numbers (float64 or
// int64), booleans, simple maps, lists, or null. See the type field of the column definition for a
// more detailed description.
+ // +listType=atomic
Cells []interface{} `json:"cells"`
// conditions describe additional status of a row that are relevant for a human user. These conditions
// apply to the row, not to the object, and will be specific to table output. The only defined
// condition type is 'Completed', for a row that indicates a resource that has run to completion and
// can be given less visual priority.
// +optional
+ // +listType=atomic
Conditions []TableRowCondition `json:"conditions,omitempty"`
// This field contains the requested additional information about each object based on the includeObject
// policy when requesting the Table. If "None", this field is empty, if "Object" this will be the
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
index 9570726a0..1fa37215c 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go
@@ -24,7 +24,7 @@ package v1
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
-// Those methods can be generated by using hack/update-generated-swagger-docs.sh
+// Those methods can be generated by using hack/update-codegen.sh
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
var map_APIGroup = map[string]string{
@@ -115,7 +115,7 @@ var map_CreateOptions = map[string]string{
"": "CreateOptions may be provided when creating an API object.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
- "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
+ "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
}
func (CreateOptions) SwaggerDoc() map[string]string {
@@ -135,6 +135,17 @@ func (DeleteOptions) SwaggerDoc() map[string]string {
return map_DeleteOptions
}
+var map_FieldSelectorRequirement = map[string]string{
+ "": "FieldSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.",
+ "key": "key is the field selector key that the requirement applies to.",
+ "operator": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. The list of operators may grow in the future.",
+ "values": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty.",
+}
+
+func (FieldSelectorRequirement) SwaggerDoc() map[string]string {
+ return map_FieldSelectorRequirement
+}
+
var map_FieldsV1 = map[string]string{
"": "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff",
}
@@ -216,6 +227,7 @@ var map_ListOptions = map[string]string{
"timeoutSeconds": "Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.",
"limit": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.",
"continue": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.",
+ "sendInitialEvents": "`sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic \"Bookmark\" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `\"k8s.io/initial-events-end\": \"true\"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched.\n\nWhen `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan\n is interpreted as \"data at least as new as the provided `resourceVersion`\"\n and the bookmark event is send when the state is synced\n to a `resourceVersion` at least as fresh as the one provided by the ListOptions.\n If `resourceVersion` is unset, this is interpreted as \"consistent read\" and the\n bookmark event is send when the state is synced at least to the moment\n when request started being processed.\n- `resourceVersionMatch` set to any other value or unset\n Invalid error is returned.\n\nDefaults to true if `resourceVersion=\"\"` or `resourceVersion=\"0\"` (for backward compatibility reasons) and to false otherwise.",
}
func (ListOptions) SwaggerDoc() map[string]string {
@@ -239,18 +251,18 @@ func (ManagedFieldsEntry) SwaggerDoc() map[string]string {
var map_ObjectMeta = map[string]string{
"": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.",
- "name": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
+ "name": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names",
"generateName": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will return a 409.\n\nApplied only if Name is not specified. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#idempotency",
- "namespace": "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces",
+ "namespace": "Namespace defines the space within which each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces",
"selfLink": "Deprecated: selfLink is a legacy read-only field that is no longer populated by the system.",
- "uid": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
+ "uid": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids",
"resourceVersion": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
"generation": "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.",
"creationTimestamp": "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"deletionTimestamp": "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource is expected to be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field, once the finalizers list is empty. As long as the finalizers list contains items, deletion is blocked. Once the deletionTimestamp is set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. After that 30 seconds, the Kubelet will send a hard termination signal (SIGKILL) to the container and after cleanup, remove the pod from the API. In the presence of network partitions, this object may still exist after this timestamp, until an administrator or automated process can determine the resource is fully terminated. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"deletionGracePeriodSeconds": "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only.",
- "labels": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels",
- "annotations": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations",
+ "labels": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels",
+ "annotations": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations",
"ownerReferences": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller.",
"finalizers": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed. Finalizers may be processed and removed in any order. Order is NOT enforced because it introduces significant risk of stuck finalizers. finalizers is a shared field, any actor with permission can reorder it. If the finalizer list is processed in order, then this can lead to a situation in which the component responsible for the first finalizer in the list is waiting for a signal (field value, external system, or other) produced by a component responsible for a finalizer later in the list, resulting in a deadlock. Without enforced ordering finalizers are free to order amongst themselves and are not vulnerable to ordering changes in the list.",
"managedFields": "ManagedFields maps workflow-id and version to the set of fields that are managed by that workflow. This is mostly for internal housekeeping, and users typically shouldn't need to set or understand this field. A workflow can be the user's name, a controller's name, or the name of a specific apply path like \"ci-cd\". The set of fields is always in the version that the workflow used when modifying the object.",
@@ -264,8 +276,8 @@ var map_OwnerReference = map[string]string{
"": "OwnerReference contains enough information to let you identify an owning object. An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.",
"apiVersion": "API version of the referent.",
"kind": "Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- "name": "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
- "uid": "UID of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
+ "name": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#names",
+ "uid": "UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids",
"controller": "If true, this reference points to the managing controller.",
"blockOwnerDeletion": "If true, AND if the owner has the \"foregroundDeletion\" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed. See https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion for how the garbage collector interacts with this field and enforces the foreground deletion. Defaults to false. To set this field, a user needs \"delete\" permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.",
}
@@ -306,7 +318,7 @@ var map_PatchOptions = map[string]string{
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"force": "Force is going to \"force\" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).",
- "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
+ "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
}
func (PatchOptions) SwaggerDoc() map[string]string {
@@ -372,7 +384,7 @@ var map_StatusDetails = map[string]string{
"name": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).",
"group": "The group attribute of the resource associated with the status StatusReason.",
"kind": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- "uid": "UID of the resource. (when there is a single resource which can be described). More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
+ "uid": "UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids",
"causes": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.",
"retryAfterSeconds": "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.",
}
@@ -451,7 +463,7 @@ var map_UpdateOptions = map[string]string{
"": "UpdateOptions may be provided when updating an API object. All fields in UpdateOptions should also be present in PatchOptions.",
"dryRun": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed",
"fieldManager": "fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.",
- "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields, provided that the `ServerSideFieldValidation` feature gate is also enabled. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23 and is the default behavior when the `ServerSideFieldValidation` feature gate is disabled. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default when the `ServerSideFieldValidation` feature gate is enabled. - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
+ "fieldValidation": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.",
}
func (UpdateOptions) SwaggerDoc() map[string]string {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
index 2e33283ef..0f58d66c0 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go
@@ -173,7 +173,7 @@ func NestedStringMap(obj map[string]interface{}, fields ...string) (map[string]s
if str, ok := v.(string); ok {
strMap[k] = str
} else {
- return nil, false, fmt.Errorf("%v accessor error: contains non-string key in the map: %v is of the type %T, expected string", jsonPath(fields), v, v)
+ return nil, false, fmt.Errorf("%v accessor error: contains non-string value in the map under key %q: %v is of the type %T, expected string", jsonPath(fields), k, v, v)
}
}
return strMap, true, nil
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
index a499eee8e..40d289f37 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go
@@ -101,6 +101,11 @@ func (obj *Unstructured) EachListItem(fn func(runtime.Object) error) error {
return nil
}
+func (obj *Unstructured) EachListItemWithAlloc(fn func(runtime.Object) error) error {
+ // EachListItem has allocated a new Object for the user, we can use it directly.
+ return obj.EachListItem(fn)
+}
+
func (obj *Unstructured) UnstructuredContent() map[string]interface{} {
if obj.Object == nil {
return make(map[string]interface{})
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
index 5028f5fb5..82beda2a2 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go
@@ -52,6 +52,15 @@ func (u *UnstructuredList) EachListItem(fn func(runtime.Object) error) error {
return nil
}
+func (u *UnstructuredList) EachListItemWithAlloc(fn func(runtime.Object) error) error {
+ for i := range u.Items {
+ if err := fn(&Unstructured{Object: u.Items[i].Object}); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
// NewEmptyInstance returns a new instance of the concrete type containing only kind/apiVersion and no other data.
// This should be called instead of reflect.New() for unstructured types because the go type alone does not preserve kind/apiVersion info.
func (u *UnstructuredList) NewEmptyInstance() runtime.Unstructured {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
index a0f709ad8..3eba5ba54 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
@@ -32,6 +32,10 @@ import (
type LabelSelectorValidationOptions struct {
// Allow invalid label value in selector
AllowInvalidLabelValueInSelector bool
+
+ // Allows an operator that is not interpretable to pass validation. This is useful for cases where a broader check
+ // can be performed, as in a *SubjectAccessReview
+ AllowUnknownOperatorInRequirement bool
}
// LabelSelectorHasInvalidLabelValue returns true if the given selector contains an invalid label value in a match expression.
@@ -79,7 +83,9 @@ func ValidateLabelSelectorRequirement(sr metav1.LabelSelectorRequirement, opts L
allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'"))
}
default:
- allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), sr.Operator, "not a valid selector operator"))
+ if !opts.AllowUnknownOperatorInRequirement {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), sr.Operator, "not a valid selector operator"))
+ }
}
allErrs = append(allErrs, ValidateLabelName(sr.Key, fldPath.Child("key"))...)
if !opts.AllowInvalidLabelValueInSelector {
@@ -113,6 +119,39 @@ func ValidateLabels(labels map[string]string, fldPath *field.Path) field.ErrorLi
return allErrs
}
+// FieldSelectorValidationOptions is a struct that can be passed to ValidateFieldSelectorRequirement to record the validate options
+type FieldSelectorValidationOptions struct {
+ // Allows an operator that is not interpretable to pass validation. This is useful for cases where a broader check
+ // can be performed, as in a *SubjectAccessReview
+ AllowUnknownOperatorInRequirement bool
+}
+
+// ValidateLabelSelectorRequirement validates the requirement according to the opts and returns any validation errors.
+func ValidateFieldSelectorRequirement(requirement metav1.FieldSelectorRequirement, opts FieldSelectorValidationOptions, fldPath *field.Path) field.ErrorList {
+ allErrs := field.ErrorList{}
+
+ if len(requirement.Key) == 0 {
+ allErrs = append(allErrs, field.Required(fldPath.Child("key"), "must be specified"))
+ }
+
+ switch requirement.Operator {
+ case metav1.FieldSelectorOpIn, metav1.FieldSelectorOpNotIn:
+ if len(requirement.Values) == 0 {
+ allErrs = append(allErrs, field.Required(fldPath.Child("values"), "must be specified when `operator` is 'In' or 'NotIn'"))
+ }
+ case metav1.FieldSelectorOpExists, metav1.FieldSelectorOpDoesNotExist:
+ if len(requirement.Values) > 0 {
+ allErrs = append(allErrs, field.Forbidden(fldPath.Child("values"), "may not be specified when `operator` is 'Exists' or 'DoesNotExist'"))
+ }
+ default:
+ if !opts.AllowUnknownOperatorInRequirement {
+ allErrs = append(allErrs, field.Invalid(fldPath.Child("operator"), requirement.Operator, "not a valid selector operator"))
+ }
+ }
+
+ return allErrs
+}
+
func ValidateDeleteOptions(options *metav1.DeleteOptions) field.ErrorList {
allErrs := field.ErrorList{}
//lint:file-ignore SA1019 Keep validation for deprecated OrphanDependents option until it's being removed
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go
index b7590f0b3..afe01ed5a 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go
@@ -426,6 +426,13 @@ func autoConvert_url_Values_To_v1_ListOptions(in *url.Values, out *ListOptions,
} else {
out.Continue = ""
}
+ if values, ok := map[string][]string(*in)["sendInitialEvents"]; ok && len(values) > 0 {
+ if err := runtime.Convert_Slice_string_To_Pointer_bool(&values, &out.SendInitialEvents, s); err != nil {
+ return err
+ }
+ } else {
+ out.SendInitialEvents = nil
+ }
return nil
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
index 418e6099f..90cc54a7e 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go
@@ -327,6 +327,27 @@ func (in *Duration) DeepCopy() *Duration {
return out
}
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *FieldSelectorRequirement) DeepCopyInto(out *FieldSelectorRequirement) {
+ *out = *in
+ if in.Values != nil {
+ in, out := &in.Values, &out.Values
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FieldSelectorRequirement.
+func (in *FieldSelectorRequirement) DeepCopy() *FieldSelectorRequirement {
+ if in == nil {
+ return nil
+ }
+ out := new(FieldSelectorRequirement)
+ in.DeepCopyInto(out)
+ return out
+}
+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FieldsV1) DeepCopyInto(out *FieldsV1) {
*out = *in
@@ -602,6 +623,11 @@ func (in *ListOptions) DeepCopyInto(out *ListOptions) {
*out = new(int64)
**out = **in
}
+ if in.SendInitialEvents != nil {
+ in, out := &in.SendInitialEvents, &out.SendInitialEvents
+ *out = new(bool)
+ **out = **in
+ }
return
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
index a2abc67c1..819d936fe 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
+// source: k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
package v1beta1
@@ -47,7 +47,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *PartialObjectMetadataList) Reset() { *m = PartialObjectMetadataList{} }
func (*PartialObjectMetadataList) ProtoMessage() {}
func (*PartialObjectMetadataList) Descriptor() ([]byte, []int) {
- return fileDescriptor_90ec10f86b91f9a8, []int{0}
+ return fileDescriptor_39237a8d8061b52f, []int{0}
}
func (m *PartialObjectMetadataList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -77,31 +77,30 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto", fileDescriptor_90ec10f86b91f9a8)
+ proto.RegisterFile("k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto", fileDescriptor_39237a8d8061b52f)
}
-var fileDescriptor_90ec10f86b91f9a8 = []byte{
- // 317 bytes of a gzipped FileDescriptorProto
+var fileDescriptor_39237a8d8061b52f = []byte{
+ // 303 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x4b, 0xf3, 0x30,
0x1c, 0xc6, 0x9b, 0xf7, 0x65, 0x30, 0x3a, 0x04, 0xd9, 0x69, 0xee, 0x90, 0x0d, 0x4f, 0xdb, 0xc1,
- 0x84, 0x0d, 0x11, 0xc1, 0xdb, 0x6e, 0x82, 0x32, 0xd9, 0x51, 0x3c, 0x98, 0x76, 0x7f, 0xbb, 0x58,
- 0xd3, 0x94, 0xe4, 0xdf, 0x81, 0x37, 0x3f, 0x82, 0x1f, 0x6b, 0xc7, 0x1d, 0x07, 0xc2, 0x70, 0xf5,
- 0x8b, 0x48, 0xda, 0x2a, 0x32, 0x14, 0x7a, 0xeb, 0xf3, 0x94, 0xdf, 0x2f, 0x4f, 0x20, 0xfe, 0x2c,
- 0x3e, 0xb7, 0x4c, 0x6a, 0x1e, 0x67, 0x01, 0x98, 0x04, 0x10, 0x2c, 0x5f, 0x42, 0x32, 0xd7, 0x86,
- 0x57, 0x3f, 0x44, 0x2a, 0x95, 0x08, 0x17, 0x32, 0x01, 0xf3, 0xcc, 0xd3, 0x38, 0x72, 0x85, 0xe5,
- 0x0a, 0x50, 0xf0, 0xe5, 0x28, 0x00, 0x14, 0x23, 0x1e, 0x41, 0x02, 0x46, 0x20, 0xcc, 0x59, 0x6a,
- 0x34, 0xea, 0xf6, 0xb0, 0x44, 0xd9, 0x4f, 0x94, 0xa5, 0x71, 0xe4, 0x0a, 0xcb, 0x1c, 0xca, 0x2a,
- 0xb4, 0x7b, 0x12, 0x49, 0x5c, 0x64, 0x01, 0x0b, 0xb5, 0xe2, 0x91, 0x8e, 0x34, 0x2f, 0x0c, 0x41,
- 0xf6, 0x50, 0xa4, 0x22, 0x14, 0x5f, 0xa5, 0xb9, 0x7b, 0x5a, 0x67, 0xd4, 0xfe, 0x9e, 0xee, 0xd9,
- 0x5f, 0x94, 0xc9, 0x12, 0x94, 0x0a, 0xb8, 0x0d, 0x17, 0xa0, 0xc4, 0x3e, 0x77, 0xfc, 0x46, 0xfc,
- 0xa3, 0x1b, 0x61, 0x50, 0x8a, 0xa7, 0x69, 0xf0, 0x08, 0x21, 0x5e, 0x03, 0x8a, 0xb9, 0x40, 0x71,
- 0x25, 0x2d, 0xb6, 0xef, 0xfc, 0xa6, 0xaa, 0x72, 0xe7, 0x5f, 0x9f, 0x0c, 0x5a, 0x63, 0xc6, 0xea,
- 0x5c, 0x9c, 0x39, 0xda, 0x99, 0x26, 0x87, 0xab, 0x6d, 0xcf, 0xcb, 0xb7, 0xbd, 0xe6, 0x57, 0x33,
- 0xfb, 0x36, 0xb6, 0xef, 0xfd, 0x86, 0x44, 0x50, 0xb6, 0x43, 0xfa, 0xff, 0x07, 0xad, 0xf1, 0x45,
- 0x3d, 0xf5, 0xaf, 0x6b, 0x27, 0x07, 0xd5, 0x39, 0x8d, 0x4b, 0x67, 0x9c, 0x95, 0xe2, 0xc9, 0x74,
- 0xb5, 0xa3, 0xde, 0x7a, 0x47, 0xbd, 0xcd, 0x8e, 0x7a, 0x2f, 0x39, 0x25, 0xab, 0x9c, 0x92, 0x75,
- 0x4e, 0xc9, 0x26, 0xa7, 0xe4, 0x3d, 0xa7, 0xe4, 0xf5, 0x83, 0x7a, 0xb7, 0xc3, 0xda, 0xcf, 0xe0,
- 0x33, 0x00, 0x00, 0xff, 0xff, 0x30, 0x97, 0x8b, 0x11, 0x4b, 0x02, 0x00, 0x00,
+ 0x84, 0x0d, 0x11, 0xc5, 0xdb, 0x6e, 0x82, 0x32, 0xd9, 0x51, 0x3c, 0x98, 0x76, 0x31, 0x8b, 0x35,
+ 0x4d, 0x69, 0xfe, 0x15, 0xbc, 0xf9, 0x11, 0xfc, 0x58, 0x3d, 0xee, 0x38, 0x10, 0x86, 0x8d, 0x5f,
+ 0x44, 0xd2, 0x56, 0x91, 0xa1, 0xd0, 0x5b, 0x9e, 0x07, 0x7e, 0xbf, 0x3c, 0x81, 0xf8, 0x67, 0xd1,
+ 0xa9, 0x21, 0x52, 0x53, 0x96, 0x48, 0xc5, 0xc2, 0x95, 0x8c, 0x79, 0xfa, 0x4c, 0x93, 0x48, 0xb8,
+ 0xc2, 0x50, 0xc5, 0x81, 0xd1, 0xa7, 0x49, 0xc0, 0x81, 0x4d, 0xa8, 0xe0, 0x31, 0x4f, 0x19, 0xf0,
+ 0x25, 0x49, 0x52, 0x0d, 0xba, 0x3b, 0xae, 0x50, 0xf2, 0x13, 0x25, 0x49, 0x24, 0x5c, 0x61, 0x88,
+ 0x43, 0x49, 0x8d, 0xf6, 0x8f, 0x84, 0x84, 0x55, 0x16, 0x90, 0x50, 0x2b, 0x2a, 0xb4, 0xd0, 0xb4,
+ 0x34, 0x04, 0xd9, 0x7d, 0x99, 0xca, 0x50, 0x9e, 0x2a, 0x73, 0xff, 0xb8, 0xc9, 0xa8, 0xdd, 0x3d,
+ 0xfd, 0x93, 0xbf, 0xa8, 0x34, 0x8b, 0x41, 0x2a, 0x4e, 0x4d, 0xb8, 0xe2, 0x8a, 0xed, 0x72, 0x87,
+ 0x6f, 0xc8, 0x3f, 0xb8, 0x66, 0x29, 0x48, 0xf6, 0x38, 0x0f, 0x1e, 0x78, 0x08, 0x57, 0x1c, 0xd8,
+ 0x92, 0x01, 0xbb, 0x94, 0x06, 0xba, 0xb7, 0x7e, 0x5b, 0xd5, 0xb9, 0xf7, 0x6f, 0x88, 0x46, 0x9d,
+ 0x29, 0x21, 0x4d, 0x1e, 0x4e, 0x1c, 0xed, 0x4c, 0xb3, 0xfd, 0x7c, 0x3b, 0xf0, 0xec, 0x76, 0xd0,
+ 0xfe, 0x6a, 0x16, 0xdf, 0xc6, 0xee, 0x9d, 0xdf, 0x92, 0xc0, 0x95, 0xe9, 0xa1, 0xe1, 0xff, 0x51,
+ 0x67, 0x7a, 0xde, 0x4c, 0xfd, 0xeb, 0xda, 0xd9, 0x5e, 0x7d, 0x4f, 0xeb, 0xc2, 0x19, 0x17, 0x95,
+ 0x78, 0x36, 0xcf, 0x0b, 0xec, 0xad, 0x0b, 0xec, 0x6d, 0x0a, 0xec, 0xbd, 0x58, 0x8c, 0x72, 0x8b,
+ 0xd1, 0xda, 0x62, 0xb4, 0xb1, 0x18, 0xbd, 0x5b, 0x8c, 0x5e, 0x3f, 0xb0, 0x77, 0x33, 0x6e, 0xfc,
+ 0x0d, 0x3e, 0x03, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x0f, 0xd7, 0x36, 0x32, 0x02, 0x00, 0x00,
}
func (m *PartialObjectMetadataList) Marshal() (dAtA []byte, err error) {
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
index d14d42591..fcec55354 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto
@@ -33,9 +33,9 @@ message PartialObjectMetadataList {
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
// +optional
- optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 2;
+ optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 2;
// items contains each of the included items.
- repeated k8s.io.apimachinery.pkg.apis.meta.v1.PartialObjectMetadata items = 1;
+ repeated .k8s.io.apimachinery.pkg.apis.meta.v1.PartialObjectMetadata items = 1;
}
diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
index ef7e7c1e9..dff735dcf 100644
--- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
+++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go
@@ -24,7 +24,7 @@ package v1beta1
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
-// Those methods can be generated by using hack/update-generated-swagger-docs.sh
+// Those methods can be generated by using hack/update-codegen.sh
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
var map_PartialObjectMetadataList = map[string]string{
diff --git a/vendor/k8s.io/apimachinery/pkg/labels/labels.go b/vendor/k8s.io/apimachinery/pkg/labels/labels.go
index 8360d842b..19d823cef 100644
--- a/vendor/k8s.io/apimachinery/pkg/labels/labels.go
+++ b/vendor/k8s.io/apimachinery/pkg/labels/labels.go
@@ -77,6 +77,8 @@ func (ls Set) AsValidatedSelector() (Selector, error) {
// perform any validation.
// According to our measurements this is significantly faster
// in codepaths that matter at high scale.
+// Note: this method copies the Set; if the Set is immutable, consider wrapping it with ValidatedSetSelector
+// instead, which does not copy.
func (ls Set) AsSelectorPreValidated() Selector {
return SelectorFromValidatedSet(ls)
}
diff --git a/vendor/k8s.io/apimachinery/pkg/labels/selector.go b/vendor/k8s.io/apimachinery/pkg/labels/selector.go
index 891004389..9e22a0056 100644
--- a/vendor/k8s.io/apimachinery/pkg/labels/selector.go
+++ b/vendor/k8s.io/apimachinery/pkg/labels/selector.go
@@ -45,6 +45,19 @@ var (
// Requirements is AND of all requirements.
type Requirements []Requirement
+func (r Requirements) String() string {
+ var sb strings.Builder
+
+ for i, requirement := range r {
+ if i > 0 {
+ sb.WriteString(", ")
+ }
+ sb.WriteString(requirement.String())
+ }
+
+ return sb.String()
+}
+
// Selector represents a label selector.
type Selector interface {
// Matches returns true if this selector matches the given set of labels.
@@ -149,14 +162,12 @@ type Requirement struct {
// NewRequirement is the constructor for a Requirement.
// If any of these rules is violated, an error is returned:
-// (1) The operator can only be In, NotIn, Equals, DoubleEquals, Gt, Lt, NotEquals, Exists, or DoesNotExist.
-// (2) If the operator is In or NotIn, the values set must be non-empty.
-// (3) If the operator is Equals, DoubleEquals, or NotEquals, the values set must contain one value.
-// (4) If the operator is Exists or DoesNotExist, the value set must be empty.
-// (5) If the operator is Gt or Lt, the values set must contain only one value, which will be interpreted as an integer.
-// (6) The key is invalid due to its length, or sequence
-//
-// of characters. See validateLabelKey for more details.
+// 1. The operator can only be In, NotIn, Equals, DoubleEquals, Gt, Lt, NotEquals, Exists, or DoesNotExist.
+// 2. If the operator is In or NotIn, the values set must be non-empty.
+// 3. If the operator is Equals, DoubleEquals, or NotEquals, the values set must contain one value.
+// 4. If the operator is Exists or DoesNotExist, the value set must be empty.
+// 5. If the operator is Gt or Lt, the values set must contain only one value, which will be interpreted as an integer.
+// 6. The key is invalid due to its length, or sequence of characters. See validateLabelKey for more details.
//
// The empty string is a valid value in the input values set.
// Returned error, if not nil, is guaranteed to be an aggregated field.ErrorList
@@ -213,22 +224,15 @@ func (r *Requirement) hasValue(value string) bool {
// Matches returns true if the Requirement matches the input Labels.
// There is a match in the following cases:
-// (1) The operator is Exists and Labels has the Requirement's key.
-// (2) The operator is In, Labels has the Requirement's key and Labels'
-//
-// value for that key is in Requirement's value set.
-//
-// (3) The operator is NotIn, Labels has the Requirement's key and
-//
-// Labels' value for that key is not in Requirement's value set.
-//
-// (4) The operator is DoesNotExist or NotIn and Labels does not have the
-//
-// Requirement's key.
-//
-// (5) The operator is GreaterThanOperator or LessThanOperator, and Labels has
-//
-// the Requirement's key and the corresponding value satisfies mathematical inequality.
+// 1. The operator is Exists and Labels has the Requirement's key.
+// 2. The operator is In, Labels has the Requirement's key and Labels'
+// value for that key is in Requirement's value set.
+// 3. The operator is NotIn, Labels has the Requirement's key and
+// Labels' value for that key is not in Requirement's value set.
+// 4. The operator is DoesNotExist or NotIn and Labels does not have the
+// Requirement's key.
+// 5. The operator is GreaterThanOperator or LessThanOperator, and Labels has
+// the Requirement's key and the corresponding value satisfies mathematical inequality.
func (r *Requirement) Matches(ls Labels) bool {
switch r.operator {
case selection.In, selection.Equals, selection.DoubleEquals:
@@ -294,6 +298,13 @@ func (r *Requirement) Values() sets.String {
return ret
}
+// ValuesUnsorted returns a copy of requirement values as passed to NewRequirement without sorting.
+func (r *Requirement) ValuesUnsorted() []string {
+ ret := make([]string, 0, len(r.strValues))
+ ret = append(ret, r.strValues...)
+ return ret
+}
+
// Equal checks the equality of requirement.
func (r Requirement) Equal(x Requirement) bool {
if r.key != x.key {
@@ -872,15 +883,14 @@ func (p *Parser) parseExactValue() (sets.String, error) {
// "x in (foo,,baz),y,z notin ()"
//
// Note:
-//
-// (1) Inclusion - " in " - denotes that the KEY exists and is equal to any of the
-// VALUEs in its requirement
-// (2) Exclusion - " notin " - denotes that the KEY is not equal to any
-// of the VALUEs in its requirement or does not exist
-// (3) The empty string is a valid VALUE
-// (4) A requirement with just a KEY - as in "y" above - denotes that
-// the KEY exists and can be any VALUE.
-// (5) A requirement with just !KEY requires that the KEY not exist.
+// 1. Inclusion - " in " - denotes that the KEY exists and is equal to any of the
+// VALUEs in its requirement
+// 2. Exclusion - " notin " - denotes that the KEY is not equal to any
+// of the VALUEs in its requirement or does not exist
+// 3. The empty string is a valid VALUE
+// 4. A requirement with just a KEY - as in "y" above - denotes that
+// the KEY exists and can be any VALUE.
+// 5. A requirement with just !KEY requires that the KEY not exist.
func Parse(selector string, opts ...field.PathOption) (Selector, error) {
parsedSelector, err := parse(selector, field.ToPath(opts...))
if err == nil {
@@ -948,6 +958,8 @@ func ValidatedSelectorFromSet(ls Set) (Selector, error) {
// SelectorFromValidatedSet returns a Selector which will match exactly the given Set.
// A nil and empty Sets are considered equivalent to Everything().
// It assumes that Set is already validated and doesn't do any validation.
+// Note: this method copies the Set; if the Set is immutable, consider wrapping it with ValidatedSetSelector
+// instead, which does not copy.
func SelectorFromValidatedSet(ls Set) Selector {
if ls == nil || len(ls) == 0 {
return internalSelector{}
@@ -969,3 +981,76 @@ func SelectorFromValidatedSet(ls Set) Selector {
func ParseToRequirements(selector string, opts ...field.PathOption) ([]Requirement, error) {
return parse(selector, field.ToPath(opts...))
}
+
+// ValidatedSetSelector wraps a Set, allowing it to implement the Selector interface. Unlike
+// Set.AsSelectorPreValidated (which copies the input Set), this type simply wraps the underlying
+// Set. As a result, it is substantially more efficient. A nil and empty Sets are considered
+// equivalent to Everything().
+//
+// Callers MUST ensure the underlying Set is not mutated, and that it is already validated. If these
+// constraints are not met, Set.AsValidatedSelector should be preferred
+//
+// None of the Selector methods mutate the underlying Set, but Add() and Requirements() convert to
+// the less optimized version.
+type ValidatedSetSelector Set
+
+func (s ValidatedSetSelector) Matches(labels Labels) bool {
+ for k, v := range s {
+ if !labels.Has(k) || v != labels.Get(k) {
+ return false
+ }
+ }
+ return true
+}
+
+func (s ValidatedSetSelector) Empty() bool {
+ return len(s) == 0
+}
+
+func (s ValidatedSetSelector) String() string {
+ keys := make([]string, 0, len(s))
+ for k := range s {
+ keys = append(keys, k)
+ }
+ // Ensure deterministic output
+ sort.Strings(keys)
+ b := strings.Builder{}
+ for i, key := range keys {
+ v := s[key]
+ b.Grow(len(key) + 2 + len(v))
+ if i != 0 {
+ b.WriteString(",")
+ }
+ b.WriteString(key)
+ b.WriteString("=")
+ b.WriteString(v)
+ }
+ return b.String()
+}
+
+func (s ValidatedSetSelector) Add(r ...Requirement) Selector {
+ return s.toFullSelector().Add(r...)
+}
+
+func (s ValidatedSetSelector) Requirements() (requirements Requirements, selectable bool) {
+ return s.toFullSelector().Requirements()
+}
+
+func (s ValidatedSetSelector) DeepCopySelector() Selector {
+ res := make(ValidatedSetSelector, len(s))
+ for k, v := range s {
+ res[k] = v
+ }
+ return res
+}
+
+func (s ValidatedSetSelector) RequiresExactMatch(label string) (value string, found bool) {
+ v, f := s[label]
+ return v, f
+}
+
+func (s ValidatedSetSelector) toFullSelector() Selector {
+ return SelectorFromValidatedSet(Set(s))
+}
+
+var _ Selector = ValidatedSetSelector{}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/codec.go b/vendor/k8s.io/apimachinery/pkg/runtime/codec.go
index 7fc513dd0..73f85286c 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/codec.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/codec.go
@@ -45,7 +45,6 @@ func NewCodec(e Encoder, d Decoder) Codec {
// Encode is a convenience wrapper for encoding to a []byte from an Encoder
func Encode(e Encoder, obj Object) ([]byte, error) {
- // TODO: reuse buffer
buf := &bytes.Buffer{}
if err := e.Encode(obj, buf); err != nil {
return nil, err
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/converter.go b/vendor/k8s.io/apimachinery/pkg/runtime/converter.go
index 90bf487e3..62eb27afc 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/converter.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/converter.go
@@ -231,7 +231,7 @@ func (c *fromUnstructuredContext) pushKey(key string) {
}
-// FromUnstructuredWIthValidation converts an object from map[string]interface{} representation into a concrete type.
+// FromUnstructuredWithValidation converts an object from map[string]interface{} representation into a concrete type.
// It uses encoding/json/Unmarshaler if object implements it or reflection if not.
// It takes a validationDirective that indicates how to behave when it encounters unknown fields.
func (c *unstructuredConverter) FromUnstructuredWithValidation(u map[string]interface{}, obj interface{}, returnUnknownFields bool) error {
@@ -465,7 +465,7 @@ func sliceFromUnstructured(sv, dv reflect.Value, ctx *fromUnstructuredContext) e
}
dv.SetBytes(data)
} else {
- dv.Set(reflect.Zero(dt))
+ dv.Set(reflect.MakeSlice(dt, 0, 0))
}
return nil
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/extension.go b/vendor/k8s.io/apimachinery/pkg/runtime/extension.go
index 9056397fa..60c000bcb 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/extension.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/extension.go
@@ -18,16 +18,77 @@ package runtime
import (
"bytes"
- "encoding/json"
"errors"
+ "fmt"
+
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
+ "k8s.io/apimachinery/pkg/util/json"
)
+// RawExtension intentionally avoids implementing value.UnstructuredConverter for now because the
+// signature of ToUnstructured does not allow returning an error value in cases where the conversion
+// is not possible (content type is unrecognized or bytes don't match content type).
+func rawToUnstructured(raw []byte, contentType string) (interface{}, error) {
+ switch contentType {
+ case ContentTypeJSON:
+ var u interface{}
+ if err := json.Unmarshal(raw, &u); err != nil {
+ return nil, fmt.Errorf("failed to parse RawExtension bytes as JSON: %w", err)
+ }
+ return u, nil
+ case ContentTypeCBOR:
+ var u interface{}
+ if err := cbor.Unmarshal(raw, &u); err != nil {
+ return nil, fmt.Errorf("failed to parse RawExtension bytes as CBOR: %w", err)
+ }
+ return u, nil
+ default:
+ return nil, fmt.Errorf("cannot convert RawExtension with unrecognized content type to unstructured")
+ }
+}
+
+func (re RawExtension) guessContentType() string {
+ switch {
+ case bytes.HasPrefix(re.Raw, cborSelfDescribed):
+ return ContentTypeCBOR
+ case len(re.Raw) > 0:
+ switch re.Raw[0] {
+ case '\t', '\r', '\n', ' ', '{', '[', 'n', 't', 'f', '"', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
+ // Prefixes for the four whitespace characters, objects, arrays, strings, numbers, true, false, and null.
+ return ContentTypeJSON
+ }
+ }
+ return ""
+}
+
func (re *RawExtension) UnmarshalJSON(in []byte) error {
if re == nil {
return errors.New("runtime.RawExtension: UnmarshalJSON on nil pointer")
}
- if !bytes.Equal(in, []byte("null")) {
- re.Raw = append(re.Raw[0:0], in...)
+ if bytes.Equal(in, []byte("null")) {
+ return nil
+ }
+ re.Raw = append(re.Raw[0:0], in...)
+ return nil
+}
+
+var (
+ cborNull = []byte{0xf6}
+ cborSelfDescribed = []byte{0xd9, 0xd9, 0xf7}
+)
+
+func (re *RawExtension) UnmarshalCBOR(in []byte) error {
+ if re == nil {
+ return errors.New("runtime.RawExtension: UnmarshalCBOR on nil pointer")
+ }
+ if !bytes.Equal(in, cborNull) {
+ if !bytes.HasPrefix(in, cborSelfDescribed) {
+ // The self-described CBOR tag doesn't change the interpretation of the data
+ // item it encloses, but it is useful as a magic number. Its encoding is
+ // also what is used to implement the CBOR RecognizingDecoder.
+ re.Raw = append(re.Raw[:0], cborSelfDescribed...)
+ }
+ re.Raw = append(re.Raw, in...)
}
return nil
}
@@ -46,6 +107,35 @@ func (re RawExtension) MarshalJSON() ([]byte, error) {
}
return []byte("null"), nil
}
- // TODO: Check whether ContentType is actually JSON before returning it.
- return re.Raw, nil
+
+ contentType := re.guessContentType()
+ if contentType == ContentTypeJSON {
+ return re.Raw, nil
+ }
+
+ u, err := rawToUnstructured(re.Raw, contentType)
+ if err != nil {
+ return nil, err
+ }
+ return json.Marshal(u)
+}
+
+func (re RawExtension) MarshalCBOR() ([]byte, error) {
+ if re.Raw == nil {
+ if re.Object != nil {
+ return cbor.Marshal(re.Object)
+ }
+ return cbor.Marshal(nil)
+ }
+
+ contentType := re.guessContentType()
+ if contentType == ContentTypeCBOR {
+ return re.Raw, nil
+ }
+
+ u, err := rawToUnstructured(re.Raw, contentType)
+ if err != nil {
+ return nil, err
+ }
+ return cbor.Marshal(u)
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
index ec677a7d9..2e40e140a 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto
+// source: k8s.io/apimachinery/pkg/runtime/generated.proto
package runtime
@@ -45,7 +45,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *RawExtension) Reset() { *m = RawExtension{} }
func (*RawExtension) ProtoMessage() {}
func (*RawExtension) Descriptor() ([]byte, []int) {
- return fileDescriptor_9d3c45d7f546725c, []int{0}
+ return fileDescriptor_2e0e4b920403a48c, []int{0}
}
func (m *RawExtension) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -73,7 +73,7 @@ var xxx_messageInfo_RawExtension proto.InternalMessageInfo
func (m *TypeMeta) Reset() { *m = TypeMeta{} }
func (*TypeMeta) ProtoMessage() {}
func (*TypeMeta) Descriptor() ([]byte, []int) {
- return fileDescriptor_9d3c45d7f546725c, []int{1}
+ return fileDescriptor_2e0e4b920403a48c, []int{1}
}
func (m *TypeMeta) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -101,7 +101,7 @@ var xxx_messageInfo_TypeMeta proto.InternalMessageInfo
func (m *Unknown) Reset() { *m = Unknown{} }
func (*Unknown) ProtoMessage() {}
func (*Unknown) Descriptor() ([]byte, []int) {
- return fileDescriptor_9d3c45d7f546725c, []int{2}
+ return fileDescriptor_2e0e4b920403a48c, []int{2}
}
func (m *Unknown) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -133,35 +133,34 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/generated.proto", fileDescriptor_9d3c45d7f546725c)
-}
-
-var fileDescriptor_9d3c45d7f546725c = []byte{
- // 380 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xcf, 0xaa, 0x13, 0x31,
- 0x14, 0xc6, 0x27, 0xb7, 0x85, 0x7b, 0x4d, 0x0b, 0x57, 0xe2, 0xc2, 0xd1, 0x45, 0xe6, 0xd2, 0x95,
- 0x77, 0x61, 0x02, 0x17, 0x04, 0xb7, 0x9d, 0x52, 0x50, 0x44, 0x90, 0xe0, 0x1f, 0x70, 0x65, 0x3a,
- 0x13, 0xa7, 0x61, 0xe8, 0xc9, 0x90, 0x66, 0x1c, 0xbb, 0xf3, 0x11, 0x7c, 0xac, 0x2e, 0xbb, 0xec,
- 0xaa, 0xd8, 0xf1, 0x21, 0xdc, 0x4a, 0xd3, 0xb4, 0x56, 0x5d, 0x74, 0x97, 0x73, 0xbe, 0xef, 0xf7,
- 0x9d, 0x73, 0x20, 0xf8, 0x45, 0xf9, 0x7c, 0xce, 0xb4, 0xe1, 0x65, 0x3d, 0x51, 0x16, 0x94, 0x53,
- 0x73, 0xfe, 0x45, 0x41, 0x6e, 0x2c, 0x0f, 0x82, 0xac, 0xf4, 0x4c, 0x66, 0x53, 0x0d, 0xca, 0x2e,
- 0x78, 0x55, 0x16, 0xdc, 0xd6, 0xe0, 0xf4, 0x4c, 0xf1, 0x42, 0x81, 0xb2, 0xd2, 0xa9, 0x9c, 0x55,
- 0xd6, 0x38, 0x43, 0x92, 0x3d, 0xc0, 0x4e, 0x01, 0x56, 0x95, 0x05, 0x0b, 0xc0, 0xe3, 0xa7, 0x85,
- 0x76, 0xd3, 0x7a, 0xc2, 0x32, 0x33, 0xe3, 0x85, 0x29, 0x0c, 0xf7, 0xdc, 0xa4, 0xfe, 0xec, 0x2b,
- 0x5f, 0xf8, 0xd7, 0x3e, 0x6f, 0x70, 0x8b, 0xfb, 0x42, 0x36, 0xe3, 0xaf, 0x4e, 0xc1, 0x5c, 0x1b,
- 0x20, 0x8f, 0x70, 0xc7, 0xca, 0x26, 0x46, 0x37, 0xe8, 0x49, 0x3f, 0xbd, 0x6c, 0x37, 0x49, 0x47,
- 0xc8, 0x46, 0xec, 0x7a, 0x83, 0x4f, 0xf8, 0xea, 0xed, 0xa2, 0x52, 0xaf, 0x95, 0x93, 0xe4, 0x0e,
- 0x63, 0x59, 0xe9, 0xf7, 0xca, 0xee, 0x20, 0xef, 0xbe, 0x97, 0x92, 0xe5, 0x26, 0x89, 0xda, 0x4d,
- 0x82, 0x87, 0x6f, 0x5e, 0x06, 0x45, 0x9c, 0xb8, 0xc8, 0x0d, 0xee, 0x96, 0x1a, 0xf2, 0xf8, 0xc2,
- 0xbb, 0xfb, 0xc1, 0xdd, 0x7d, 0xa5, 0x21, 0x17, 0x5e, 0x19, 0xfc, 0x42, 0xf8, 0xf2, 0x1d, 0x94,
- 0x60, 0x1a, 0x20, 0x1f, 0xf0, 0x95, 0x0b, 0xd3, 0x7c, 0x7e, 0xef, 0xee, 0x96, 0x9d, 0xb9, 0x9d,
- 0x1d, 0xd6, 0x4b, 0xef, 0x87, 0xf0, 0xe3, 0xc2, 0xe2, 0x18, 0x76, 0xb8, 0xf0, 0xe2, 0xff, 0x0b,
- 0xc9, 0x10, 0x5f, 0x67, 0x06, 0x9c, 0x02, 0x37, 0x86, 0xcc, 0xe4, 0x1a, 0x8a, 0xb8, 0xe3, 0x97,
- 0x7d, 0x18, 0xf2, 0xae, 0x47, 0x7f, 0xcb, 0xe2, 0x5f, 0x3f, 0x79, 0x86, 0x7b, 0xa1, 0xb5, 0x1b,
- 0x1d, 0x77, 0x3d, 0xfe, 0x20, 0xe0, 0xbd, 0xd1, 0x1f, 0x49, 0x9c, 0xfa, 0xd2, 0xf1, 0x72, 0x4b,
- 0xa3, 0xd5, 0x96, 0x46, 0xeb, 0x2d, 0x8d, 0xbe, 0xb5, 0x14, 0x2d, 0x5b, 0x8a, 0x56, 0x2d, 0x45,
- 0xeb, 0x96, 0xa2, 0x1f, 0x2d, 0x45, 0xdf, 0x7f, 0xd2, 0xe8, 0x63, 0x72, 0xe6, 0xb7, 0xfc, 0x0e,
- 0x00, 0x00, 0xff, 0xff, 0x1f, 0x32, 0xd5, 0x68, 0x68, 0x02, 0x00, 0x00,
+ proto.RegisterFile("k8s.io/apimachinery/pkg/runtime/generated.proto", fileDescriptor_2e0e4b920403a48c)
+}
+
+var fileDescriptor_2e0e4b920403a48c = []byte{
+ // 365 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x4f, 0x6b, 0x22, 0x31,
+ 0x18, 0xc6, 0x27, 0x2a, 0xe8, 0x46, 0xc1, 0x25, 0x7b, 0xd8, 0xd9, 0x3d, 0x64, 0xc4, 0xd3, 0x7a,
+ 0xd8, 0x0c, 0x08, 0x85, 0x5e, 0x1d, 0xf1, 0x50, 0x4a, 0xa1, 0x84, 0xfe, 0x81, 0x9e, 0x1a, 0x67,
+ 0xd2, 0x31, 0x0c, 0x26, 0xc3, 0x18, 0x99, 0x7a, 0xeb, 0x47, 0xe8, 0xc7, 0xf2, 0xe8, 0xd1, 0x93,
+ 0xd4, 0xe9, 0x87, 0xe8, 0xb5, 0x18, 0xa3, 0xb5, 0xed, 0xc1, 0x5b, 0xde, 0xf7, 0x79, 0x7e, 0xcf,
+ 0xfb, 0xbe, 0x10, 0xe8, 0x27, 0xa7, 0x13, 0x22, 0x94, 0xcf, 0x52, 0x31, 0x66, 0xe1, 0x48, 0x48,
+ 0x9e, 0xcd, 0xfc, 0x34, 0x89, 0xfd, 0x6c, 0x2a, 0xb5, 0x18, 0x73, 0x3f, 0xe6, 0x92, 0x67, 0x4c,
+ 0xf3, 0x88, 0xa4, 0x99, 0xd2, 0x0a, 0x79, 0x5b, 0x80, 0x1c, 0x02, 0x24, 0x4d, 0x62, 0x62, 0x81,
+ 0xbf, 0xff, 0x63, 0xa1, 0x47, 0xd3, 0x21, 0x09, 0xd5, 0xd8, 0x8f, 0x55, 0xac, 0x7c, 0xc3, 0x0d,
+ 0xa7, 0x0f, 0xa6, 0x32, 0x85, 0x79, 0x6d, 0xf3, 0xda, 0x1d, 0xd8, 0xa0, 0x2c, 0x1f, 0x3c, 0x6a,
+ 0x2e, 0x27, 0x42, 0x49, 0xf4, 0x07, 0x96, 0x33, 0x96, 0xbb, 0xa0, 0x05, 0xfe, 0x35, 0x82, 0x6a,
+ 0xb1, 0xf2, 0xca, 0x94, 0xe5, 0x74, 0xd3, 0x6b, 0xdf, 0xc3, 0xda, 0xd5, 0x2c, 0xe5, 0x17, 0x5c,
+ 0x33, 0xd4, 0x85, 0x90, 0xa5, 0xe2, 0x86, 0x67, 0x1b, 0xc8, 0xb8, 0x7f, 0x04, 0x68, 0xbe, 0xf2,
+ 0x9c, 0x62, 0xe5, 0xc1, 0xde, 0xe5, 0x99, 0x55, 0xe8, 0x81, 0x0b, 0xb5, 0x60, 0x25, 0x11, 0x32,
+ 0x72, 0x4b, 0xc6, 0xdd, 0xb0, 0xee, 0xca, 0xb9, 0x90, 0x11, 0x35, 0x4a, 0xfb, 0x0d, 0xc0, 0xea,
+ 0xb5, 0x4c, 0xa4, 0xca, 0x25, 0xba, 0x85, 0x35, 0x6d, 0xa7, 0x99, 0xfc, 0x7a, 0xb7, 0x43, 0x8e,
+ 0xdc, 0x4e, 0x76, 0xeb, 0x05, 0x3f, 0x6d, 0xf8, 0x7e, 0x61, 0xba, 0x0f, 0xdb, 0x5d, 0x58, 0xfa,
+ 0x7e, 0x21, 0xea, 0xc1, 0x66, 0xa8, 0xa4, 0xe6, 0x52, 0x0f, 0x64, 0xa8, 0x22, 0x21, 0x63, 0xb7,
+ 0x6c, 0x96, 0xfd, 0x6d, 0xf3, 0x9a, 0xfd, 0xcf, 0x32, 0xfd, 0xea, 0x47, 0x27, 0xb0, 0x6e, 0x5b,
+ 0x9b, 0xd1, 0x6e, 0xc5, 0xe0, 0xbf, 0x2c, 0x5e, 0xef, 0x7f, 0x48, 0xf4, 0xd0, 0x17, 0x0c, 0xe6,
+ 0x6b, 0xec, 0x2c, 0xd6, 0xd8, 0x59, 0xae, 0xb1, 0xf3, 0x54, 0x60, 0x30, 0x2f, 0x30, 0x58, 0x14,
+ 0x18, 0x2c, 0x0b, 0x0c, 0x5e, 0x0a, 0x0c, 0x9e, 0x5f, 0xb1, 0x73, 0xe7, 0x1d, 0xf9, 0x2d, 0xef,
+ 0x01, 0x00, 0x00, 0xff, 0xff, 0x2a, 0x9b, 0x09, 0xb3, 0x4f, 0x02, 0x00, 0x00,
}
func (m *RawExtension) Marshal() (dAtA []byte, err error) {
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/helper.go b/vendor/k8s.io/apimachinery/pkg/runtime/helper.go
index 7bd1a3a6a..cc0a77bba 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/helper.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/helper.go
@@ -236,10 +236,14 @@ func (e WithVersionEncoder) Encode(obj Object, stream io.Writer) error {
gvk = preferredGVK
}
}
- kind.SetGroupVersionKind(gvk)
- err = e.Encoder.Encode(obj, stream)
- kind.SetGroupVersionKind(oldGVK)
- return err
+
+ // The gvk only needs to be set if not already as desired.
+ if gvk != oldGVK {
+ kind.SetGroupVersionKind(gvk)
+ defer kind.SetGroupVersionKind(oldGVK)
+ }
+
+ return e.Encoder.Encode(obj, stream)
}
// WithoutVersionDecoder clears the group version kind of a deserialized object.
@@ -257,3 +261,26 @@ func (d WithoutVersionDecoder) Decode(data []byte, defaults *schema.GroupVersion
}
return obj, gvk, err
}
+
+type encoderWithAllocator struct {
+ encoder EncoderWithAllocator
+ memAllocator MemoryAllocator
+}
+
+// NewEncoderWithAllocator returns a new encoder
+func NewEncoderWithAllocator(e EncoderWithAllocator, a MemoryAllocator) Encoder {
+ return &encoderWithAllocator{
+ encoder: e,
+ memAllocator: a,
+ }
+}
+
+// Encode writes the provided object to the nested writer
+func (e *encoderWithAllocator) Encode(obj Object, w io.Writer) error {
+ return e.encoder.EncodeWithAllocator(obj, w, e.memAllocator)
+}
+
+// Identifier returns identifier of this encoder.
+func (e *encoderWithAllocator) Identifier() Identifier {
+ return e.encoder.Identifier()
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go b/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
index 710a97795..e89ea8939 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go
@@ -365,4 +365,9 @@ type Unstructured interface {
// error should terminate the iteration. If IsList() returns false, this method should return an error
// instead of calling the provided function.
EachListItem(func(Object) error) error
+ // EachListItemWithAlloc works like EachListItem, but avoids retaining references to a slice of items.
+ // It does this by making a shallow copy of non-pointer items before passing them to fn.
+ //
+ // If the items passed to fn are not retained, or are retained for the same duration, use EachListItem instead for memory efficiency.
+ EachListItemWithAlloc(func(Object) error) error
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
index 46b1e787b..7a26d2798 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto
+// source: k8s.io/apimachinery/pkg/runtime/schema/generated.proto
package schema
@@ -39,21 +39,20 @@ var _ = math.Inf
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto", fileDescriptor_0462724132518e0d)
+ proto.RegisterFile("k8s.io/apimachinery/pkg/runtime/schema/generated.proto", fileDescriptor_25f8f0eed21c6089)
}
-var fileDescriptor_0462724132518e0d = []byte{
- // 186 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0xce, 0xad, 0x8e, 0xc3, 0x30,
- 0x0c, 0xc0, 0xf1, 0x84, 0x1e, 0x3c, 0x78, 0xc0, 0xb0, 0xec, 0x62, 0x7a, 0xf8, 0xf0, 0xa4, 0xf1,
- 0xb1, 0xb4, 0xf5, 0xd2, 0x28, 0xca, 0x87, 0xd2, 0x64, 0xd2, 0xd8, 0x1e, 0x61, 0x8f, 0x55, 0x58,
- 0x58, 0xb8, 0x66, 0x2f, 0x32, 0x29, 0x2d, 0x18, 0x1c, 0xf3, 0x5f, 0xd6, 0xcf, 0xf2, 0xd7, 0xd1,
- 0xfc, 0x8d, 0x42, 0x7b, 0x34, 0xb9, 0xa5, 0xe8, 0x28, 0xd1, 0x88, 0x17, 0x72, 0xbd, 0x8f, 0xb8,
- 0x2f, 0x64, 0xd0, 0x56, 0x76, 0x83, 0x76, 0x14, 0xaf, 0x18, 0x8c, 0xc2, 0x98, 0x5d, 0xd2, 0x96,
- 0x70, 0xec, 0x06, 0xb2, 0x12, 0x15, 0x39, 0x8a, 0x32, 0x51, 0x2f, 0x42, 0xf4, 0xc9, 0x7f, 0x37,
- 0x9b, 0x13, 0xef, 0x4e, 0x04, 0xa3, 0xc4, 0xee, 0xc4, 0xe6, 0x7e, 0x7e, 0x95, 0x4e, 0x43, 0x6e,
- 0x45, 0xe7, 0x2d, 0x2a, 0xaf, 0x3c, 0x56, 0xde, 0xe6, 0x73, 0xad, 0x1a, 0x75, 0xda, 0xce, 0xfe,
- 0x1f, 0xa6, 0x15, 0xd8, 0xbc, 0x02, 0x5b, 0x56, 0x60, 0xb7, 0x02, 0x7c, 0x2a, 0xc0, 0xe7, 0x02,
- 0x7c, 0x29, 0xc0, 0x1f, 0x05, 0xf8, 0xfd, 0x09, 0xec, 0xd4, 0x7c, 0xf6, 0xf4, 0x2b, 0x00, 0x00,
- 0xff, 0xff, 0x12, 0xb4, 0xae, 0x48, 0xf6, 0x00, 0x00, 0x00,
+var fileDescriptor_25f8f0eed21c6089 = []byte{
+ // 170 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0xce, 0xa1, 0x0e, 0xc2, 0x30,
+ 0x10, 0xc6, 0xf1, 0xd6, 0x22, 0x91, 0x88, 0x93, 0x73, 0xdc, 0x39, 0x82, 0x46, 0xf3, 0x04, 0xb8,
+ 0x6e, 0x94, 0xae, 0x59, 0xba, 0x6b, 0xba, 0x4e, 0xe0, 0x78, 0x04, 0x1e, 0x6b, 0x72, 0x72, 0x92,
+ 0x95, 0x17, 0x21, 0x69, 0x11, 0x48, 0xdc, 0xfd, 0xc5, 0xef, 0xf2, 0x6d, 0x0e, 0xdd, 0x71, 0x40,
+ 0xcb, 0xa4, 0xbc, 0x75, 0xaa, 0x69, 0x6d, 0xaf, 0xc3, 0x9d, 0x7c, 0x67, 0x28, 0x8c, 0x7d, 0xb4,
+ 0x4e, 0xd3, 0xd0, 0xb4, 0xda, 0x29, 0x32, 0xba, 0xd7, 0x41, 0x45, 0x7d, 0x45, 0x1f, 0x38, 0xf2,
+ 0xb6, 0x2a, 0x0e, 0x7f, 0x1d, 0xfa, 0xce, 0xe0, 0xd7, 0x61, 0x71, 0xbb, 0xbd, 0xb1, 0xb1, 0x1d,
+ 0x6b, 0x6c, 0xd8, 0x91, 0x61, 0xc3, 0x94, 0x79, 0x3d, 0xde, 0x72, 0xe5, 0xc8, 0x57, 0x79, 0x7b,
+ 0x3a, 0x4f, 0x2b, 0x88, 0x79, 0x05, 0xb1, 0xac, 0x20, 0x1e, 0x09, 0xe4, 0x94, 0x40, 0xce, 0x09,
+ 0xe4, 0x92, 0x40, 0xbe, 0x12, 0xc8, 0xe7, 0x1b, 0xc4, 0xa5, 0xfa, 0x6f, 0xf4, 0x27, 0x00, 0x00,
+ 0xff, 0xff, 0x97, 0xb8, 0x4d, 0x1f, 0xdd, 0x00, 0x00, 0x00,
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
index b21eb664e..d1c37c942 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go
@@ -39,7 +39,7 @@ func ParseResourceArg(arg string) (*GroupVersionResource, GroupResource) {
// ParseKindArg takes the common style of string which may be either `Kind.group.com` or `Kind.version.group.com`
// and parses it out into both possibilities. This code takes no responsibility for knowing which representation was intended
// but with a knowledge of all GroupKinds, calling code can take a very good guess. If there are only two segments, then
-// `*GroupVersionResource` is nil.
+// `*GroupVersionKind` is nil.
// `Kind.group.com` -> `group=com, version=group, kind=Kind` and `group=group.com, kind=Kind`
func ParseKindArg(arg string) (*GroupVersionKind, GroupKind) {
var gvk *GroupVersionKind
@@ -191,8 +191,7 @@ func (gv GroupVersion) Identifier() string {
// if none of the options match the group. It prefers a match to group and version over just group.
// TODO: Move GroupVersion to a package under pkg/runtime, since it's used by scheme.
// TODO: Introduce an adapter type between GroupVersion and runtime.GroupVersioner, and use LegacyCodec(GroupVersion)
-//
-// in fewer places.
+// in fewer places.
func (gv GroupVersion) KindForGroupVersionKinds(kinds []GroupVersionKind) (target GroupVersionKind, ok bool) {
for _, gvk := range kinds {
if gvk.Group == gv.Group && gvk.Version == gv.Version {
@@ -240,8 +239,7 @@ func (gv GroupVersion) WithResource(resource string) GroupVersionResource {
// GroupVersions can be used to represent a set of desired group versions.
// TODO: Move GroupVersions to a package under pkg/runtime, since it's used by scheme.
// TODO: Introduce an adapter type between GroupVersions and runtime.GroupVersioner, and use LegacyCodec(GroupVersion)
-//
-// in fewer places.
+// in fewer places.
type GroupVersions []GroupVersion
// Identifier implements runtime.GroupVersioner interface.
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
index 18b25a994..a5b116718 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
@@ -118,8 +118,7 @@ func (s *Scheme) Converter() *conversion.Converter {
// API group and version that would never be updated.
//
// TODO: there is discussion about removing unversioned and replacing it with objects that are manifest into
-//
-// every version with particular schemas. Resolve this method at that point.
+// every version with particular schemas. Resolve this method at that point.
func (s *Scheme) AddUnversionedTypes(version schema.GroupVersion, types ...Object) {
s.addObservedVersion(version)
s.AddKnownTypes(version, types...)
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct/direct.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct/direct.go
new file mode 100644
index 000000000..cd78b1df2
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct/direct.go
@@ -0,0 +1,36 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Package direct provides functions for marshaling and unmarshaling between arbitrary Go values and
+// CBOR data, with behavior that is compatible with that of the CBOR serializer. In particular,
+// types that implement cbor.Marshaler and cbor.Unmarshaler should use these functions.
+package direct
+
+import (
+ "k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes"
+)
+
+func Marshal(src interface{}) ([]byte, error) {
+ return modes.Encode.Marshal(src)
+}
+
+func Unmarshal(src []byte, dst interface{}) error {
+ return modes.Decode.Unmarshal(src, dst)
+}
+
+func Diagnose(src []byte) (string, error) {
+ return modes.Diagnostic.Diagnose(src)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/buffers.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/buffers.go
new file mode 100644
index 000000000..f14cbd6b5
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/buffers.go
@@ -0,0 +1,65 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "bytes"
+ "sync"
+)
+
+var buffers = BufferProvider{p: new(sync.Pool)}
+
+type buffer struct {
+ bytes.Buffer
+}
+
+type pool interface {
+ Get() interface{}
+ Put(interface{})
+}
+
+type BufferProvider struct {
+ p pool
+}
+
+func (b *BufferProvider) Get() *buffer {
+ if buf, ok := b.p.Get().(*buffer); ok {
+ return buf
+ }
+ return &buffer{}
+}
+
+func (b *BufferProvider) Put(buf *buffer) {
+ if buf.Cap() > 3*1024*1024 /* Default MaxRequestBodyBytes */ {
+ // Objects in a sync.Pool are assumed to be fungible. This is not a good assumption
+ // for pools of *bytes.Buffer because a *bytes.Buffer's underlying array grows as
+ // needed to accommodate writes. In Kubernetes, apiservers tend to encode "small"
+ // objects very frequently and much larger objects (especially large lists) only
+ // occasionally. Under steady load, pooled buffers tend to be borrowed frequently
+ // enough to prevent them from being released. Over time, each buffer is used to
+ // encode a large object and its capacity increases accordingly. The result is that
+ // practically all buffers in the pool retain much more capacity than needed to
+ // encode most objects.
+
+ // As a basic mitigation for the worst case, buffers with more capacity than the
+ // default max request body size are never returned to the pool.
+ // TODO: Optimize for higher buffer utilization.
+ return
+ }
+ buf.Reset()
+ b.p.Put(buf)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/custom.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/custom.go
new file mode 100644
index 000000000..858529e95
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/custom.go
@@ -0,0 +1,422 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "encoding"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "reflect"
+ "sync"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+// Returns a non-nil error if and only if the argument's type (or one of its component types, for
+// composite types) implements json.Marshaler or encoding.TextMarshaler without also implementing
+// cbor.Marshaler and likewise for the respective Unmarshaler interfaces.
+//
+// This is a temporary, graduation-blocking restriction and will be removed in favor of automatic
+// transcoding between CBOR and JSON/text for these types. This restriction allows CBOR to be
+// exercised for in-tree and unstructured types while mitigating the risk of mangling out-of-tree
+// types in client programs.
+func RejectCustomMarshalers(v interface{}) error {
+ if v == nil {
+ return nil
+ }
+ rv := reflect.ValueOf(v)
+ if err := marshalerCache.getChecker(rv.Type()).check(rv, maxDepth); err != nil {
+ return fmt.Errorf("unable to serialize %T: %w", v, err)
+ }
+ if err := unmarshalerCache.getChecker(rv.Type()).check(rv, maxDepth); err != nil {
+ return fmt.Errorf("unable to serialize %T: %w", v, err)
+ }
+ return nil
+}
+
+// Recursion depth is limited as a basic mitigation against cyclic objects. Objects created by the
+// decoder shouldn't be able to contain cycles, but practically any object can be passed to the
+// encoder.
+var errMaxDepthExceeded = errors.New("object depth exceeds limit (possible cycle?)")
+
+// The JSON encoder begins detecting cycles after depth 1000. Use a generous limit here, knowing
+// that it can might deeply nested acyclic objects. The limit will be removed along with the rest of
+// this mechanism.
+const maxDepth = 2048
+
+var marshalerCache = checkers{
+ cborInterface: reflect.TypeFor[cbor.Marshaler](),
+ nonCBORInterfaces: []reflect.Type{
+ reflect.TypeFor[json.Marshaler](),
+ reflect.TypeFor[encoding.TextMarshaler](),
+ },
+}
+
+var unmarshalerCache = checkers{
+ cborInterface: reflect.TypeFor[cbor.Unmarshaler](),
+ nonCBORInterfaces: []reflect.Type{
+ reflect.TypeFor[json.Unmarshaler](),
+ reflect.TypeFor[encoding.TextUnmarshaler](),
+ },
+ assumeAddressableValues: true,
+}
+
+// checker wraps a function for dynamically checking a value of a specific type for custom JSON
+// behaviors not matched by a custom CBOR behavior.
+type checker struct {
+ // check returns a non-nil error if the given value might be marshalled to or from CBOR
+ // using the default behavior for its kind, but marshalled to or from JSON using custom
+ // behavior.
+ check func(rv reflect.Value, depth int) error
+
+ // safe returns true if all values of this type are safe from mismatched custom marshalers.
+ safe func() bool
+}
+
+// TODO: stale
+// Having a single addressable checker for comparisons lets us prune and collapse parts of the
+// object traversal that are statically known to be safe. Depending on the type, it may be
+// unnecessary to inspect each value of that type. For example, no value of the built-in type bool
+// can implement json.Marshaler (a named type whose underlying type is bool could, but it is a
+// distinct type from bool).
+var noop = checker{
+ safe: func() bool {
+ return true
+ },
+ check: func(rv reflect.Value, depth int) error {
+ return nil
+ },
+}
+
+type checkers struct {
+ m sync.Map // reflect.Type => *checker
+
+ cborInterface reflect.Type
+ nonCBORInterfaces []reflect.Type
+
+ assumeAddressableValues bool
+}
+
+func (cache *checkers) getChecker(rt reflect.Type) checker {
+ if ptr, ok := cache.m.Load(rt); ok {
+ return *ptr.(*checker)
+ }
+
+ return cache.getCheckerInternal(rt, nil)
+}
+
+// linked list node representing the path from a composite type to an element type
+type path struct {
+ Type reflect.Type
+ Parent *path
+}
+
+func (p path) cyclic(rt reflect.Type) bool {
+ for ancestor := &p; ancestor != nil; ancestor = ancestor.Parent {
+ if ancestor.Type == rt {
+ return true
+ }
+ }
+ return false
+}
+
+func (cache *checkers) getCheckerInternal(rt reflect.Type, parent *path) (c checker) {
+ // Store a placeholder cache entry first to handle cyclic types.
+ var wg sync.WaitGroup
+ wg.Add(1)
+ defer wg.Done()
+ c = checker{
+ safe: func() bool {
+ wg.Wait()
+ return c.safe()
+ },
+ check: func(rv reflect.Value, depth int) error {
+ wg.Wait()
+ return c.check(rv, depth)
+ },
+ }
+ if actual, loaded := cache.m.LoadOrStore(rt, &c); loaded {
+ // Someone else stored an entry for this type, use it.
+ return *actual.(*checker)
+ }
+
+ // Take a nonreflective path for the unstructured container types. They're common and
+ // usually nested inside one another.
+ switch rt {
+ case reflect.TypeFor[map[string]interface{}](), reflect.TypeFor[[]interface{}]():
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ return checkUnstructuredValue(cache, rv.Interface(), depth)
+ },
+ }
+ }
+
+ // It's possible that one of the relevant interfaces is implemented on a type with a pointer
+ // receiver, but that a particular value of that type is not addressable. For example:
+ //
+ // func (Foo) MarshalText() ([]byte, error) { ... }
+ // func (*Foo) MarshalCBOR() ([]byte, error) { ... }
+ //
+ // Both methods are in the method set of *Foo, but the method set of Foo contains only
+ // MarshalText.
+ //
+ // Both the unmarshaler and marshaler checks assume that methods implementing a JSON or text
+ // interface with a pointer receiver are always accessible. Only the unmarshaler check
+ // assumes that CBOR methods with pointer receivers are accessible.
+
+ if rt.Implements(cache.cborInterface) {
+ return noop
+ }
+ for _, unsafe := range cache.nonCBORInterfaces {
+ if rt.Implements(unsafe) {
+ err := fmt.Errorf("%v implements %v without corresponding cbor interface", rt, unsafe)
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(reflect.Value, int) error {
+ return err
+ },
+ }
+ }
+ }
+
+ if cache.assumeAddressableValues && reflect.PointerTo(rt).Implements(cache.cborInterface) {
+ return noop
+ }
+ for _, unsafe := range cache.nonCBORInterfaces {
+ if reflect.PointerTo(rt).Implements(unsafe) {
+ err := fmt.Errorf("%v implements %v without corresponding cbor interface", reflect.PointerTo(rt), unsafe)
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(reflect.Value, int) error {
+ return err
+ },
+ }
+ }
+ }
+
+ self := &path{Type: rt, Parent: parent}
+
+ switch rt.Kind() {
+ case reflect.Array:
+ ce := cache.getCheckerInternal(rt.Elem(), self)
+ rtlen := rt.Len()
+ if rtlen == 0 || (!self.cyclic(rt.Elem()) && ce.safe()) {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for i := 0; i < rtlen; i++ {
+ if err := ce.check(rv.Index(i), depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ },
+ }
+
+ case reflect.Interface:
+ // All interface values have to be checked because their dynamic type might
+ // implement one of the interesting interfaces or be composed of another type that
+ // does.
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if rv.IsNil() {
+ return nil
+ }
+ // Unpacking interfaces must count against recursion depth,
+ // consider this cycle:
+ // > var i interface{}
+ // > var p *interface{} = &i
+ // > i = p
+ // > rv := reflect.ValueOf(i)
+ // > for {
+ // > rv = rv.Elem()
+ // > }
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ rv = rv.Elem()
+ return cache.getChecker(rv.Type()).check(rv, depth-1)
+ },
+ }
+
+ case reflect.Map:
+ rtk := rt.Key()
+ ck := cache.getCheckerInternal(rtk, self)
+ rte := rt.Elem()
+ ce := cache.getCheckerInternal(rte, self)
+ if !self.cyclic(rtk) && !self.cyclic(rte) && ck.safe() && ce.safe() {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ iter := rv.MapRange()
+ rvk := reflect.New(rtk).Elem()
+ rve := reflect.New(rte).Elem()
+ for iter.Next() {
+ rvk.SetIterKey(iter)
+ if err := ck.check(rvk, depth-1); err != nil {
+ return err
+ }
+ rve.SetIterValue(iter)
+ if err := ce.check(rve, depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ },
+ }
+
+ case reflect.Pointer:
+ ce := cache.getCheckerInternal(rt.Elem(), self)
+ if !self.cyclic(rt.Elem()) && ce.safe() {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if rv.IsNil() {
+ return nil
+ }
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ return ce.check(rv.Elem(), depth-1)
+ },
+ }
+
+ case reflect.Slice:
+ ce := cache.getCheckerInternal(rt.Elem(), self)
+ if !self.cyclic(rt.Elem()) && ce.safe() {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for i := 0; i < rv.Len(); i++ {
+ if err := ce.check(rv.Index(i), depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ },
+ }
+
+ case reflect.Struct:
+ type field struct {
+ Index int
+ Checker checker
+ }
+ var fields []field
+ for i := 0; i < rt.NumField(); i++ {
+ f := rt.Field(i)
+ cf := cache.getCheckerInternal(f.Type, self)
+ if !self.cyclic(f.Type) && cf.safe() {
+ continue
+ }
+ fields = append(fields, field{Index: i, Checker: cf})
+ }
+ if len(fields) == 0 {
+ return noop
+ }
+ return checker{
+ safe: func() bool {
+ return false
+ },
+ check: func(rv reflect.Value, depth int) error {
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for _, fi := range fields {
+ if err := fi.Checker.check(rv.Field(fi.Index), depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ },
+ }
+
+ default:
+ // Not a serializable composite type (funcs and channels are composite types but are
+ // rejected by JSON and CBOR serialization).
+ return noop
+
+ }
+}
+
+func checkUnstructuredValue(cache *checkers, v interface{}, depth int) error {
+ switch v := v.(type) {
+ case nil, bool, int64, float64, string:
+ return nil
+ case []interface{}:
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for _, element := range v {
+ if err := checkUnstructuredValue(cache, element, depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ case map[string]interface{}:
+ if depth <= 0 {
+ return errMaxDepthExceeded
+ }
+ for _, element := range v {
+ if err := checkUnstructuredValue(cache, element, depth-1); err != nil {
+ return err
+ }
+ }
+ return nil
+ default:
+ // Unmarshaling an unstructured doesn't use other dynamic types, but nothing
+ // prevents inserting values with arbitrary dynamic types into unstructured content,
+ // as long as they can be marshalled.
+ rv := reflect.ValueOf(v)
+ return cache.getChecker(rv.Type()).check(rv, depth)
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go
new file mode 100644
index 000000000..895b0deff
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go
@@ -0,0 +1,158 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "reflect"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+var simpleValues *cbor.SimpleValueRegistry = func() *cbor.SimpleValueRegistry {
+ var opts []func(*cbor.SimpleValueRegistry) error
+ for sv := 0; sv <= 255; sv++ {
+ // Reject simple values 0-19, 23, and 32-255. The simple values 24-31 are reserved
+ // and considered ill-formed by the CBOR specification. We only accept false (20),
+ // true (21), and null (22).
+ switch sv {
+ case 20: // false
+ case 21: // true
+ case 22: // null
+ case 24, 25, 26, 27, 28, 29, 30, 31: // reserved
+ default:
+ opts = append(opts, cbor.WithRejectedSimpleValue(cbor.SimpleValue(sv)))
+ }
+ }
+ simpleValues, err := cbor.NewSimpleValueRegistryFromDefaults(opts...)
+ if err != nil {
+ panic(err)
+ }
+ return simpleValues
+}()
+
+var Decode cbor.DecMode = func() cbor.DecMode {
+ decode, err := cbor.DecOptions{
+ // Maps with duplicate keys are well-formed but invalid according to the CBOR spec
+ // and never acceptable. Unlike the JSON serializer, inputs containing duplicate map
+ // keys are rejected outright and not surfaced as a strict decoding error.
+ DupMapKey: cbor.DupMapKeyEnforcedAPF,
+
+ // For JSON parity, decoding an RFC3339 string into time.Time needs to be accepted
+ // with or without tagging. If a tag number is present, it must be valid.
+ TimeTag: cbor.DecTagOptional,
+
+ // Observed depth up to 16 in fuzzed batch/v1 CronJobList. JSON implementation limit
+ // is 10000.
+ MaxNestedLevels: 64,
+
+ MaxArrayElements: 1024,
+ MaxMapPairs: 1024,
+
+ // Indefinite-length sequences aren't produced by this serializer, but other
+ // implementations can.
+ IndefLength: cbor.IndefLengthAllowed,
+
+ // Accept inputs that contain CBOR tags.
+ TagsMd: cbor.TagsAllowed,
+
+ // Decode type 0 (unsigned integer) as int64.
+ // TODO: IntDecConvertSignedOrFail errors on overflow, JSON will try to fall back to float64.
+ IntDec: cbor.IntDecConvertSignedOrFail,
+
+ // Disable producing map[cbor.ByteString]interface{}, which is not acceptable for
+ // decodes into interface{}.
+ MapKeyByteString: cbor.MapKeyByteStringForbidden,
+
+ // Error on map keys that don't map to a field in the destination struct.
+ ExtraReturnErrors: cbor.ExtraDecErrorUnknownField,
+
+ // Decode maps into concrete type map[string]interface{} when the destination is an
+ // interface{}.
+ DefaultMapType: reflect.TypeOf(map[string]interface{}(nil)),
+
+ // A CBOR text string whose content is not a valid UTF-8 sequence is well-formed but
+ // invalid according to the CBOR spec. Reject invalid inputs. Encoders are
+ // responsible for ensuring that all text strings they produce contain valid UTF-8
+ // sequences and may use the byte string major type to encode strings that have not
+ // been validated.
+ UTF8: cbor.UTF8RejectInvalid,
+
+ // Never make a case-insensitive match between a map key and a struct field.
+ FieldNameMatching: cbor.FieldNameMatchingCaseSensitive,
+
+ // Produce string concrete values when decoding a CBOR byte string into interface{}.
+ DefaultByteStringType: reflect.TypeOf(""),
+
+ // Allow CBOR byte strings to be decoded into string destination values. If a byte
+ // string is enclosed in an "expected later encoding" tag
+ // (https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.5.2), then the text
+ // encoding indicated by that tag (e.g. base64) will be applied to the contents of
+ // the byte string.
+ ByteStringToString: cbor.ByteStringToStringAllowedWithExpectedLaterEncoding,
+
+ // Allow CBOR byte strings to match struct fields when appearing as a map key.
+ FieldNameByteString: cbor.FieldNameByteStringAllowed,
+
+ // When decoding an unrecognized tag to interface{}, return the decoded tag content
+ // instead of the default, a cbor.Tag representing a (number, content) pair.
+ UnrecognizedTagToAny: cbor.UnrecognizedTagContentToAny,
+
+ // Decode time tags to interface{} as strings containing RFC 3339 timestamps.
+ TimeTagToAny: cbor.TimeTagToRFC3339Nano,
+
+ // For parity with JSON, strings can be decoded into time.Time if they are RFC 3339
+ // timestamps.
+ ByteStringToTime: cbor.ByteStringToTimeAllowed,
+
+ // Reject NaN and infinite floating-point values since they don't have a JSON
+ // representation (RFC 8259 Section 6).
+ NaN: cbor.NaNDecodeForbidden,
+ Inf: cbor.InfDecodeForbidden,
+
+ // When unmarshaling a byte string into a []byte, assume that the byte string
+ // contains base64-encoded bytes, unless explicitly counterindicated by an "expected
+ // later encoding" tag. This is consistent with the because of unmarshaling a JSON
+ // text into a []byte.
+ ByteStringExpectedFormat: cbor.ByteStringExpectedBase64,
+
+ // Reject the arbitrary-precision integer tags because they can't be faithfully
+ // roundtripped through the allowable Unstructured types.
+ BignumTag: cbor.BignumTagForbidden,
+
+ // Reject anything other than the simple values true, false, and null.
+ SimpleValues: simpleValues,
+
+ // Disable default recognition of types implementing encoding.BinaryUnmarshaler,
+ // which is not recognized for JSON decoding.
+ BinaryUnmarshaler: cbor.BinaryUnmarshalerNone,
+ }.DecMode()
+ if err != nil {
+ panic(err)
+ }
+ return decode
+}()
+
+// DecodeLax is derived from Decode, but does not complain about unknown fields in the input.
+var DecodeLax cbor.DecMode = func() cbor.DecMode {
+ opts := Decode.DecOptions()
+ opts.ExtraReturnErrors &^= cbor.ExtraDecErrorUnknownField // clear bit
+ dm, err := opts.DecMode()
+ if err != nil {
+ panic(err)
+ }
+ return dm
+}()
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/diagnostic.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/diagnostic.go
new file mode 100644
index 000000000..61f3f145f
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/diagnostic.go
@@ -0,0 +1,36 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "github.com/fxamacker/cbor/v2"
+)
+
+var Diagnostic cbor.DiagMode = func() cbor.DiagMode {
+ opts := Decode.DecOptions()
+ diagnostic, err := cbor.DiagOptions{
+ ByteStringText: true,
+
+ MaxNestedLevels: opts.MaxNestedLevels,
+ MaxArrayElements: opts.MaxArrayElements,
+ MaxMapPairs: opts.MaxMapPairs,
+ }.DiagMode()
+ if err != nil {
+ panic(err)
+ }
+ return diagnostic
+}()
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go
new file mode 100644
index 000000000..c66931384
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/encode.go
@@ -0,0 +1,155 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package modes
+
+import (
+ "io"
+
+ "github.com/fxamacker/cbor/v2"
+)
+
+var Encode = EncMode{
+ delegate: func() cbor.UserBufferEncMode {
+ encode, err := cbor.EncOptions{
+ // Map keys need to be sorted to have deterministic output, and this is the order
+ // defined in RFC 8949 4.2.1 "Core Deterministic Encoding Requirements".
+ Sort: cbor.SortBytewiseLexical,
+
+ // CBOR supports distinct types for IEEE-754 float16, float32, and float64. Store
+ // floats in the smallest width that preserves value so that equivalent float32 and
+ // float64 values encode to identical bytes, as they do in a JSON
+ // encoding. Satisfies one of the "Core Deterministic Encoding Requirements".
+ ShortestFloat: cbor.ShortestFloat16,
+
+ // Error on attempt to encode NaN and infinite values. This is what the JSON
+ // serializer does.
+ NaNConvert: cbor.NaNConvertReject,
+ InfConvert: cbor.InfConvertReject,
+
+ // Error on attempt to encode math/big.Int values, which can't be faithfully
+ // roundtripped through Unstructured in general (the dynamic numeric types allowed
+ // in Unstructured are limited to float64 and int64).
+ BigIntConvert: cbor.BigIntConvertReject,
+
+ // MarshalJSON for time.Time writes RFC3339 with nanos.
+ Time: cbor.TimeRFC3339Nano,
+
+ // The decoder must be able to accept RFC3339 strings with or without tag 0 (e.g. by
+ // the end of time.Time -> JSON -> Unstructured -> CBOR, the CBOR encoder has no
+ // reliable way of knowing that a particular string originated from serializing a
+ // time.Time), so producing tag 0 has little use.
+ TimeTag: cbor.EncTagNone,
+
+ // Indefinite-length items have multiple encodings and aren't being used anyway, so
+ // disable to avoid an opportunity for nondeterminism.
+ IndefLength: cbor.IndefLengthForbidden,
+
+ // Preserve distinction between nil and empty for slices and maps.
+ NilContainers: cbor.NilContainerAsNull,
+
+ // OK to produce tags.
+ TagsMd: cbor.TagsAllowed,
+
+ // Use the same definition of "empty" as encoding/json.
+ OmitEmpty: cbor.OmitEmptyGoValue,
+
+ // The CBOR types text string and byte string are structurally equivalent, with the
+ // semantic difference that a text string whose content is an invalid UTF-8 sequence
+ // is itself invalid. We reject all invalid text strings at decode time and do not
+ // validate or sanitize all Go strings at encode time. Encoding Go strings to the
+ // byte string type is comparable to the existing Protobuf behavior and cheaply
+ // ensures that the output is valid CBOR.
+ String: cbor.StringToByteString,
+
+ // Encode struct field names to the byte string type rather than the text string
+ // type.
+ FieldName: cbor.FieldNameToByteString,
+
+ // Marshal Go byte arrays to CBOR arrays of integers (as in JSON) instead of byte
+ // strings.
+ ByteArray: cbor.ByteArrayToArray,
+
+ // Marshal []byte to CBOR byte string enclosed in tag 22 (expected later base64
+ // encoding, https://www.rfc-editor.org/rfc/rfc8949.html#section-3.4.5.2), to
+ // interoperate with the existing JSON behavior. This indicates to the decoder that,
+ // when decoding into a string (or unstructured), the resulting value should be the
+ // base64 encoding of the original bytes. No base64 encoding or decoding needs to be
+ // performed for []byte-to-CBOR-to-[]byte roundtrips.
+ ByteSliceLaterFormat: cbor.ByteSliceLaterFormatBase64,
+
+ // Disable default recognition of types implementing encoding.BinaryMarshaler, which
+ // is not recognized for JSON encoding.
+ BinaryMarshaler: cbor.BinaryMarshalerNone,
+ }.UserBufferEncMode()
+ if err != nil {
+ panic(err)
+ }
+ return encode
+ }(),
+}
+
+var EncodeNondeterministic = EncMode{
+ delegate: func() cbor.UserBufferEncMode {
+ opts := Encode.options()
+ opts.Sort = cbor.SortNone // TODO: Use cbor.SortFastShuffle after bump to v2.7.0.
+ em, err := opts.UserBufferEncMode()
+ if err != nil {
+ panic(err)
+ }
+ return em
+ }(),
+}
+
+type EncMode struct {
+ delegate cbor.UserBufferEncMode
+}
+
+func (em EncMode) options() cbor.EncOptions {
+ return em.delegate.EncOptions()
+}
+
+func (em EncMode) MarshalTo(v interface{}, w io.Writer) error {
+ if buf, ok := w.(*buffer); ok {
+ return em.delegate.MarshalToBuffer(v, &buf.Buffer)
+ }
+
+ buf := buffers.Get()
+ defer buffers.Put(buf)
+ if err := em.delegate.MarshalToBuffer(v, &buf.Buffer); err != nil {
+ return err
+ }
+
+ if _, err := io.Copy(w, buf); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (em EncMode) Marshal(v interface{}) ([]byte, error) {
+ buf := buffers.Get()
+ defer buffers.Put(buf)
+
+ if err := em.MarshalTo(v, &buf.Buffer); err != nil {
+ return nil, err
+ }
+
+ clone := make([]byte, buf.Len())
+ copy(clone, buf.Bytes())
+
+ return clone, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
index 21944f2d8..ff9820842 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go
@@ -259,8 +259,7 @@ func (f CodecFactory) SupportedMediaTypes() []runtime.SerializerInfo {
// invoke CodecForVersions. Callers that need only to read data should use UniversalDecoder().
//
// TODO: make this call exist only in pkg/api, and initialize it with the set of default versions.
-//
-// All other callers will be forced to request a Codec directly.
+// All other callers will be forced to request a Codec directly.
func (f CodecFactory) LegacyCodec(version ...schema.GroupVersion) runtime.Codec {
return versioning.NewDefaultingCodecForScheme(f.scheme, f.legacySerializer, f.universal, schema.GroupVersions(version), runtime.InternalGroupVersioner)
}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go
index 87b3fec3f..971c46d49 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go
@@ -134,23 +134,3 @@ func (e *encoder) Encode(obj runtime.Object) error {
e.buf.Reset()
return err
}
-
-type encoderWithAllocator struct {
- writer io.Writer
- encoder runtime.EncoderWithAllocator
- memAllocator runtime.MemoryAllocator
-}
-
-// NewEncoderWithAllocator returns a new streaming encoder
-func NewEncoderWithAllocator(w io.Writer, e runtime.EncoderWithAllocator, a runtime.MemoryAllocator) Encoder {
- return &encoderWithAllocator{
- writer: w,
- encoder: e,
- memAllocator: a,
- }
-}
-
-// Encode writes the provided object to the nested writer
-func (e *encoderWithAllocator) Encode(obj runtime.Object) error {
- return e.encoder.EncodeWithAllocator(obj, e.writer, e.memAllocator)
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
index 446633182..25f955ed7 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go
@@ -147,7 +147,7 @@ func (c *codec) Decode(data []byte, defaultGVK *schema.GroupVersionKind, into ru
}
if d, ok := obj.(runtime.NestedObjectDecoder); ok {
- if err := d.DecodeNestedObjects(runtime.WithoutVersionDecoder{c.decoder}); err != nil {
+ if err := d.DecodeNestedObjects(runtime.WithoutVersionDecoder{Decoder: c.decoder}); err != nil {
if strictErr, ok := runtime.AsStrictDecodingError(err); ok {
// save the strictDecodingError let and the caller decide what to do with it
strictDecodingErrs = append(strictDecodingErrs, strictErr.Errors()...)
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/splice.go b/vendor/k8s.io/apimachinery/pkg/runtime/splice.go
new file mode 100644
index 000000000..2badb7b97
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/splice.go
@@ -0,0 +1,76 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package runtime
+
+import (
+ "bytes"
+ "io"
+)
+
+// Splice is the interface that wraps the Splice method.
+//
+// Splice moves data from given slice without copying the underlying data for
+// efficiency purpose. Therefore, the caller should make sure the underlying
+// data is not changed later.
+type Splice interface {
+ Splice([]byte)
+ io.Writer
+ Reset()
+ Bytes() []byte
+}
+
+// A spliceBuffer implements Splice and io.Writer interfaces.
+type spliceBuffer struct {
+ raw []byte
+ buf *bytes.Buffer
+}
+
+func NewSpliceBuffer() Splice {
+ return &spliceBuffer{}
+}
+
+// Splice implements the Splice interface.
+func (sb *spliceBuffer) Splice(raw []byte) {
+ sb.raw = raw
+}
+
+// Write implements the io.Writer interface.
+func (sb *spliceBuffer) Write(p []byte) (n int, err error) {
+ if sb.buf == nil {
+ sb.buf = &bytes.Buffer{}
+ }
+ return sb.buf.Write(p)
+}
+
+// Reset resets the buffer to be empty.
+func (sb *spliceBuffer) Reset() {
+ if sb.buf != nil {
+ sb.buf.Reset()
+ }
+ sb.raw = nil
+}
+
+// Bytes returns the data held by the buffer.
+func (sb *spliceBuffer) Bytes() []byte {
+ if sb.buf != nil && len(sb.buf.Bytes()) > 0 {
+ return sb.buf.Bytes()
+ }
+ if sb.raw != nil {
+ return sb.raw
+ }
+ return []byte{}
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/types.go b/vendor/k8s.io/apimachinery/pkg/runtime/types.go
index 3dc9a5a2f..1680c149f 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/types.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/types.go
@@ -46,6 +46,7 @@ const (
ContentTypeJSON string = "application/json"
ContentTypeYAML string = "application/yaml"
ContentTypeProtobuf string = "application/vnd.kubernetes.protobuf"
+ ContentTypeCBOR string = "application/cbor"
)
// RawExtension is used to hold extensions in external versions.
@@ -123,7 +124,7 @@ type Unknown struct {
// Raw will hold the complete serialized object which couldn't be matched
// with a registered type. Most likely, nothing should be done with this
// except for passing it through the system.
- Raw []byte `protobuf:"bytes,2,opt,name=raw"`
+ Raw []byte `json:"-" protobuf:"bytes,2,opt,name=raw"`
// ContentEncoding is encoding used to encode 'Raw' data.
// Unspecified means no encoding.
ContentEncoding string `protobuf:"bytes,3,opt,name=contentEncoding"`
diff --git a/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go b/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go
index b19750f3a..db18ce1ce 100644
--- a/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go
+++ b/vendor/k8s.io/apimachinery/pkg/types/namespacedname.go
@@ -37,3 +37,14 @@ const (
func (n NamespacedName) String() string {
return n.Namespace + string(Separator) + n.Name
}
+
+// MarshalLog emits a struct containing required key/value pair
+func (n NamespacedName) MarshalLog() interface{} {
+ return struct {
+ Name string `json:"name"`
+ Namespace string `json:"namespace,omitempty"`
+ }{
+ Name: n.Name,
+ Namespace: n.Namespace,
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go b/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go
index 0d2f153bf..1396274c7 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go
@@ -40,6 +40,13 @@ func NewExpiringWithClock(clock clock.Clock) *Expiring {
// Expiring is a map whose entries expire after a per-entry timeout.
type Expiring struct {
+ // AllowExpiredGet causes the expiration check to be skipped on Get.
+ // It should only be used when a key always corresponds to the exact same value.
+ // Thus when this field is true, expired keys are considered valid
+ // until the next call to Set (which causes the GC to run).
+ // It may not be changed concurrently with calls to Get.
+ AllowExpiredGet bool
+
clock clock.Clock
// mu protects the below fields
@@ -70,7 +77,10 @@ func (c *Expiring) Get(key interface{}) (val interface{}, ok bool) {
c.mu.RLock()
defer c.mu.RUnlock()
e, ok := c.cache[key]
- if !ok || !c.clock.Now().Before(e.expiry) {
+ if !ok {
+ return nil, false
+ }
+ if !c.AllowExpiredGet && !c.clock.Now().Before(e.expiry) {
return nil, false
}
return e.val, true
diff --git a/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go b/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go
index 1328dd612..ad486d580 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go
@@ -136,6 +136,19 @@ func (c *LRUExpireCache) Remove(key interface{}) {
delete(c.entries, key)
}
+// RemoveAll removes all keys that match predicate.
+func (c *LRUExpireCache) RemoveAll(predicate func(key any) bool) {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
+ for key, element := range c.entries {
+ if predicate(key) {
+ c.evictionList.Remove(element)
+ delete(c.entries, key)
+ }
+ }
+}
+
// Keys returns all unexpired keys in the cache.
//
// Keep in mind that subsequent calls to Get() for any of the returned keys
diff --git a/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go b/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go
index ec4002e38..fc0301844 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go
@@ -23,34 +23,20 @@ import (
"strings"
"text/tabwriter"
- "github.com/davecgh/go-spew/spew"
"github.com/google/go-cmp/cmp"
+ "k8s.io/apimachinery/pkg/util/dump"
)
-// StringDiff diffs a and b and returns a human readable diff.
-func StringDiff(a, b string) string {
- ba := []byte(a)
- bb := []byte(b)
- out := []byte{}
- i := 0
- for ; i < len(ba) && i < len(bb); i++ {
- if ba[i] != bb[i] {
- break
- }
- out = append(out, ba[i])
- }
- out = append(out, []byte("\n\nA: ")...)
- out = append(out, ba[i:]...)
- out = append(out, []byte("\n\nB: ")...)
- out = append(out, bb[i:]...)
- out = append(out, []byte("\n\n")...)
- return string(out)
-}
-
func legacyDiff(a, b interface{}) string {
return cmp.Diff(a, b)
}
+// StringDiff diffs a and b and returns a human readable diff.
+// DEPRECATED: use github.com/google/go-cmp/cmp.Diff
+func StringDiff(a, b string) string {
+ return legacyDiff(a, b)
+}
+
// ObjectDiff prints the diff of two go objects and fails if the objects
// contain unhandled unexported fields.
// DEPRECATED: use github.com/google/go-cmp/cmp.Diff
@@ -75,13 +61,8 @@ func ObjectReflectDiff(a, b interface{}) string {
// ObjectGoPrintSideBySide prints a and b as textual dumps side by side,
// enabling easy visual scanning for mismatches.
func ObjectGoPrintSideBySide(a, b interface{}) string {
- s := spew.ConfigState{
- Indent: " ",
- // Extra deep spew.
- DisableMethods: true,
- }
- sA := s.Sdump(a)
- sB := s.Sdump(b)
+ sA := dump.Pretty(a)
+ sB := dump.Pretty(b)
linesA := strings.Split(sA, "\n")
linesB := strings.Split(sB, "\n")
diff --git a/vendor/k8s.io/apimachinery/pkg/util/dump/dump.go b/vendor/k8s.io/apimachinery/pkg/util/dump/dump.go
new file mode 100644
index 000000000..cf61ef76a
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/dump/dump.go
@@ -0,0 +1,54 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package dump
+
+import (
+ "github.com/davecgh/go-spew/spew"
+)
+
+var prettyPrintConfig = &spew.ConfigState{
+ Indent: " ",
+ DisableMethods: true,
+ DisablePointerAddresses: true,
+ DisableCapacities: true,
+}
+
+// The config MUST NOT be changed because that could change the result of a hash operation
+var prettyPrintConfigForHash = &spew.ConfigState{
+ Indent: " ",
+ SortKeys: true,
+ DisableMethods: true,
+ SpewKeys: true,
+ DisablePointerAddresses: true,
+ DisableCapacities: true,
+}
+
+// Pretty wrap the spew.Sdump with Indent, and disabled methods like error() and String()
+// The output may change over time, so for guaranteed output please take more direct control
+func Pretty(a interface{}) string {
+ return prettyPrintConfig.Sdump(a)
+}
+
+// ForHash keeps the original Spew.Sprintf format to ensure the same checksum
+func ForHash(a interface{}) string {
+ return prettyPrintConfigForHash.Sprintf("%#v", a)
+}
+
+// OneLine outputs the object in one line
+func OneLine(a interface{}) string {
+ return prettyPrintConfig.Sprintf("%#v", a)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go b/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
index 1f5a04fd4..1b60d145c 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go
@@ -214,7 +214,7 @@ func CreateAggregateFromMessageCountMap(m MessageCountMap) Aggregate {
return NewAggregate(result)
}
-// Reduce will return err or, if err is an Aggregate and only has one item,
+// Reduce will return err or nil, if err is an Aggregate and only has one item,
// the first item in the aggregate.
func Reduce(err error) error {
if agg, ok := err.(Aggregate); ok && err != nil {
diff --git a/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go b/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go
index ca08f8561..1ab8fd396 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/framer/framer.go
@@ -32,7 +32,7 @@ func NewLengthDelimitedFrameWriter(w io.Writer) io.Writer {
return &lengthDelimitedFrameWriter{w: w}
}
-// Write writes a single frame to the nested writer, prepending it with the length in
+// Write writes a single frame to the nested writer, prepending it with the length
// in bytes of data (as a 4 byte, bigendian uint32).
func (w *lengthDelimitedFrameWriter) Write(data []byte) (int, error) {
binary.BigEndian.PutUint32(w.h[:], uint32(len(data)))
@@ -147,7 +147,6 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) {
// RawMessage#Unmarshal appends to data - we reset the slice down to 0 and will either see
// data written to data, or be larger than data and a different array.
- n := len(data)
m := json.RawMessage(data[:0])
if err := r.decoder.Decode(&m); err != nil {
return 0, err
@@ -156,12 +155,19 @@ func (r *jsonFrameReader) Read(data []byte) (int, error) {
// If capacity of data is less than length of the message, decoder will allocate a new slice
// and set m to it, which means we need to copy the partial result back into data and preserve
// the remaining result for subsequent reads.
- if len(m) > n {
- //nolint:staticcheck // SA4006,SA4010 underlying array of data is modified here.
- data = append(data[0:0], m[:n]...)
- r.remaining = m[n:]
- return n, io.ErrShortBuffer
+ if len(m) > cap(data) {
+ copy(data, m)
+ r.remaining = m[len(data):]
+ return len(data), io.ErrShortBuffer
}
+
+ if len(m) > len(data) {
+ // The bytes beyond len(data) were stored in data's underlying array, which we do
+ // not own after this function returns.
+ r.remaining = append([]byte(nil), m[len(data):]...)
+ return len(data), io.ErrShortBuffer
+ }
+
return len(m), nil
}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
index 8f9ced93f..1f2877399 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go
@@ -15,7 +15,7 @@ limitations under the License.
*/
// Code generated by protoc-gen-gogo. DO NOT EDIT.
-// source: k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto
+// source: k8s.io/apimachinery/pkg/util/intstr/generated.proto
package intstr
@@ -43,7 +43,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
func (m *IntOrString) Reset() { *m = IntOrString{} }
func (*IntOrString) ProtoMessage() {}
func (*IntOrString) Descriptor() ([]byte, []int) {
- return fileDescriptor_94e046ae3ce6121c, []int{0}
+ return fileDescriptor_771bacc35a5ec189, []int{0}
}
func (m *IntOrString) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -73,30 +73,29 @@ func init() {
}
func init() {
- proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto", fileDescriptor_94e046ae3ce6121c)
+ proto.RegisterFile("k8s.io/apimachinery/pkg/util/intstr/generated.proto", fileDescriptor_771bacc35a5ec189)
}
-var fileDescriptor_94e046ae3ce6121c = []byte{
- // 292 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x90, 0xb1, 0x4a, 0x03, 0x31,
- 0x1c, 0xc6, 0x13, 0x5b, 0x8b, 0x9e, 0xe0, 0x50, 0x1c, 0x8a, 0x43, 0x7a, 0x58, 0x90, 0x5b, 0x4c,
- 0x56, 0x71, 0xec, 0x56, 0x10, 0x84, 0x56, 0x1c, 0xdc, 0xee, 0xda, 0x98, 0x86, 0x6b, 0x93, 0x90,
- 0xfb, 0x9f, 0x70, 0x5b, 0x1f, 0x41, 0x37, 0x47, 0x1f, 0xe7, 0xc6, 0x8e, 0x1d, 0xa4, 0x78, 0xf1,
- 0x2d, 0x9c, 0xe4, 0x72, 0x07, 0x3a, 0x3a, 0x25, 0xdf, 0xf7, 0xfd, 0x7e, 0x19, 0x12, 0xdc, 0xa6,
- 0xd7, 0x19, 0x95, 0x9a, 0xa5, 0x79, 0xc2, 0xad, 0xe2, 0xc0, 0x33, 0xf6, 0xcc, 0xd5, 0x42, 0x5b,
- 0xd6, 0x0e, 0xb1, 0x91, 0xeb, 0x78, 0xbe, 0x94, 0x8a, 0xdb, 0x82, 0x99, 0x54, 0xb0, 0x1c, 0xe4,
- 0x8a, 0x49, 0x05, 0x19, 0x58, 0x26, 0xb8, 0xe2, 0x36, 0x06, 0xbe, 0xa0, 0xc6, 0x6a, 0xd0, 0xfd,
- 0x51, 0x23, 0xd1, 0xbf, 0x12, 0x35, 0xa9, 0xa0, 0xb5, 0x44, 0x1b, 0xe9, 0xfc, 0x4a, 0x48, 0x58,
- 0xe6, 0x09, 0x9d, 0xeb, 0x35, 0x13, 0x5a, 0x68, 0xe6, 0xdd, 0x24, 0x7f, 0xf2, 0xc9, 0x07, 0x7f,
- 0x6b, 0xde, 0xbc, 0x78, 0xc5, 0xc1, 0xc9, 0x44, 0xc1, 0x9d, 0x9d, 0x81, 0x95, 0x4a, 0xf4, 0xa3,
- 0xa0, 0x0b, 0x85, 0xe1, 0x03, 0x1c, 0xe2, 0xa8, 0x33, 0x3e, 0x2b, 0xf7, 0x43, 0xe4, 0xf6, 0xc3,
- 0xee, 0x7d, 0x61, 0xf8, 0x77, 0x7b, 0x4e, 0x3d, 0xd1, 0xbf, 0x0c, 0x7a, 0x52, 0xc1, 0x43, 0xbc,
- 0x1a, 0x1c, 0x84, 0x38, 0x3a, 0x1c, 0x9f, 0xb6, 0x6c, 0x6f, 0xe2, 0xdb, 0x69, 0xbb, 0xd6, 0x5c,
- 0x06, 0xb6, 0xe6, 0x3a, 0x21, 0x8e, 0x8e, 0x7f, 0xb9, 0x99, 0x6f, 0xa7, 0xed, 0x7a, 0x73, 0xf4,
- 0xf6, 0x3e, 0x44, 0x9b, 0x8f, 0x10, 0x8d, 0x27, 0x65, 0x45, 0xd0, 0xb6, 0x22, 0x68, 0x57, 0x11,
- 0xb4, 0x71, 0x04, 0x97, 0x8e, 0xe0, 0xad, 0x23, 0x78, 0xe7, 0x08, 0xfe, 0x74, 0x04, 0xbf, 0x7c,
- 0x11, 0xf4, 0x38, 0xfa, 0xc7, 0x17, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xc4, 0xf0, 0xa0,
- 0x81, 0x01, 0x00, 0x00,
+var fileDescriptor_771bacc35a5ec189 = []byte{
+ // 277 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0xce, 0xb6, 0x28, 0xd6,
+ 0xcb, 0xcc, 0xd7, 0x4f, 0x2c, 0xc8, 0xcc, 0x4d, 0x4c, 0xce, 0xc8, 0xcc, 0x4b, 0x2d, 0xaa, 0xd4,
+ 0x2f, 0xc8, 0x4e, 0xd7, 0x2f, 0x2d, 0xc9, 0xcc, 0xd1, 0xcf, 0xcc, 0x2b, 0x29, 0x2e, 0x29, 0xd2,
+ 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0x4a, 0x2c, 0x49, 0x4d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
+ 0x52, 0x86, 0x68, 0xd2, 0x43, 0xd6, 0xa4, 0x57, 0x90, 0x9d, 0xae, 0x07, 0xd2, 0xa4, 0x07, 0xd1,
+ 0x24, 0xa5, 0x9b, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x9e, 0x9f,
+ 0x9e, 0xaf, 0x0f, 0xd6, 0x9b, 0x54, 0x9a, 0x06, 0xe6, 0x81, 0x39, 0x60, 0x16, 0xc4, 0x4c, 0xa5,
+ 0x89, 0x8c, 0x5c, 0xdc, 0x9e, 0x79, 0x25, 0xfe, 0x45, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x42,
+ 0x1a, 0x5c, 0x2c, 0x25, 0x95, 0x05, 0xa9, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x4e, 0x22, 0x27,
+ 0xee, 0xc9, 0x33, 0x3c, 0xba, 0x27, 0xcf, 0x12, 0x52, 0x59, 0x90, 0xfa, 0x0b, 0x4a, 0x07, 0x81,
+ 0x55, 0x08, 0xa9, 0x71, 0xb1, 0x65, 0xe6, 0x95, 0x84, 0x25, 0xe6, 0x48, 0x30, 0x29, 0x30, 0x6a,
+ 0xb0, 0x3a, 0xf1, 0x41, 0xd5, 0xb2, 0x79, 0x82, 0x45, 0x83, 0xa0, 0xb2, 0x20, 0x75, 0xc5, 0x25,
+ 0x45, 0x20, 0x75, 0xcc, 0x0a, 0x8c, 0x1a, 0x9c, 0x08, 0x75, 0xc1, 0x60, 0xd1, 0x20, 0xa8, 0xac,
+ 0x15, 0xc7, 0x8c, 0x05, 0xf2, 0x0c, 0x0d, 0x77, 0x14, 0x18, 0x9c, 0x3c, 0x4f, 0x3c, 0x94, 0x63,
+ 0xb8, 0xf0, 0x50, 0x8e, 0xe1, 0xc6, 0x43, 0x39, 0x86, 0x86, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9,
+ 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e,
+ 0xcb, 0x31, 0x44, 0x29, 0x13, 0x11, 0x84, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0xa1, 0x0b,
+ 0x1e, 0x68, 0x01, 0x00, 0x00,
}
func (m *IntOrString) Marshal() (dAtA []byte, err error) {
diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go b/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
index 5e8009704..5fd2e16c8 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go
@@ -25,6 +25,7 @@ import (
"strconv"
"strings"
+ cbor "k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct"
"k8s.io/klog/v2"
)
@@ -54,7 +55,7 @@ const (
// FromInt creates an IntOrString object with an int32 value. It is
// your responsibility not to call this method with a value greater
// than int32.
-// TODO: convert to (val int32)
+// Deprecated: use FromInt32 instead.
func FromInt(val int) IntOrString {
if val > math.MaxInt32 || val < math.MinInt32 {
klog.Errorf("value: %d overflows int32\n%s\n", val, debug.Stack())
@@ -62,19 +63,24 @@ func FromInt(val int) IntOrString {
return IntOrString{Type: Int, IntVal: int32(val)}
}
+// FromInt32 creates an IntOrString object with an int32 value.
+func FromInt32(val int32) IntOrString {
+ return IntOrString{Type: Int, IntVal: val}
+}
+
// FromString creates an IntOrString object with a string value.
func FromString(val string) IntOrString {
return IntOrString{Type: String, StrVal: val}
}
-// Parse the given string and try to convert it to an integer before
+// Parse the given string and try to convert it to an int32 integer before
// setting it as a string value.
func Parse(val string) IntOrString {
- i, err := strconv.Atoi(val)
+ i, err := strconv.ParseInt(val, 10, 32)
if err != nil {
return FromString(val)
}
- return FromInt(i)
+ return FromInt32(int32(i))
}
// UnmarshalJSON implements the json.Unmarshaller interface.
@@ -87,6 +93,20 @@ func (intstr *IntOrString) UnmarshalJSON(value []byte) error {
return json.Unmarshal(value, &intstr.IntVal)
}
+func (intstr *IntOrString) UnmarshalCBOR(value []byte) error {
+ if err := cbor.Unmarshal(value, &intstr.StrVal); err == nil {
+ intstr.Type = String
+ return nil
+ }
+
+ if err := cbor.Unmarshal(value, &intstr.IntVal); err != nil {
+ return err
+ }
+
+ intstr.Type = Int
+ return nil
+}
+
// String returns the string value, or the Itoa of the int value.
func (intstr *IntOrString) String() string {
if intstr == nil {
@@ -121,6 +141,17 @@ func (intstr IntOrString) MarshalJSON() ([]byte, error) {
}
}
+func (intstr IntOrString) MarshalCBOR() ([]byte, error) {
+ switch intstr.Type {
+ case Int:
+ return cbor.Marshal(intstr.IntVal)
+ case String:
+ return cbor.Marshal(intstr.StrVal)
+ default:
+ return nil, fmt.Errorf("impossible IntOrString.Type")
+ }
+}
+
// OpenAPISchemaType is used by the kube-openapi generator when constructing
// the OpenAPI spec of this type.
//
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/endpoints.yaml b/vendor/k8s.io/apimachinery/pkg/util/managedfields/endpoints.yaml
new file mode 100644
index 000000000..a667e9834
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/endpoints.yaml
@@ -0,0 +1,7018 @@
+apiVersion: v1
+kind: Endpoints
+metadata:
+ creationTimestamp: '2016-10-04T17:45:58Z'
+ labels:
+ app: my-app
+ name: app-server
+ namespace: default
+ resourceVersion: '184597135'
+ selfLink: /self/link
+ uid: 6826f086-8a5a-11e6-8d09-42010a800005
+subsets:
+- addresses:
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0000
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0001
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0002
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0003
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0004
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0005
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0006
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0007
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0008
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0009
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0010
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0011
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0012
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0013
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0014
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0015
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0016
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0017
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0018
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0019
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0020
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0021
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0022
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0023
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0024
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0025
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0026
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0027
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0028
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0029
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0030
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0031
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0032
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0033
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0034
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0035
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0036
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0037
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0038
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0039
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0040
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0041
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0042
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0043
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0044
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0045
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0046
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0047
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0048
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0049
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0050
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0051
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0052
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0053
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0054
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0055
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0056
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0057
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0058
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0059
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0060
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0061
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0062
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0063
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0064
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0065
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0066
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0067
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0068
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0069
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0070
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0071
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0072
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0073
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0074
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0075
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0076
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0077
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0078
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0079
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0080
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0081
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0082
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0083
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0084
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0085
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0086
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0087
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0088
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0089
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0090
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0091
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0092
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0093
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0094
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0095
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0096
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0097
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0098
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0099
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0100
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0101
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0102
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0103
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0104
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0105
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0106
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0107
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0108
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0109
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0110
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0111
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0112
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0113
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0114
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0115
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0116
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0117
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0118
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0119
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0120
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0121
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0122
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0123
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0124
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0125
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0126
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0127
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0128
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0129
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0130
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0131
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0132
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0133
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0134
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0135
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0136
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0137
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0138
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0139
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0140
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0141
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0142
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0143
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0144
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0145
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0146
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0147
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0148
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0149
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0150
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0151
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0152
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0153
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0154
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0155
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0156
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0157
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0158
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0159
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0160
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0161
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0162
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0163
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0164
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0165
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0166
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0167
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0168
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0169
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0170
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0171
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0172
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0173
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0174
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0175
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0176
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0177
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0178
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0179
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0180
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0181
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0182
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0183
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0184
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0185
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0186
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0187
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0188
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0189
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0190
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0191
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0192
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0193
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0194
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0195
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0196
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0197
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0198
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0199
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0200
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0201
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0202
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0203
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0204
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0205
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0206
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0207
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0208
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0209
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0210
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0211
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0212
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0213
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0214
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0215
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0216
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0217
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0218
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0219
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0220
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0221
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0222
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0223
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0224
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0225
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0226
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0227
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0228
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0229
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0230
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0231
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0232
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0233
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0234
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0235
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0236
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0237
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0238
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0239
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0240
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0241
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0242
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0243
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0244
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0245
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0246
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0247
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0248
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0249
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0250
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0251
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0252
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0253
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0254
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0255
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0256
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0257
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0258
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0259
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0260
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0261
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0262
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0263
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0264
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0265
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0266
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0267
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0268
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0269
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0270
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0271
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0272
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0273
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0274
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0275
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0276
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0277
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0278
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0279
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0280
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0281
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0282
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0283
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0284
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0285
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0286
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0287
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0288
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0289
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0290
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0291
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0292
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0293
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0294
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0295
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0296
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0297
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0298
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0299
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0300
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0301
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0302
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0303
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0304
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0305
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0306
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0307
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0308
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0309
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0310
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0311
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0312
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0313
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0314
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0315
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0316
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0317
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0318
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0319
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0320
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0321
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0322
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0323
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0324
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0325
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0326
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0327
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0328
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0329
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0330
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0331
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0332
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0333
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0334
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0335
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0336
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0337
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0338
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0339
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0340
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0341
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0342
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0343
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0344
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0345
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0346
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0347
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0348
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0349
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0350
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0351
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0352
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0353
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0354
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0355
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0356
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0357
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0358
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0359
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0360
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0361
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0362
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0363
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0364
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0365
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0366
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0367
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0368
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0369
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0370
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0371
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0372
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0373
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0374
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0375
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0376
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0377
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0378
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0379
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0380
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0381
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0382
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0383
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0384
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0385
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0386
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0387
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0388
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0389
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0390
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0391
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0392
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0393
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0394
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0395
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0396
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0397
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0398
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0399
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0400
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0401
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0402
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0403
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0404
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0405
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0406
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0407
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0408
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0409
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0410
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0411
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0412
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0413
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0414
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0415
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0416
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0417
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0418
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0419
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0420
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0421
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0422
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0423
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0424
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0425
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0426
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0427
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0428
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0429
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0430
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0431
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0432
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0433
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0434
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0435
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0436
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0437
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0438
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0439
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0440
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0441
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0442
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0443
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0444
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0445
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0446
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0447
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0448
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0449
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0450
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0451
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0452
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0453
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0454
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0455
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0456
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0457
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0458
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0459
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0460
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0461
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0462
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0463
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0464
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0465
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0466
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0467
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0468
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0469
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0470
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0471
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0472
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0473
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0474
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0475
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0476
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0477
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0478
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0479
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0480
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0481
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0482
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0483
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0484
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0485
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0486
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0487
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0488
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0489
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0490
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0491
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0492
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0493
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0494
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0495
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0496
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0497
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0498
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0499
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0500
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0501
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0502
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0503
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0504
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0505
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0506
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0507
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0508
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0509
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0510
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0511
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0512
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0513
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0514
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0515
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0516
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0517
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0518
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0519
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0520
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0521
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0522
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0523
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0524
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0525
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0526
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0527
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0528
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0529
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0530
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0531
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0532
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0533
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0534
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0535
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0536
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0537
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0538
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0539
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0540
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0541
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0542
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0543
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0544
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0545
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0546
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0547
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0548
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0549
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0550
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0551
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0552
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0553
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0554
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0555
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0556
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0557
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0558
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0559
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0560
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0561
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0562
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0563
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0564
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0565
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0566
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0567
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0568
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0569
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0570
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0571
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0572
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0573
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0574
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0575
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0576
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0577
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0578
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0579
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0580
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0581
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0582
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0583
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0584
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0585
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0586
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0587
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0588
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0589
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0590
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0591
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0592
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0593
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0594
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0595
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0596
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0597
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0598
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0599
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0600
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0601
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0602
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0603
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0604
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0605
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0606
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0607
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0608
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0609
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0610
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0611
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0612
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0613
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0614
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0615
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0616
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0617
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0618
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0619
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0620
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0621
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0622
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0623
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0624
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0625
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0626
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0627
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0628
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0629
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0630
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0631
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0632
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0633
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0634
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0635
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0636
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0637
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0638
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0639
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0640
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0641
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0642
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0643
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0644
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0645
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0646
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0647
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0648
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0649
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0650
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0651
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0652
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0653
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0654
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0655
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0656
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0657
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0658
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0659
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0660
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0661
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0662
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0663
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0664
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0665
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0666
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0667
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0668
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0669
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0670
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0671
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0672
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0673
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0674
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0675
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0676
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0677
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0678
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0679
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0680
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0681
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0682
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0683
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0684
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0685
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0686
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0687
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0688
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0689
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0690
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0691
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0692
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0693
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0694
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0695
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0696
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0697
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0698
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0699
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0700
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0701
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0702
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0703
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0704
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0705
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0706
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0707
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0708
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0709
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0710
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0711
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0712
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0713
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0714
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0715
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0716
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0717
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0718
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0719
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0720
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0721
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0722
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0723
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0724
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0725
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0726
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0727
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0728
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0729
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0730
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0731
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0732
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0733
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0734
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0735
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0736
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0737
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0738
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0739
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0740
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0741
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0742
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0743
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0744
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0745
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0746
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0747
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0748
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0749
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0750
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0751
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0752
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0753
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0754
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0755
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0756
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0757
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0758
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0759
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0760
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0761
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0762
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0763
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0764
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0765
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0766
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0767
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0768
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0769
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0770
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0771
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0772
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0773
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0774
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0775
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0776
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0777
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0778
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0779
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0780
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0781
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0782
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0783
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0784
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0785
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0786
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0787
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0788
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0789
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0790
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0791
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0792
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0793
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0794
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0795
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0796
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0797
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0798
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0799
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0800
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0801
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0802
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0803
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0804
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0805
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0806
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0807
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0808
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0809
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0810
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0811
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0812
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0813
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0814
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0815
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0816
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0817
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0818
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0819
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0820
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0821
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0822
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0823
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0824
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0825
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0826
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0827
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0828
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0829
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0830
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0831
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0832
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0833
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0834
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0835
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0836
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0837
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0838
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0839
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0840
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0841
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0842
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0843
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0844
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0845
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0846
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0847
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0848
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0849
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0850
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0851
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0852
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0853
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0854
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0855
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0856
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0857
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0858
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0859
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0860
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0861
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0862
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0863
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0864
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0865
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0866
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0867
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0868
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0869
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0870
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0871
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0872
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0873
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0874
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0875
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0876
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0877
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0878
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0879
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0880
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0881
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0882
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0883
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0884
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0885
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0886
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0887
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0888
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0889
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0890
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0891
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0892
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0893
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0894
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0895
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0896
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0897
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0898
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0899
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0900
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0901
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0902
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0903
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0904
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0905
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0906
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0907
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0908
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0909
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0910
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0911
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0912
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0913
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0914
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0915
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0916
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0917
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0918
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0919
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0920
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0921
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0922
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0923
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0924
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0925
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0926
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0927
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0928
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0929
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0930
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0931
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0932
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0933
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0934
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0935
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0936
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0937
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0938
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0939
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0940
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0941
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0942
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0943
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0944
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0945
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0946
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0947
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0948
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0949
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0950
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0951
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0952
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0953
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0954
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0955
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0956
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0957
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0958
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0959
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0960
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0961
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0962
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0963
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0964
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0965
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0966
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0967
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0968
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0969
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0970
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0971
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0972
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0973
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0974
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0975
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0976
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0977
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0978
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0979
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0980
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0981
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0982
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0983
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0984
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0985
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0986
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0987
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0988
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0989
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0990
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0991
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0992
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0993
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0994
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0995
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0996
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0997
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0998
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ - ip: 10.0.0.1
+ targetRef:
+ kind: Pod
+ name: pod-name-1234-0999
+ namespace: default
+ resourceVersion: '1234567890'
+ uid: 11111111-2222-3333-4444-555555555555
+ ports:
+ - name: port-name
+ port: 8080
+ protocol: TCP
+
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/fieldmanager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/fieldmanager.go
new file mode 100644
index 000000000..978ffb3c3
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/fieldmanager.go
@@ -0,0 +1,57 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package managedfields
+
+import (
+ "fmt"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/util/managedfields/internal"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// FieldManager updates the managed fields and merges applied
+// configurations.
+type FieldManager = internal.FieldManager
+
+// NewDefaultFieldManager creates a new FieldManager that merges apply requests
+// and update managed fields for other types of requests.
+func NewDefaultFieldManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, objectCreater runtime.ObjectCreater, kind schema.GroupVersionKind, hub schema.GroupVersion, subresource string, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (*FieldManager, error) {
+ f, err := internal.NewStructuredMergeManager(typeConverter, objectConverter, objectDefaulter, kind.GroupVersion(), hub, resetFields)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create field manager: %v", err)
+ }
+ return internal.NewDefaultFieldManager(f, typeConverter, objectConverter, objectCreater, kind, subresource), nil
+}
+
+// NewDefaultCRDFieldManager creates a new FieldManager specifically for
+// CRDs. This allows for the possibility of fields which are not defined
+// in models, as well as having no models defined at all.
+func NewDefaultCRDFieldManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, objectCreater runtime.ObjectCreater, kind schema.GroupVersionKind, hub schema.GroupVersion, subresource string, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (_ *FieldManager, err error) {
+ f, err := internal.NewCRDStructuredMergeManager(typeConverter, objectConverter, objectDefaulter, kind.GroupVersion(), hub, resetFields)
+ if err != nil {
+ return nil, fmt.Errorf("failed to create field manager: %v", err)
+ }
+ return internal.NewDefaultFieldManager(f, typeConverter, objectConverter, objectCreater, kind, subresource), nil
+}
+
+func ValidateManagedFields(encodedManagedFields []metav1.ManagedFieldsEntry) error {
+ _, err := internal.DecodeManagedFields(encodedManagedFields)
+ return err
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/atmostevery.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/atmostevery.go
new file mode 100644
index 000000000..b75ef7416
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/atmostevery.go
@@ -0,0 +1,60 @@
+/*
+Copyright 2020 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "sync"
+ "time"
+)
+
+// AtMostEvery will never run the method more than once every specified
+// duration.
+type AtMostEvery struct {
+ delay time.Duration
+ lastCall time.Time
+ mutex sync.Mutex
+}
+
+// NewAtMostEvery creates a new AtMostEvery, that will run the method at
+// most every given duration.
+func NewAtMostEvery(delay time.Duration) *AtMostEvery {
+ return &AtMostEvery{
+ delay: delay,
+ }
+}
+
+// updateLastCall returns true if the lastCall time has been updated,
+// false if it was too early.
+func (s *AtMostEvery) updateLastCall() bool {
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
+ if time.Since(s.lastCall) < s.delay {
+ return false
+ }
+ s.lastCall = time.Now()
+ return true
+}
+
+// Do will run the method if enough time has passed, and return true.
+// Otherwise, it does nothing and returns false.
+func (s *AtMostEvery) Do(fn func()) bool {
+ if !s.updateLastCall() {
+ return false
+ }
+ fn()
+ return true
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/buildmanagerinfo.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/buildmanagerinfo.go
new file mode 100644
index 000000000..fa342ca13
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/buildmanagerinfo.go
@@ -0,0 +1,74 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+)
+
+type buildManagerInfoManager struct {
+ fieldManager Manager
+ groupVersion schema.GroupVersion
+ subresource string
+}
+
+var _ Manager = &buildManagerInfoManager{}
+
+// NewBuildManagerInfoManager creates a new Manager that converts the manager name into a unique identifier
+// combining operation and version for update requests, and just operation for apply requests.
+func NewBuildManagerInfoManager(f Manager, gv schema.GroupVersion, subresource string) Manager {
+ return &buildManagerInfoManager{
+ fieldManager: f,
+ groupVersion: gv,
+ subresource: subresource,
+ }
+}
+
+// Update implements Manager.
+func (f *buildManagerInfoManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ manager, err := f.buildManagerInfo(manager, metav1.ManagedFieldsOperationUpdate)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to build manager identifier: %v", err)
+ }
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// Apply implements Manager.
+func (f *buildManagerInfoManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ manager, err := f.buildManagerInfo(manager, metav1.ManagedFieldsOperationApply)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to build manager identifier: %v", err)
+ }
+ return f.fieldManager.Apply(liveObj, appliedObj, managed, manager, force)
+}
+
+func (f *buildManagerInfoManager) buildManagerInfo(prefix string, operation metav1.ManagedFieldsOperationType) (string, error) {
+ managerInfo := metav1.ManagedFieldsEntry{
+ Manager: prefix,
+ Operation: operation,
+ APIVersion: f.groupVersion.String(),
+ Subresource: f.subresource,
+ }
+ if managerInfo.Manager == "" {
+ managerInfo.Manager = "unknown"
+ }
+ return BuildManagerIdentifier(&managerInfo)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/capmanagers.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/capmanagers.go
new file mode 100644
index 000000000..8951932ba
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/capmanagers.go
@@ -0,0 +1,133 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+ "sort"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+type capManagersManager struct {
+ fieldManager Manager
+ maxUpdateManagers int
+ oldUpdatesManagerName string
+}
+
+var _ Manager = &capManagersManager{}
+
+// NewCapManagersManager creates a new wrapped FieldManager which ensures that the number of managers from updates
+// does not exceed maxUpdateManagers, by merging some of the oldest entries on each update.
+func NewCapManagersManager(fieldManager Manager, maxUpdateManagers int) Manager {
+ return &capManagersManager{
+ fieldManager: fieldManager,
+ maxUpdateManagers: maxUpdateManagers,
+ oldUpdatesManagerName: "ancient-changes",
+ }
+}
+
+// Update implements Manager.
+func (f *capManagersManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ object, managed, err := f.fieldManager.Update(liveObj, newObj, managed, manager)
+ if err != nil {
+ return object, managed, err
+ }
+ if managed, err = f.capUpdateManagers(managed); err != nil {
+ return nil, nil, fmt.Errorf("failed to cap update managers: %v", err)
+ }
+ return object, managed, nil
+}
+
+// Apply implements Manager.
+func (f *capManagersManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error) {
+ return f.fieldManager.Apply(liveObj, appliedObj, managed, fieldManager, force)
+}
+
+// capUpdateManagers merges a number of the oldest update entries into versioned buckets,
+// such that the number of entries from updates does not exceed f.maxUpdateManagers.
+func (f *capManagersManager) capUpdateManagers(managed Managed) (newManaged Managed, err error) {
+ // Gather all entries from updates
+ updaters := []string{}
+ for manager, fields := range managed.Fields() {
+ if !fields.Applied() {
+ updaters = append(updaters, manager)
+ }
+ }
+ if len(updaters) <= f.maxUpdateManagers {
+ return managed, nil
+ }
+
+ // If we have more than the maximum, sort the update entries by time, oldest first.
+ sort.Slice(updaters, func(i, j int) bool {
+ iTime, jTime, iSeconds, jSeconds := managed.Times()[updaters[i]], managed.Times()[updaters[j]], int64(0), int64(0)
+ if iTime != nil {
+ iSeconds = iTime.Unix()
+ }
+ if jTime != nil {
+ jSeconds = jTime.Unix()
+ }
+ if iSeconds != jSeconds {
+ return iSeconds < jSeconds
+ }
+ return updaters[i] < updaters[j]
+ })
+
+ // Merge the oldest updaters with versioned bucket managers until the number of updaters is under the cap
+ versionToFirstManager := map[string]string{}
+ for i, length := 0, len(updaters); i < len(updaters) && length > f.maxUpdateManagers; i++ {
+ manager := updaters[i]
+ vs := managed.Fields()[manager]
+ time := managed.Times()[manager]
+ version := string(vs.APIVersion())
+
+ // Create a new manager identifier for the versioned bucket entry.
+ // The version for this manager comes from the version of the update being merged into the bucket.
+ bucket, err := BuildManagerIdentifier(&metav1.ManagedFieldsEntry{
+ Manager: f.oldUpdatesManagerName,
+ Operation: metav1.ManagedFieldsOperationUpdate,
+ APIVersion: version,
+ })
+ if err != nil {
+ return managed, fmt.Errorf("failed to create bucket manager for version %v: %v", version, err)
+ }
+
+ // Merge the fieldets if this is not the first time the version was seen.
+ // Otherwise just record the manager name in versionToFirstManager
+ if first, ok := versionToFirstManager[version]; ok {
+ // If the bucket doesn't exists yet, create one.
+ if _, ok := managed.Fields()[bucket]; !ok {
+ s := managed.Fields()[first]
+ delete(managed.Fields(), first)
+ managed.Fields()[bucket] = s
+ }
+
+ managed.Fields()[bucket] = fieldpath.NewVersionedSet(vs.Set().Union(managed.Fields()[bucket].Set()), vs.APIVersion(), vs.Applied())
+ delete(managed.Fields(), manager)
+ length--
+
+ // Use the time from the update being merged into the bucket, since it is more recent.
+ managed.Times()[bucket] = time
+ } else {
+ versionToFirstManager[version] = manager
+ }
+ }
+
+ return managed, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/conflict.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/conflict.go
new file mode 100644
index 000000000..8c044c915
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/conflict.go
@@ -0,0 +1,89 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+ "strings"
+ "time"
+
+ "k8s.io/apimachinery/pkg/api/errors"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+)
+
+// NewConflictError returns an error including details on the requests apply conflicts
+func NewConflictError(conflicts merge.Conflicts) *errors.StatusError {
+ causes := []metav1.StatusCause{}
+ for _, conflict := range conflicts {
+ causes = append(causes, metav1.StatusCause{
+ Type: metav1.CauseTypeFieldManagerConflict,
+ Message: fmt.Sprintf("conflict with %v", printManager(conflict.Manager)),
+ Field: conflict.Path.String(),
+ })
+ }
+ return errors.NewApplyConflict(causes, getConflictMessage(conflicts))
+}
+
+func getConflictMessage(conflicts merge.Conflicts) string {
+ if len(conflicts) == 1 {
+ return fmt.Sprintf("Apply failed with 1 conflict: conflict with %v: %v", printManager(conflicts[0].Manager), conflicts[0].Path)
+ }
+
+ m := map[string][]fieldpath.Path{}
+ for _, conflict := range conflicts {
+ m[conflict.Manager] = append(m[conflict.Manager], conflict.Path)
+ }
+
+ uniqueManagers := []string{}
+ for manager := range m {
+ uniqueManagers = append(uniqueManagers, manager)
+ }
+
+ // Print conflicts by sorted managers.
+ sort.Strings(uniqueManagers)
+
+ messages := []string{}
+ for _, manager := range uniqueManagers {
+ messages = append(messages, fmt.Sprintf("conflicts with %v:", printManager(manager)))
+ for _, path := range m[manager] {
+ messages = append(messages, fmt.Sprintf("- %v", path))
+ }
+ }
+ return fmt.Sprintf("Apply failed with %d conflicts: %s", len(conflicts), strings.Join(messages, "\n"))
+}
+
+func printManager(manager string) string {
+ encodedManager := &metav1.ManagedFieldsEntry{}
+ if err := json.Unmarshal([]byte(manager), encodedManager); err != nil {
+ return fmt.Sprintf("%q", manager)
+ }
+ managerStr := fmt.Sprintf("%q", encodedManager.Manager)
+ if encodedManager.Subresource != "" {
+ managerStr = fmt.Sprintf("%s with subresource %q", managerStr, encodedManager.Subresource)
+ }
+ if encodedManager.Operation == metav1.ManagedFieldsOperationUpdate {
+ if encodedManager.Time == nil {
+ return fmt.Sprintf("%s using %v", managerStr, encodedManager.APIVersion)
+ }
+ return fmt.Sprintf("%s using %v at %v", managerStr, encodedManager.APIVersion, encodedManager.Time.UTC().Format(time.RFC3339))
+ }
+ return managerStr
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go
new file mode 100644
index 000000000..eca04a711
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fieldmanager.go
@@ -0,0 +1,209 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+ "reflect"
+ "time"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/klog/v2"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+)
+
+// DefaultMaxUpdateManagers defines the default maximum retained number of managedFields entries from updates
+// if the number of update managers exceeds this, the oldest entries will be merged until the number is below the maximum.
+// TODO(jennybuckley): Determine if this is really the best value. Ideally we wouldn't unnecessarily merge too many entries.
+const DefaultMaxUpdateManagers int = 10
+
+// DefaultTrackOnCreateProbability defines the default probability that the field management of an object
+// starts being tracked from the object's creation, instead of from the first time the object is applied to.
+const DefaultTrackOnCreateProbability float32 = 1
+
+var atMostEverySecond = NewAtMostEvery(time.Second)
+
+// FieldManager updates the managed fields and merges applied
+// configurations.
+type FieldManager struct {
+ fieldManager Manager
+ subresource string
+}
+
+// NewFieldManager creates a new FieldManager that decodes, manages, then re-encodes managedFields
+// on update and apply requests.
+func NewFieldManager(f Manager, subresource string) *FieldManager {
+ return &FieldManager{fieldManager: f, subresource: subresource}
+}
+
+// newDefaultFieldManager is a helper function which wraps a Manager with certain default logic.
+func NewDefaultFieldManager(f Manager, typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectCreater runtime.ObjectCreater, kind schema.GroupVersionKind, subresource string) *FieldManager {
+ return NewFieldManager(
+ NewVersionCheckManager(
+ NewLastAppliedUpdater(
+ NewLastAppliedManager(
+ NewProbabilisticSkipNonAppliedManager(
+ NewCapManagersManager(
+ NewBuildManagerInfoManager(
+ NewManagedFieldsUpdater(
+ NewStripMetaManager(f),
+ ), kind.GroupVersion(), subresource,
+ ), DefaultMaxUpdateManagers,
+ ), objectCreater, DefaultTrackOnCreateProbability,
+ ), typeConverter, objectConverter, kind.GroupVersion(),
+ ),
+ ), kind,
+ ), subresource,
+ )
+}
+
+func decodeLiveOrNew(liveObj, newObj runtime.Object, ignoreManagedFieldsFromRequestObject bool) (Managed, error) {
+ liveAccessor, err := meta.Accessor(liveObj)
+ if err != nil {
+ return nil, err
+ }
+
+ // We take the managedFields of the live object in case the request tries to
+ // manually set managedFields via a subresource.
+ if ignoreManagedFieldsFromRequestObject {
+ return emptyManagedFieldsOnErr(DecodeManagedFields(liveAccessor.GetManagedFields()))
+ }
+
+ // If the object doesn't have metadata, we should just return without trying to
+ // set the managedFields at all, so creates/updates/patches will work normally.
+ newAccessor, err := meta.Accessor(newObj)
+ if err != nil {
+ return nil, err
+ }
+
+ if isResetManagedFields(newAccessor.GetManagedFields()) {
+ return NewEmptyManaged(), nil
+ }
+
+ // If the managed field is empty or we failed to decode it,
+ // let's try the live object. This is to prevent clients who
+ // don't understand managedFields from deleting it accidentally.
+ managed, err := DecodeManagedFields(newAccessor.GetManagedFields())
+ if err != nil || len(managed.Fields()) == 0 {
+ return emptyManagedFieldsOnErr(DecodeManagedFields(liveAccessor.GetManagedFields()))
+ }
+ return managed, nil
+}
+
+func emptyManagedFieldsOnErr(managed Managed, err error) (Managed, error) {
+ if err != nil {
+ return NewEmptyManaged(), nil
+ }
+ return managed, nil
+}
+
+// Update is used when the object has already been merged (non-apply
+// use-case), and simply updates the managed fields in the output
+// object.
+func (f *FieldManager) Update(liveObj, newObj runtime.Object, manager string) (object runtime.Object, err error) {
+ // First try to decode the managed fields provided in the update,
+ // This is necessary to allow directly updating managed fields.
+ isSubresource := f.subresource != ""
+ managed, err := decodeLiveOrNew(liveObj, newObj, isSubresource)
+ if err != nil {
+ return newObj, nil
+ }
+
+ RemoveObjectManagedFields(newObj)
+
+ if object, managed, err = f.fieldManager.Update(liveObj, newObj, managed, manager); err != nil {
+ return nil, err
+ }
+
+ if err = EncodeObjectManagedFields(object, managed); err != nil {
+ return nil, fmt.Errorf("failed to encode managed fields: %v", err)
+ }
+
+ return object, nil
+}
+
+// UpdateNoErrors is the same as Update, but it will not return
+// errors. If an error happens, the object is returned with
+// managedFields cleared.
+func (f *FieldManager) UpdateNoErrors(liveObj, newObj runtime.Object, manager string) runtime.Object {
+ obj, err := f.Update(liveObj, newObj, manager)
+ if err != nil {
+ atMostEverySecond.Do(func() {
+ ns, name := "unknown", "unknown"
+ if accessor, err := meta.Accessor(newObj); err == nil {
+ ns = accessor.GetNamespace()
+ name = accessor.GetName()
+ }
+
+ klog.ErrorS(err, "[SHOULD NOT HAPPEN] failed to update managedFields", "versionKind",
+ newObj.GetObjectKind().GroupVersionKind(), "namespace", ns, "name", name)
+ })
+ // Explicitly remove managedFields on failure, so that
+ // we can't have garbage in it.
+ RemoveObjectManagedFields(newObj)
+ return newObj
+ }
+ return obj
+}
+
+// Returns true if the managedFields indicate that the user is trying to
+// reset the managedFields, i.e. if the list is non-nil but empty, or if
+// the list has one empty item.
+func isResetManagedFields(managedFields []metav1.ManagedFieldsEntry) bool {
+ if len(managedFields) == 0 {
+ return managedFields != nil
+ }
+
+ if len(managedFields) == 1 {
+ return reflect.DeepEqual(managedFields[0], metav1.ManagedFieldsEntry{})
+ }
+
+ return false
+}
+
+// Apply is used when server-side apply is called, as it merges the
+// object and updates the managed fields.
+func (f *FieldManager) Apply(liveObj, appliedObj runtime.Object, manager string, force bool) (object runtime.Object, err error) {
+ // If the object doesn't have metadata, apply isn't allowed.
+ accessor, err := meta.Accessor(liveObj)
+ if err != nil {
+ return nil, fmt.Errorf("couldn't get accessor: %v", err)
+ }
+
+ // Decode the managed fields in the live object, since it isn't allowed in the patch.
+ managed, err := DecodeManagedFields(accessor.GetManagedFields())
+ if err != nil {
+ return nil, fmt.Errorf("failed to decode managed fields: %v", err)
+ }
+
+ object, managed, err = f.fieldManager.Apply(liveObj, appliedObj, managed, manager, force)
+ if err != nil {
+ if conflicts, ok := err.(merge.Conflicts); ok {
+ return nil, NewConflictError(conflicts)
+ }
+ return nil, err
+ }
+
+ if err = EncodeObjectManagedFields(object, managed); err != nil {
+ return nil, fmt.Errorf("failed to encode managed fields: %v", err)
+ }
+
+ return object, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go
new file mode 100644
index 000000000..08186191a
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go
@@ -0,0 +1,47 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "bytes"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// EmptyFields represents a set with no paths
+// It looks like metav1.Fields{Raw: []byte("{}")}
+var EmptyFields = func() metav1.FieldsV1 {
+ f, err := SetToFields(*fieldpath.NewSet())
+ if err != nil {
+ panic("should never happen")
+ }
+ return f
+}()
+
+// FieldsToSet creates a set paths from an input trie of fields
+func FieldsToSet(f metav1.FieldsV1) (s fieldpath.Set, err error) {
+ err = s.FromJSON(bytes.NewReader(f.Raw))
+ return s, err
+}
+
+// SetToFields creates a trie of fields from an input set of paths
+func SetToFields(s fieldpath.Set) (f metav1.FieldsV1, err error) {
+ f.Raw, err = s.ToJSON()
+ return f, err
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastapplied.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastapplied.go
new file mode 100644
index 000000000..b00b6b829
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastapplied.go
@@ -0,0 +1,50 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+// LastAppliedConfigAnnotation is the annotation used to store the previous
+// configuration of a resource for use in a three way diff by UpdateApplyAnnotation.
+//
+// This is a copy of the corev1 annotation since we don't want to depend on the whole package.
+const LastAppliedConfigAnnotation = "kubectl.kubernetes.io/last-applied-configuration"
+
+// SetLastApplied sets the last-applied annotation the given value in
+// the object.
+func SetLastApplied(obj runtime.Object, value string) error {
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+ var annotations = accessor.GetAnnotations()
+ if annotations == nil {
+ annotations = map[string]string{}
+ }
+ annotations[LastAppliedConfigAnnotation] = value
+ if err := apimachineryvalidation.ValidateAnnotationsSize(annotations); err != nil {
+ delete(annotations, LastAppliedConfigAnnotation)
+ }
+ accessor.SetAnnotations(annotations)
+ return nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedmanager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedmanager.go
new file mode 100644
index 000000000..3f6cf8821
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedmanager.go
@@ -0,0 +1,171 @@
+/*
+Copyright 2020 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "encoding/json"
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+)
+
+type lastAppliedManager struct {
+ fieldManager Manager
+ typeConverter TypeConverter
+ objectConverter runtime.ObjectConvertor
+ groupVersion schema.GroupVersion
+}
+
+var _ Manager = &lastAppliedManager{}
+
+// NewLastAppliedManager converts the client-side apply annotation to
+// server-side apply managed fields
+func NewLastAppliedManager(fieldManager Manager, typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, groupVersion schema.GroupVersion) Manager {
+ return &lastAppliedManager{
+ fieldManager: fieldManager,
+ typeConverter: typeConverter,
+ objectConverter: objectConverter,
+ groupVersion: groupVersion,
+ }
+}
+
+// Update implements Manager.
+func (f *lastAppliedManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// Apply will consider the last-applied annotation
+// for upgrading an object managed by client-side apply to server-side apply
+// without conflicts.
+func (f *lastAppliedManager) Apply(liveObj, newObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ newLiveObj, newManaged, newErr := f.fieldManager.Apply(liveObj, newObj, managed, manager, force)
+ // Upgrade the client-side apply annotation only from kubectl server-side-apply.
+ // To opt-out of this behavior, users may specify a different field manager.
+ if manager != "kubectl" {
+ return newLiveObj, newManaged, newErr
+ }
+
+ // Check if we have conflicts
+ if newErr == nil {
+ return newLiveObj, newManaged, newErr
+ }
+ conflicts, ok := newErr.(merge.Conflicts)
+ if !ok {
+ return newLiveObj, newManaged, newErr
+ }
+ conflictSet := conflictsToSet(conflicts)
+
+ // Check if conflicts are allowed due to client-side apply,
+ // and if so, then force apply
+ allowedConflictSet, err := f.allowedConflictsFromLastApplied(liveObj)
+ if err != nil {
+ return newLiveObj, newManaged, newErr
+ }
+ if !conflictSet.Difference(allowedConflictSet).Empty() {
+ newConflicts := conflictsDifference(conflicts, allowedConflictSet)
+ return newLiveObj, newManaged, newConflicts
+ }
+
+ return f.fieldManager.Apply(liveObj, newObj, managed, manager, true)
+}
+
+func (f *lastAppliedManager) allowedConflictsFromLastApplied(liveObj runtime.Object) (*fieldpath.Set, error) {
+ var accessor, err = meta.Accessor(liveObj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+
+ // If there is no client-side apply annotation, then there is nothing to do
+ var annotations = accessor.GetAnnotations()
+ if annotations == nil {
+ return nil, fmt.Errorf("no last applied annotation")
+ }
+ var lastApplied, ok = annotations[LastAppliedConfigAnnotation]
+ if !ok || lastApplied == "" {
+ return nil, fmt.Errorf("no last applied annotation")
+ }
+
+ liveObjVersioned, err := f.objectConverter.ConvertToVersion(liveObj, f.groupVersion)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert live obj to versioned: %v", err)
+ }
+
+ liveObjTyped, err := f.typeConverter.ObjectToTyped(liveObjVersioned)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert live obj to typed: %v", err)
+ }
+
+ var lastAppliedObj = &unstructured.Unstructured{Object: map[string]interface{}{}}
+ err = json.Unmarshal([]byte(lastApplied), lastAppliedObj)
+ if err != nil {
+ return nil, fmt.Errorf("failed to decode last applied obj: %v in '%s'", err, lastApplied)
+ }
+
+ if lastAppliedObj.GetAPIVersion() != f.groupVersion.String() {
+ return nil, fmt.Errorf("expected version of last applied to match live object '%s', but got '%s': %v", f.groupVersion.String(), lastAppliedObj.GetAPIVersion(), err)
+ }
+
+ lastAppliedObjTyped, err := f.typeConverter.ObjectToTyped(lastAppliedObj)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert last applied to typed: %v", err)
+ }
+
+ lastAppliedObjFieldSet, err := lastAppliedObjTyped.ToFieldSet()
+ if err != nil {
+ return nil, fmt.Errorf("failed to create fieldset for last applied object: %v", err)
+ }
+
+ comparison, err := lastAppliedObjTyped.Compare(liveObjTyped)
+ if err != nil {
+ return nil, fmt.Errorf("failed to compare last applied object and live object: %v", err)
+ }
+
+ // Remove fields in last applied that are different, added, or missing in
+ // the live object.
+ // Because last-applied fields don't match the live object fields,
+ // then we don't own these fields.
+ lastAppliedObjFieldSet = lastAppliedObjFieldSet.
+ Difference(comparison.Modified).
+ Difference(comparison.Added).
+ Difference(comparison.Removed)
+
+ return lastAppliedObjFieldSet, nil
+}
+
+// TODO: replace with merge.Conflicts.ToSet()
+func conflictsToSet(conflicts merge.Conflicts) *fieldpath.Set {
+ conflictSet := fieldpath.NewSet()
+ for _, conflict := range []merge.Conflict(conflicts) {
+ conflictSet.Insert(conflict.Path)
+ }
+ return conflictSet
+}
+
+func conflictsDifference(conflicts merge.Conflicts, s *fieldpath.Set) merge.Conflicts {
+ newConflicts := []merge.Conflict{}
+ for _, conflict := range []merge.Conflict(conflicts) {
+ if !s.Has(conflict.Path) {
+ newConflicts = append(newConflicts, conflict)
+ }
+ }
+ return newConflicts
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedupdater.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedupdater.go
new file mode 100644
index 000000000..06e6c5d8c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/lastappliedupdater.go
@@ -0,0 +1,102 @@
+/*
+Copyright 2020 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+type lastAppliedUpdater struct {
+ fieldManager Manager
+}
+
+var _ Manager = &lastAppliedUpdater{}
+
+// NewLastAppliedUpdater sets the client-side apply annotation up to date with
+// server-side apply managed fields
+func NewLastAppliedUpdater(fieldManager Manager) Manager {
+ return &lastAppliedUpdater{
+ fieldManager: fieldManager,
+ }
+}
+
+// Update implements Manager.
+func (f *lastAppliedUpdater) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// server-side apply managed fields
+func (f *lastAppliedUpdater) Apply(liveObj, newObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ liveObj, managed, err := f.fieldManager.Apply(liveObj, newObj, managed, manager, force)
+ if err != nil {
+ return liveObj, managed, err
+ }
+
+ // Sync the client-side apply annotation only from kubectl server-side apply.
+ // To opt-out of this behavior, users may specify a different field manager.
+ //
+ // If the client-side apply annotation doesn't exist,
+ // then continue because we have no annotation to update
+ if manager == "kubectl" && hasLastApplied(liveObj) {
+ lastAppliedValue, err := buildLastApplied(newObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to build last-applied annotation: %v", err)
+ }
+ err = SetLastApplied(liveObj, lastAppliedValue)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to set last-applied annotation: %v", err)
+ }
+ }
+ return liveObj, managed, err
+}
+
+func hasLastApplied(obj runtime.Object) bool {
+ var accessor, err = meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+ var annotations = accessor.GetAnnotations()
+ if annotations == nil {
+ return false
+ }
+ lastApplied, ok := annotations[LastAppliedConfigAnnotation]
+ return ok && len(lastApplied) > 0
+}
+
+func buildLastApplied(obj runtime.Object) (string, error) {
+ obj = obj.DeepCopyObject()
+
+ var accessor, err = meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+
+ // Remove the annotation from the object before encoding the object
+ var annotations = accessor.GetAnnotations()
+ delete(annotations, LastAppliedConfigAnnotation)
+ accessor.SetAnnotations(annotations)
+
+ lastApplied, err := runtime.Encode(unstructured.UnstructuredJSONScheme, obj)
+ if err != nil {
+ return "", fmt.Errorf("couldn't encode object into last applied annotation: %v", err)
+ }
+ return string(lastApplied), nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfields.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfields.go
new file mode 100644
index 000000000..9b4c20326
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfields.go
@@ -0,0 +1,248 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "encoding/json"
+ "fmt"
+ "sort"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// ManagedInterface groups a fieldpath.ManagedFields together with the timestamps associated with each operation.
+type ManagedInterface interface {
+ // Fields gets the fieldpath.ManagedFields.
+ Fields() fieldpath.ManagedFields
+
+ // Times gets the timestamps associated with each operation.
+ Times() map[string]*metav1.Time
+}
+
+type managedStruct struct {
+ fields fieldpath.ManagedFields
+ times map[string]*metav1.Time
+}
+
+var _ ManagedInterface = &managedStruct{}
+
+// Fields implements ManagedInterface.
+func (m *managedStruct) Fields() fieldpath.ManagedFields {
+ return m.fields
+}
+
+// Times implements ManagedInterface.
+func (m *managedStruct) Times() map[string]*metav1.Time {
+ return m.times
+}
+
+// NewEmptyManaged creates an empty ManagedInterface.
+func NewEmptyManaged() ManagedInterface {
+ return NewManaged(fieldpath.ManagedFields{}, map[string]*metav1.Time{})
+}
+
+// NewManaged creates a ManagedInterface from a fieldpath.ManagedFields and the timestamps associated with each operation.
+func NewManaged(f fieldpath.ManagedFields, t map[string]*metav1.Time) ManagedInterface {
+ return &managedStruct{
+ fields: f,
+ times: t,
+ }
+}
+
+// RemoveObjectManagedFields removes the ManagedFields from the object
+// before we merge so that it doesn't appear in the ManagedFields
+// recursively.
+func RemoveObjectManagedFields(obj runtime.Object) {
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+ accessor.SetManagedFields(nil)
+}
+
+// EncodeObjectManagedFields converts and stores the fieldpathManagedFields into the objects ManagedFields
+func EncodeObjectManagedFields(obj runtime.Object, managed ManagedInterface) error {
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+
+ encodedManagedFields, err := encodeManagedFields(managed)
+ if err != nil {
+ return fmt.Errorf("failed to convert back managed fields to API: %v", err)
+ }
+ accessor.SetManagedFields(encodedManagedFields)
+
+ return nil
+}
+
+// DecodeManagedFields converts ManagedFields from the wire format (api format)
+// to the format used by sigs.k8s.io/structured-merge-diff
+func DecodeManagedFields(encodedManagedFields []metav1.ManagedFieldsEntry) (ManagedInterface, error) {
+ managed := managedStruct{}
+ managed.fields = make(fieldpath.ManagedFields, len(encodedManagedFields))
+ managed.times = make(map[string]*metav1.Time, len(encodedManagedFields))
+
+ for i, encodedVersionedSet := range encodedManagedFields {
+ switch encodedVersionedSet.Operation {
+ case metav1.ManagedFieldsOperationApply, metav1.ManagedFieldsOperationUpdate:
+ default:
+ return nil, fmt.Errorf("operation must be `Apply` or `Update`")
+ }
+ if len(encodedVersionedSet.APIVersion) < 1 {
+ return nil, fmt.Errorf("apiVersion must not be empty")
+ }
+ switch encodedVersionedSet.FieldsType {
+ case "FieldsV1":
+ // Valid case.
+ case "":
+ return nil, fmt.Errorf("missing fieldsType in managed fields entry %d", i)
+ default:
+ return nil, fmt.Errorf("invalid fieldsType %q in managed fields entry %d", encodedVersionedSet.FieldsType, i)
+ }
+ manager, err := BuildManagerIdentifier(&encodedVersionedSet)
+ if err != nil {
+ return nil, fmt.Errorf("error decoding manager from %v: %v", encodedVersionedSet, err)
+ }
+ managed.fields[manager], err = decodeVersionedSet(&encodedVersionedSet)
+ if err != nil {
+ return nil, fmt.Errorf("error decoding versioned set from %v: %v", encodedVersionedSet, err)
+ }
+ managed.times[manager] = encodedVersionedSet.Time
+ }
+ return &managed, nil
+}
+
+// BuildManagerIdentifier creates a manager identifier string from a ManagedFieldsEntry
+func BuildManagerIdentifier(encodedManager *metav1.ManagedFieldsEntry) (manager string, err error) {
+ encodedManagerCopy := *encodedManager
+
+ // Never include fields type in the manager identifier
+ encodedManagerCopy.FieldsType = ""
+
+ // Never include the fields in the manager identifier
+ encodedManagerCopy.FieldsV1 = nil
+
+ // Never include the time in the manager identifier
+ encodedManagerCopy.Time = nil
+
+ // For appliers, don't include the APIVersion in the manager identifier,
+ // so it will always have the same manager identifier each time it applied.
+ if encodedManager.Operation == metav1.ManagedFieldsOperationApply {
+ encodedManagerCopy.APIVersion = ""
+ }
+
+ // Use the remaining fields to build the manager identifier
+ b, err := json.Marshal(&encodedManagerCopy)
+ if err != nil {
+ return "", fmt.Errorf("error marshalling manager identifier: %v", err)
+ }
+
+ return string(b), nil
+}
+
+func decodeVersionedSet(encodedVersionedSet *metav1.ManagedFieldsEntry) (versionedSet fieldpath.VersionedSet, err error) {
+ fields := EmptyFields
+ if encodedVersionedSet.FieldsV1 != nil {
+ fields = *encodedVersionedSet.FieldsV1
+ }
+ set, err := FieldsToSet(fields)
+ if err != nil {
+ return nil, fmt.Errorf("error decoding set: %v", err)
+ }
+ return fieldpath.NewVersionedSet(&set, fieldpath.APIVersion(encodedVersionedSet.APIVersion), encodedVersionedSet.Operation == metav1.ManagedFieldsOperationApply), nil
+}
+
+// encodeManagedFields converts ManagedFields from the format used by
+// sigs.k8s.io/structured-merge-diff to the wire format (api format)
+func encodeManagedFields(managed ManagedInterface) (encodedManagedFields []metav1.ManagedFieldsEntry, err error) {
+ if len(managed.Fields()) == 0 {
+ return nil, nil
+ }
+ encodedManagedFields = []metav1.ManagedFieldsEntry{}
+ for manager := range managed.Fields() {
+ versionedSet := managed.Fields()[manager]
+ v, err := encodeManagerVersionedSet(manager, versionedSet)
+ if err != nil {
+ return nil, fmt.Errorf("error encoding versioned set for %v: %v", manager, err)
+ }
+ if t, ok := managed.Times()[manager]; ok {
+ v.Time = t
+ }
+ encodedManagedFields = append(encodedManagedFields, *v)
+ }
+ return sortEncodedManagedFields(encodedManagedFields)
+}
+
+func sortEncodedManagedFields(encodedManagedFields []metav1.ManagedFieldsEntry) (sortedManagedFields []metav1.ManagedFieldsEntry, err error) {
+ sort.Slice(encodedManagedFields, func(i, j int) bool {
+ p, q := encodedManagedFields[i], encodedManagedFields[j]
+
+ if p.Operation != q.Operation {
+ return p.Operation < q.Operation
+ }
+
+ pSeconds, qSeconds := int64(0), int64(0)
+ if p.Time != nil {
+ pSeconds = p.Time.Unix()
+ }
+ if q.Time != nil {
+ qSeconds = q.Time.Unix()
+ }
+ if pSeconds != qSeconds {
+ return pSeconds < qSeconds
+ }
+
+ if p.Manager != q.Manager {
+ return p.Manager < q.Manager
+ }
+
+ if p.APIVersion != q.APIVersion {
+ return p.APIVersion < q.APIVersion
+ }
+ return p.Subresource < q.Subresource
+ })
+
+ return encodedManagedFields, nil
+}
+
+func encodeManagerVersionedSet(manager string, versionedSet fieldpath.VersionedSet) (encodedVersionedSet *metav1.ManagedFieldsEntry, err error) {
+ encodedVersionedSet = &metav1.ManagedFieldsEntry{}
+
+ // Get as many fields as we can from the manager identifier
+ err = json.Unmarshal([]byte(manager), encodedVersionedSet)
+ if err != nil {
+ return nil, fmt.Errorf("error unmarshalling manager identifier %v: %v", manager, err)
+ }
+
+ // Get the APIVersion, Operation, and Fields from the VersionedSet
+ encodedVersionedSet.APIVersion = string(versionedSet.APIVersion())
+ if versionedSet.Applied() {
+ encodedVersionedSet.Operation = metav1.ManagedFieldsOperationApply
+ }
+ encodedVersionedSet.FieldsType = "FieldsV1"
+ fields, err := SetToFields(*versionedSet.Set())
+ if err != nil {
+ return nil, fmt.Errorf("error encoding set: %v", err)
+ }
+ encodedVersionedSet.FieldsV1 = &fields
+
+ return encodedVersionedSet, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfieldsupdater.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfieldsupdater.go
new file mode 100644
index 000000000..376eed6b2
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/managedfieldsupdater.go
@@ -0,0 +1,82 @@
+/*
+Copyright 2020 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "time"
+
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+type managedFieldsUpdater struct {
+ fieldManager Manager
+}
+
+var _ Manager = &managedFieldsUpdater{}
+
+// NewManagedFieldsUpdater is responsible for updating the managedfields
+// in the object, updating the time of the operation as necessary. For
+// updates, it uses a hard-coded manager to detect if things have
+// changed, and swaps back the correct manager after the operation is
+// done.
+func NewManagedFieldsUpdater(fieldManager Manager) Manager {
+ return &managedFieldsUpdater{
+ fieldManager: fieldManager,
+ }
+}
+
+// Update implements Manager.
+func (f *managedFieldsUpdater) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ self := "current-operation"
+ object, managed, err := f.fieldManager.Update(liveObj, newObj, managed, self)
+ if err != nil {
+ return object, managed, err
+ }
+
+ // If the current operation took any fields from anything, it means the object changed,
+ // so update the timestamp of the managedFieldsEntry and merge with any previous updates from the same manager
+ if vs, ok := managed.Fields()[self]; ok {
+ delete(managed.Fields(), self)
+
+ if previous, ok := managed.Fields()[manager]; ok {
+ managed.Fields()[manager] = fieldpath.NewVersionedSet(vs.Set().Union(previous.Set()), vs.APIVersion(), vs.Applied())
+ } else {
+ managed.Fields()[manager] = vs
+ }
+
+ managed.Times()[manager] = &metav1.Time{Time: time.Now().UTC()}
+ }
+
+ return object, managed, nil
+}
+
+// Apply implements Manager.
+func (f *managedFieldsUpdater) Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error) {
+ object, managed, err := f.fieldManager.Apply(liveObj, appliedObj, managed, fieldManager, force)
+ if err != nil {
+ return object, managed, err
+ }
+ if object != nil {
+ managed.Times()[fieldManager] = &metav1.Time{Time: time.Now().UTC()}
+ } else {
+ object = liveObj.DeepCopyObject()
+ RemoveObjectManagedFields(object)
+ }
+ return object, managed, nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/manager.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/manager.go
new file mode 100644
index 000000000..053936103
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/manager.go
@@ -0,0 +1,52 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+// Managed groups a fieldpath.ManagedFields together with the timestamps associated with each operation.
+type Managed interface {
+ // Fields gets the fieldpath.ManagedFields.
+ Fields() fieldpath.ManagedFields
+
+ // Times gets the timestamps associated with each operation.
+ Times() map[string]*metav1.Time
+}
+
+// Manager updates the managed fields and merges applied configurations.
+type Manager interface {
+ // Update is used when the object has already been merged (non-apply
+ // use-case), and simply updates the managed fields in the output
+ // object.
+ // * `liveObj` is not mutated by this function
+ // * `newObj` may be mutated by this function
+ // Returns the new object with managedFields removed, and the object's new
+ // proposed managedFields separately.
+ Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error)
+
+ // Apply is used when server-side apply is called, as it merges the
+ // object and updates the managed fields.
+ // * `liveObj` is not mutated by this function
+ // * `newObj` may be mutated by this function
+ // Returns the new object with managedFields removed, and the object's new
+ // proposed managedFields separately.
+ Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/pathelement.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/pathelement.go
new file mode 100644
index 000000000..1954d65d3
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/pathelement.go
@@ -0,0 +1,140 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "encoding/json"
+ "errors"
+ "fmt"
+ "strconv"
+ "strings"
+
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/value"
+)
+
+const (
+ // Field indicates that the content of this path element is a field's name
+ Field = "f"
+
+ // Value indicates that the content of this path element is a field's value
+ Value = "v"
+
+ // Index indicates that the content of this path element is an index in an array
+ Index = "i"
+
+ // Key indicates that the content of this path element is a key value map
+ Key = "k"
+
+ // Separator separates the type of a path element from the contents
+ Separator = ":"
+)
+
+// NewPathElement parses a serialized path element
+func NewPathElement(s string) (fieldpath.PathElement, error) {
+ split := strings.SplitN(s, Separator, 2)
+ if len(split) < 2 {
+ return fieldpath.PathElement{}, fmt.Errorf("missing colon: %v", s)
+ }
+ switch split[0] {
+ case Field:
+ return fieldpath.PathElement{
+ FieldName: &split[1],
+ }, nil
+ case Value:
+ val, err := value.FromJSON([]byte(split[1]))
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+ return fieldpath.PathElement{
+ Value: &val,
+ }, nil
+ case Index:
+ i, err := strconv.Atoi(split[1])
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+ return fieldpath.PathElement{
+ Index: &i,
+ }, nil
+ case Key:
+ kv := map[string]json.RawMessage{}
+ err := json.Unmarshal([]byte(split[1]), &kv)
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+ fields := value.FieldList{}
+ for k, v := range kv {
+ b, err := json.Marshal(v)
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+ val, err := value.FromJSON(b)
+ if err != nil {
+ return fieldpath.PathElement{}, err
+ }
+
+ fields = append(fields, value.Field{
+ Name: k,
+ Value: val,
+ })
+ }
+ return fieldpath.PathElement{
+ Key: &fields,
+ }, nil
+ default:
+ // Ignore unknown key types
+ return fieldpath.PathElement{}, nil
+ }
+}
+
+// PathElementString serializes a path element
+func PathElementString(pe fieldpath.PathElement) (string, error) {
+ switch {
+ case pe.FieldName != nil:
+ return Field + Separator + *pe.FieldName, nil
+ case pe.Key != nil:
+ kv := map[string]json.RawMessage{}
+ for _, k := range *pe.Key {
+ b, err := value.ToJSON(k.Value)
+ if err != nil {
+ return "", err
+ }
+ m := json.RawMessage{}
+ err = json.Unmarshal(b, &m)
+ if err != nil {
+ return "", err
+ }
+ kv[k.Name] = m
+ }
+ b, err := json.Marshal(kv)
+ if err != nil {
+ return "", err
+ }
+ return Key + ":" + string(b), nil
+ case pe.Value != nil:
+ b, err := value.ToJSON(*pe.Value)
+ if err != nil {
+ return "", err
+ }
+ return Value + ":" + string(b), nil
+ case pe.Index != nil:
+ return Index + ":" + strconv.Itoa(*pe.Index), nil
+ default:
+ return "", errors.New("Invalid type of path element")
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/skipnonapplied.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/skipnonapplied.go
new file mode 100644
index 000000000..f24c040ed
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/skipnonapplied.go
@@ -0,0 +1,89 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+ "math/rand"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/runtime"
+)
+
+type skipNonAppliedManager struct {
+ fieldManager Manager
+ objectCreater runtime.ObjectCreater
+ beforeApplyManagerName string
+ probability float32
+}
+
+var _ Manager = &skipNonAppliedManager{}
+
+// NewSkipNonAppliedManager creates a new wrapped FieldManager that only starts tracking managers after the first apply.
+func NewSkipNonAppliedManager(fieldManager Manager, objectCreater runtime.ObjectCreater) Manager {
+ return NewProbabilisticSkipNonAppliedManager(fieldManager, objectCreater, 0.0)
+}
+
+// NewProbabilisticSkipNonAppliedManager creates a new wrapped FieldManager that starts tracking managers after the first apply,
+// or starts tracking on create with p probability.
+func NewProbabilisticSkipNonAppliedManager(fieldManager Manager, objectCreater runtime.ObjectCreater, p float32) Manager {
+ return &skipNonAppliedManager{
+ fieldManager: fieldManager,
+ objectCreater: objectCreater,
+ beforeApplyManagerName: "before-first-apply",
+ probability: p,
+ }
+}
+
+// Update implements Manager.
+func (f *skipNonAppliedManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ accessor, err := meta.Accessor(liveObj)
+ if err != nil {
+ return newObj, managed, nil
+ }
+
+ // If managed fields is empty, we need to determine whether to skip tracking managed fields.
+ if len(managed.Fields()) == 0 {
+ // Check if the operation is a create, by checking whether lastObj's UID is empty.
+ // If the operation is create, P(tracking managed fields) = f.probability
+ // If the operation is update, skip tracking managed fields, since we already know managed fields is empty.
+ if len(accessor.GetUID()) == 0 {
+ if f.probability <= rand.Float32() {
+ return newObj, managed, nil
+ }
+ } else {
+ return newObj, managed, nil
+ }
+ }
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// Apply implements Manager.
+func (f *skipNonAppliedManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error) {
+ if len(managed.Fields()) == 0 {
+ gvk := appliedObj.GetObjectKind().GroupVersionKind()
+ emptyObj, err := f.objectCreater.New(gvk)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create empty object of type %v: %v", gvk, err)
+ }
+ liveObj, managed, err = f.fieldManager.Update(emptyObj, liveObj, managed, f.beforeApplyManagerName)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create manager for existing fields: %v", err)
+ }
+ }
+ return f.fieldManager.Apply(liveObj, appliedObj, managed, fieldManager, force)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/stripmeta.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/stripmeta.go
new file mode 100644
index 000000000..9b61f3a6f
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/stripmeta.go
@@ -0,0 +1,90 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/runtime"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+type stripMetaManager struct {
+ fieldManager Manager
+
+ // stripSet is the list of fields that should never be part of a mangedFields.
+ stripSet *fieldpath.Set
+}
+
+var _ Manager = &stripMetaManager{}
+
+// NewStripMetaManager creates a new Manager that strips metadata and typemeta fields from the manager's fieldset.
+func NewStripMetaManager(fieldManager Manager) Manager {
+ return &stripMetaManager{
+ fieldManager: fieldManager,
+ stripSet: fieldpath.NewSet(
+ fieldpath.MakePathOrDie("apiVersion"),
+ fieldpath.MakePathOrDie("kind"),
+ fieldpath.MakePathOrDie("metadata"),
+ fieldpath.MakePathOrDie("metadata", "name"),
+ fieldpath.MakePathOrDie("metadata", "namespace"),
+ fieldpath.MakePathOrDie("metadata", "creationTimestamp"),
+ fieldpath.MakePathOrDie("metadata", "selfLink"),
+ fieldpath.MakePathOrDie("metadata", "uid"),
+ fieldpath.MakePathOrDie("metadata", "clusterName"),
+ fieldpath.MakePathOrDie("metadata", "generation"),
+ fieldpath.MakePathOrDie("metadata", "managedFields"),
+ fieldpath.MakePathOrDie("metadata", "resourceVersion"),
+ ),
+ }
+}
+
+// Update implements Manager.
+func (f *stripMetaManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ newObj, managed, err := f.fieldManager.Update(liveObj, newObj, managed, manager)
+ if err != nil {
+ return nil, nil, err
+ }
+ f.stripFields(managed.Fields(), manager)
+ return newObj, managed, nil
+}
+
+// Apply implements Manager.
+func (f *stripMetaManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ newObj, managed, err := f.fieldManager.Apply(liveObj, appliedObj, managed, manager, force)
+ if err != nil {
+ return nil, nil, err
+ }
+ f.stripFields(managed.Fields(), manager)
+ return newObj, managed, nil
+}
+
+// stripFields removes a predefined set of paths found in typed from managed
+func (f *stripMetaManager) stripFields(managed fieldpath.ManagedFields, manager string) {
+ vs, ok := managed[manager]
+ if ok {
+ if vs == nil {
+ panic(fmt.Sprintf("Found unexpected nil manager which should never happen: %s", manager))
+ }
+ newSet := vs.Set().Difference(f.stripSet)
+ if newSet.Empty() {
+ delete(managed, manager)
+ } else {
+ managed[manager] = fieldpath.NewVersionedSet(newSet, vs.APIVersion(), vs.Applied())
+ }
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/structuredmerge.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/structuredmerge.go
new file mode 100644
index 000000000..786ad991c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/structuredmerge.go
@@ -0,0 +1,189 @@
+/*
+Copyright 2019 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/api/meta"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+ "sigs.k8s.io/structured-merge-diff/v4/typed"
+)
+
+type structuredMergeManager struct {
+ typeConverter TypeConverter
+ objectConverter runtime.ObjectConvertor
+ objectDefaulter runtime.ObjectDefaulter
+ groupVersion schema.GroupVersion
+ hubVersion schema.GroupVersion
+ updater merge.Updater
+}
+
+var _ Manager = &structuredMergeManager{}
+
+// NewStructuredMergeManager creates a new Manager that merges apply requests
+// and update managed fields for other types of requests.
+func NewStructuredMergeManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, gv schema.GroupVersion, hub schema.GroupVersion, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (Manager, error) {
+ if typeConverter == nil {
+ return nil, fmt.Errorf("typeconverter must not be nil")
+ }
+ return &structuredMergeManager{
+ typeConverter: typeConverter,
+ objectConverter: objectConverter,
+ objectDefaulter: objectDefaulter,
+ groupVersion: gv,
+ hubVersion: hub,
+ updater: merge.Updater{
+ Converter: newVersionConverter(typeConverter, objectConverter, hub), // This is the converter provided to SMD from k8s
+ IgnoredFields: resetFields,
+ },
+ }, nil
+}
+
+// NewCRDStructuredMergeManager creates a new Manager specifically for
+// CRDs. This allows for the possibility of fields which are not defined
+// in models, as well as having no models defined at all.
+func NewCRDStructuredMergeManager(typeConverter TypeConverter, objectConverter runtime.ObjectConvertor, objectDefaulter runtime.ObjectDefaulter, gv schema.GroupVersion, hub schema.GroupVersion, resetFields map[fieldpath.APIVersion]*fieldpath.Set) (_ Manager, err error) {
+ return &structuredMergeManager{
+ typeConverter: typeConverter,
+ objectConverter: objectConverter,
+ objectDefaulter: objectDefaulter,
+ groupVersion: gv,
+ hubVersion: hub,
+ updater: merge.Updater{
+ Converter: newCRDVersionConverter(typeConverter, objectConverter, hub),
+ IgnoredFields: resetFields,
+ },
+ }, nil
+}
+
+func objectGVKNN(obj runtime.Object) string {
+ name := ""
+ namespace := ""
+ if accessor, err := meta.Accessor(obj); err == nil {
+ name = accessor.GetName()
+ namespace = accessor.GetNamespace()
+ }
+
+ return fmt.Sprintf("%v/%v; %v", namespace, name, obj.GetObjectKind().GroupVersionKind())
+}
+
+// Update implements Manager.
+func (f *structuredMergeManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ newObjVersioned, err := f.toVersioned(newObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert new object (%v) to proper version (%v): %v", objectGVKNN(newObj), f.groupVersion, err)
+ }
+ liveObjVersioned, err := f.toVersioned(liveObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert live object (%v) to proper version: %v", objectGVKNN(liveObj), err)
+ }
+ newObjTyped, err := f.typeConverter.ObjectToTyped(newObjVersioned, typed.AllowDuplicates)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert new object (%v) to smd typed: %v", objectGVKNN(newObjVersioned), err)
+ }
+ liveObjTyped, err := f.typeConverter.ObjectToTyped(liveObjVersioned, typed.AllowDuplicates)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert live object (%v) to smd typed: %v", objectGVKNN(liveObjVersioned), err)
+ }
+ apiVersion := fieldpath.APIVersion(f.groupVersion.String())
+
+ // TODO(apelisse) use the first return value when unions are implemented
+ _, managedFields, err := f.updater.Update(liveObjTyped, newObjTyped, apiVersion, managed.Fields(), manager)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to update ManagedFields (%v): %v", objectGVKNN(newObjVersioned), err)
+ }
+ managed = NewManaged(managedFields, managed.Times())
+
+ return newObj, managed, nil
+}
+
+// Apply implements Manager.
+func (f *structuredMergeManager) Apply(liveObj, patchObj runtime.Object, managed Managed, manager string, force bool) (runtime.Object, Managed, error) {
+ // Check that the patch object has the same version as the live object
+ if patchVersion := patchObj.GetObjectKind().GroupVersionKind().GroupVersion(); patchVersion != f.groupVersion {
+ return nil, nil,
+ errors.NewBadRequest(
+ fmt.Sprintf("Incorrect version specified in apply patch. "+
+ "Specified patch version: %s, expected: %s",
+ patchVersion, f.groupVersion))
+ }
+
+ patchObjMeta, err := meta.Accessor(patchObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("couldn't get accessor: %v", err)
+ }
+ if patchObjMeta.GetManagedFields() != nil {
+ return nil, nil, errors.NewBadRequest("metadata.managedFields must be nil")
+ }
+
+ liveObjVersioned, err := f.toVersioned(liveObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert live object (%v) to proper version: %v", objectGVKNN(liveObj), err)
+ }
+
+ // Don't allow duplicates in the applied object.
+ patchObjTyped, err := f.typeConverter.ObjectToTyped(patchObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create typed patch object (%v): %v", objectGVKNN(patchObj), err)
+ }
+
+ liveObjTyped, err := f.typeConverter.ObjectToTyped(liveObjVersioned, typed.AllowDuplicates)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to create typed live object (%v): %v", objectGVKNN(liveObjVersioned), err)
+ }
+
+ apiVersion := fieldpath.APIVersion(f.groupVersion.String())
+ newObjTyped, managedFields, err := f.updater.Apply(liveObjTyped, patchObjTyped, apiVersion, managed.Fields(), manager, force)
+ if err != nil {
+ return nil, nil, err
+ }
+ managed = NewManaged(managedFields, managed.Times())
+
+ if newObjTyped == nil {
+ return nil, managed, nil
+ }
+
+ newObj, err := f.typeConverter.TypedToObject(newObjTyped)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert new typed object (%v) to object: %v", objectGVKNN(patchObj), err)
+ }
+
+ newObjVersioned, err := f.toVersioned(newObj)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert new object (%v) to proper version: %v", objectGVKNN(patchObj), err)
+ }
+ f.objectDefaulter.Default(newObjVersioned)
+
+ newObjUnversioned, err := f.toUnversioned(newObjVersioned)
+ if err != nil {
+ return nil, nil, fmt.Errorf("failed to convert to unversioned (%v): %v", objectGVKNN(patchObj), err)
+ }
+ return newObjUnversioned, managed, nil
+}
+
+func (f *structuredMergeManager) toVersioned(obj runtime.Object) (runtime.Object, error) {
+ return f.objectConverter.ConvertToVersion(obj, f.groupVersion)
+}
+
+func (f *structuredMergeManager) toUnversioned(obj runtime.Object) (runtime.Object, error) {
+ return f.objectConverter.ConvertToVersion(obj, f.hubVersion)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go
new file mode 100644
index 000000000..c6449467c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/typeconverter.go
@@ -0,0 +1,193 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/kube-openapi/pkg/schemaconv"
+ "k8s.io/kube-openapi/pkg/validation/spec"
+ smdschema "sigs.k8s.io/structured-merge-diff/v4/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/typed"
+ "sigs.k8s.io/structured-merge-diff/v4/value"
+)
+
+// TypeConverter allows you to convert from runtime.Object to
+// typed.TypedValue and the other way around.
+type TypeConverter interface {
+ ObjectToTyped(runtime.Object, ...typed.ValidationOptions) (*typed.TypedValue, error)
+ TypedToObject(*typed.TypedValue) (runtime.Object, error)
+}
+
+type typeConverter struct {
+ parser map[schema.GroupVersionKind]*typed.ParseableType
+}
+
+var _ TypeConverter = &typeConverter{}
+
+func NewTypeConverter(openapiSpec map[string]*spec.Schema, preserveUnknownFields bool) (TypeConverter, error) {
+ typeSchema, err := schemaconv.ToSchemaFromOpenAPI(openapiSpec, preserveUnknownFields)
+ if err != nil {
+ return nil, fmt.Errorf("failed to convert models to schema: %v", err)
+ }
+
+ typeParser := typed.Parser{Schema: smdschema.Schema{Types: typeSchema.Types}}
+ tr := indexModels(&typeParser, openapiSpec)
+
+ return &typeConverter{parser: tr}, nil
+}
+
+func (c *typeConverter) ObjectToTyped(obj runtime.Object, opts ...typed.ValidationOptions) (*typed.TypedValue, error) {
+ gvk := obj.GetObjectKind().GroupVersionKind()
+ t := c.parser[gvk]
+ if t == nil {
+ return nil, NewNoCorrespondingTypeError(gvk)
+ }
+ switch o := obj.(type) {
+ case *unstructured.Unstructured:
+ return t.FromUnstructured(o.UnstructuredContent(), opts...)
+ default:
+ return t.FromStructured(obj, opts...)
+ }
+}
+
+func (c *typeConverter) TypedToObject(value *typed.TypedValue) (runtime.Object, error) {
+ return valueToObject(value.AsValue())
+}
+
+type deducedTypeConverter struct{}
+
+// DeducedTypeConverter is a TypeConverter for CRDs that don't have a
+// schema. It does implement the same interface though (and create the
+// same types of objects), so that everything can still work the same.
+// CRDs are merged with all their fields being "atomic" (lists
+// included).
+func NewDeducedTypeConverter() TypeConverter {
+ return deducedTypeConverter{}
+}
+
+// ObjectToTyped converts an object into a TypedValue with a "deduced type".
+func (deducedTypeConverter) ObjectToTyped(obj runtime.Object, opts ...typed.ValidationOptions) (*typed.TypedValue, error) {
+ switch o := obj.(type) {
+ case *unstructured.Unstructured:
+ return typed.DeducedParseableType.FromUnstructured(o.UnstructuredContent(), opts...)
+ default:
+ return typed.DeducedParseableType.FromStructured(obj, opts...)
+ }
+}
+
+// TypedToObject transforms the typed value into a runtime.Object. That
+// is not specific to deduced type.
+func (deducedTypeConverter) TypedToObject(value *typed.TypedValue) (runtime.Object, error) {
+ return valueToObject(value.AsValue())
+}
+
+func valueToObject(val value.Value) (runtime.Object, error) {
+ vu := val.Unstructured()
+ switch o := vu.(type) {
+ case map[string]interface{}:
+ return &unstructured.Unstructured{Object: o}, nil
+ default:
+ return nil, fmt.Errorf("failed to convert value to unstructured for type %T", vu)
+ }
+}
+
+func indexModels(
+ typeParser *typed.Parser,
+ openAPISchemas map[string]*spec.Schema,
+) map[schema.GroupVersionKind]*typed.ParseableType {
+ tr := map[schema.GroupVersionKind]*typed.ParseableType{}
+ for modelName, model := range openAPISchemas {
+ gvkList := parseGroupVersionKind(model.Extensions)
+ if len(gvkList) == 0 {
+ continue
+ }
+
+ parsedType := typeParser.Type(modelName)
+ for _, gvk := range gvkList {
+ if len(gvk.Kind) > 0 {
+ tr[schema.GroupVersionKind(gvk)] = &parsedType
+ }
+ }
+ }
+ return tr
+}
+
+// Get and parse GroupVersionKind from the extension. Returns empty if it doesn't have one.
+func parseGroupVersionKind(extensions map[string]interface{}) []schema.GroupVersionKind {
+ gvkListResult := []schema.GroupVersionKind{}
+
+ // Get the extensions
+ gvkExtension, ok := extensions["x-kubernetes-group-version-kind"]
+ if !ok {
+ return []schema.GroupVersionKind{}
+ }
+
+ // gvk extension must be a list of at least 1 element.
+ gvkList, ok := gvkExtension.([]interface{})
+ if !ok {
+ return []schema.GroupVersionKind{}
+ }
+
+ for _, gvk := range gvkList {
+ var group, version, kind string
+
+ // gvk extension list must be a map with group, version, and
+ // kind fields
+ if gvkMap, ok := gvk.(map[interface{}]interface{}); ok {
+ group, ok = gvkMap["group"].(string)
+ if !ok {
+ continue
+ }
+ version, ok = gvkMap["version"].(string)
+ if !ok {
+ continue
+ }
+ kind, ok = gvkMap["kind"].(string)
+ if !ok {
+ continue
+ }
+
+ } else if gvkMap, ok := gvk.(map[string]interface{}); ok {
+ group, ok = gvkMap["group"].(string)
+ if !ok {
+ continue
+ }
+ version, ok = gvkMap["version"].(string)
+ if !ok {
+ continue
+ }
+ kind, ok = gvkMap["kind"].(string)
+ if !ok {
+ continue
+ }
+ } else {
+ continue
+ }
+
+ gvkListResult = append(gvkListResult, schema.GroupVersionKind{
+ Group: group,
+ Version: version,
+ Kind: kind,
+ })
+ }
+
+ return gvkListResult
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versioncheck.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versioncheck.go
new file mode 100644
index 000000000..ee1e2bca7
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versioncheck.go
@@ -0,0 +1,52 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+)
+
+type versionCheckManager struct {
+ fieldManager Manager
+ gvk schema.GroupVersionKind
+}
+
+var _ Manager = &versionCheckManager{}
+
+// NewVersionCheckManager creates a manager that makes sure that the
+// applied object is in the proper version.
+func NewVersionCheckManager(fieldManager Manager, gvk schema.GroupVersionKind) Manager {
+ return &versionCheckManager{fieldManager: fieldManager, gvk: gvk}
+}
+
+// Update implements Manager.
+func (f *versionCheckManager) Update(liveObj, newObj runtime.Object, managed Managed, manager string) (runtime.Object, Managed, error) {
+ // Nothing to do for updates, this is checked in many other places.
+ return f.fieldManager.Update(liveObj, newObj, managed, manager)
+}
+
+// Apply implements Manager.
+func (f *versionCheckManager) Apply(liveObj, appliedObj runtime.Object, managed Managed, fieldManager string, force bool) (runtime.Object, Managed, error) {
+ if gvk := appliedObj.GetObjectKind().GroupVersionKind(); gvk != f.gvk {
+ return nil, nil, errors.NewBadRequest(fmt.Sprintf("invalid object type: %v", gvk))
+ }
+ return f.fieldManager.Apply(liveObj, appliedObj, managed, fieldManager, force)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go
new file mode 100644
index 000000000..45855fa4c
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/versionconverter.go
@@ -0,0 +1,123 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/merge"
+ "sigs.k8s.io/structured-merge-diff/v4/typed"
+)
+
+// versionConverter is an implementation of
+// sigs.k8s.io/structured-merge-diff/merge.Converter
+type versionConverter struct {
+ typeConverter TypeConverter
+ objectConvertor runtime.ObjectConvertor
+ hubGetter func(from schema.GroupVersion) schema.GroupVersion
+}
+
+var _ merge.Converter = &versionConverter{}
+
+// NewVersionConverter builds a VersionConverter from a TypeConverter and an ObjectConvertor.
+func newVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema.GroupVersion) merge.Converter {
+ return &versionConverter{
+ typeConverter: t,
+ objectConvertor: o,
+ hubGetter: func(from schema.GroupVersion) schema.GroupVersion {
+ return schema.GroupVersion{
+ Group: from.Group,
+ Version: h.Version,
+ }
+ },
+ }
+}
+
+// NewCRDVersionConverter builds a VersionConverter for CRDs from a TypeConverter and an ObjectConvertor.
+func newCRDVersionConverter(t TypeConverter, o runtime.ObjectConvertor, h schema.GroupVersion) merge.Converter {
+ return &versionConverter{
+ typeConverter: t,
+ objectConvertor: o,
+ hubGetter: func(from schema.GroupVersion) schema.GroupVersion {
+ return h
+ },
+ }
+}
+
+// Convert implements sigs.k8s.io/structured-merge-diff/merge.Converter
+func (v *versionConverter) Convert(object *typed.TypedValue, version fieldpath.APIVersion) (*typed.TypedValue, error) {
+ // Convert the smd typed value to a kubernetes object.
+ objectToConvert, err := v.typeConverter.TypedToObject(object)
+ if err != nil {
+ return object, err
+ }
+
+ // Parse the target groupVersion.
+ groupVersion, err := schema.ParseGroupVersion(string(version))
+ if err != nil {
+ return object, err
+ }
+
+ // If attempting to convert to the same version as we already have, just return it.
+ fromVersion := objectToConvert.GetObjectKind().GroupVersionKind().GroupVersion()
+ if fromVersion == groupVersion {
+ return object, nil
+ }
+
+ // Convert to internal
+ internalObject, err := v.objectConvertor.ConvertToVersion(objectToConvert, v.hubGetter(fromVersion))
+ if err != nil {
+ return object, err
+ }
+
+ // Convert the object into the target version
+ convertedObject, err := v.objectConvertor.ConvertToVersion(internalObject, groupVersion)
+ if err != nil {
+ return object, err
+ }
+
+ // Convert the object back to a smd typed value and return it.
+ return v.typeConverter.ObjectToTyped(convertedObject)
+}
+
+// IsMissingVersionError
+func (v *versionConverter) IsMissingVersionError(err error) bool {
+ return runtime.IsNotRegisteredError(err) || isNoCorrespondingTypeError(err)
+}
+
+type noCorrespondingTypeErr struct {
+ gvk schema.GroupVersionKind
+}
+
+func NewNoCorrespondingTypeError(gvk schema.GroupVersionKind) error {
+ return &noCorrespondingTypeErr{gvk: gvk}
+}
+
+func (k *noCorrespondingTypeErr) Error() string {
+ return fmt.Sprintf("no corresponding type for %v", k.gvk)
+}
+
+func isNoCorrespondingTypeError(err error) bool {
+ if err == nil {
+ return false
+ }
+ _, ok := err.(*noCorrespondingTypeErr)
+ return ok
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/node.yaml b/vendor/k8s.io/apimachinery/pkg/util/managedfields/node.yaml
new file mode 100644
index 000000000..a7f2d54fd
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/node.yaml
@@ -0,0 +1,261 @@
+apiVersion: v1
+kind: Node
+metadata:
+ annotations:
+ container.googleapis.com/instance_id: "123456789321654789"
+ node.alpha.kubernetes.io/ttl: "0"
+ volumes.kubernetes.io/controller-managed-attach-detach: "true"
+ creationTimestamp: "2019-07-09T16:17:29Z"
+ labels:
+ kubernetes.io/arch: amd64
+ beta.kubernetes.io/fluentd-ds-ready: "true"
+ beta.kubernetes.io/instance-type: n1-standard-4
+ kubernetes.io/os: linux
+ cloud.google.com/gke-nodepool: default-pool
+ cloud.google.com/gke-os-distribution: cos
+ failure-domain.beta.kubernetes.io/region: us-central1
+ failure-domain.beta.kubernetes.io/zone: us-central1-b
+ topology.kubernetes.io/region: us-central1
+ topology.kubernetes.io/zone: us-central1-b
+ kubernetes.io/hostname: node-default-pool-something
+ name: node-default-pool-something
+ resourceVersion: "211582541"
+ selfLink: /api/v1/nodes/node-default-pool-something
+ uid: 0c24d0e1-a265-11e9-abe4-42010a80026b
+spec:
+ podCIDR: 10.0.0.1/24
+ providerID: some-provider-id-of-some-sort
+status:
+ addresses:
+ - address: 10.0.0.1
+ type: InternalIP
+ - address: 192.168.0.1
+ type: ExternalIP
+ - address: node-default-pool-something
+ type: Hostname
+ allocatable:
+ cpu: 3920m
+ ephemeral-storage: "104638878617"
+ hugepages-2Mi: "0"
+ memory: 12700100Ki
+ pods: "110"
+ capacity:
+ cpu: "4"
+ ephemeral-storage: 202086868Ki
+ hugepages-2Mi: "0"
+ memory: 15399364Ki
+ pods: "110"
+ conditions:
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:08Z"
+ message: containerd is functioning properly
+ reason: FrequentContainerdRestart
+ status: "False"
+ type: FrequentContainerdRestart
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:06Z"
+ message: docker overlay2 is functioning properly
+ reason: CorruptDockerOverlay2
+ status: "False"
+ type: CorruptDockerOverlay2
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:06Z"
+ message: node is functioning properly
+ reason: UnregisterNetDevice
+ status: "False"
+ type: FrequentUnregisterNetDevice
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:17:04Z"
+ message: kernel has no deadlock
+ reason: KernelHasNoDeadlock
+ status: "False"
+ type: KernelDeadlock
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:17:04Z"
+ message: Filesystem is not read-only
+ reason: FilesystemIsNotReadOnly
+ status: "False"
+ type: ReadonlyFilesystem
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:05Z"
+ message: kubelet is functioning properly
+ reason: FrequentKubeletRestart
+ status: "False"
+ type: FrequentKubeletRestart
+ - lastHeartbeatTime: "2019-09-20T19:32:08Z"
+ lastTransitionTime: "2019-07-09T16:22:06Z"
+ message: docker is functioning properly
+ reason: FrequentDockerRestart
+ status: "False"
+ type: FrequentDockerRestart
+ - lastHeartbeatTime: "2019-07-09T16:17:47Z"
+ lastTransitionTime: "2019-07-09T16:17:47Z"
+ message: RouteController created a route
+ reason: RouteCreated
+ status: "False"
+ type: NetworkUnavailable
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:29Z"
+ message: kubelet has sufficient disk space available
+ reason: KubeletHasSufficientDisk
+ status: "False"
+ type: OutOfDisk
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:29Z"
+ message: kubelet has sufficient memory available
+ reason: KubeletHasSufficientMemory
+ status: "False"
+ type: MemoryPressure
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:29Z"
+ message: kubelet has no disk pressure
+ reason: KubeletHasNoDiskPressure
+ status: "False"
+ type: DiskPressure
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:29Z"
+ message: kubelet has sufficient PID available
+ reason: KubeletHasSufficientPID
+ status: "False"
+ type: PIDPressure
+ - lastHeartbeatTime: "2019-09-20T19:32:50Z"
+ lastTransitionTime: "2019-07-09T16:17:49Z"
+ message: kubelet is posting ready status
+ reason: KubeletReady
+ status: "True"
+ type: Ready
+ daemonEndpoints:
+ kubeletEndpoint:
+ Port: 10250
+ images:
+ - names:
+ - grafana/grafana@sha256:80e5e113a984d74836aa16f5b4524012099436b1a50df293f00ac6377fb512c8
+ - grafana/grafana:4.4.2
+ sizeBytes: 287008013
+ - names:
+ - registry.k8s.io/node-problem-detector@sha256:f95cab985c26b2f46e9bd43283e0bfa88860c14e0fb0649266babe8b65e9eb2b
+ - registry.k8s.io/node-problem-detector:v0.4.1
+ sizeBytes: 286572743
+ - names:
+ - grafana/grafana@sha256:7ff7f9b2501a5d55b55ce3f58d21771b1c5af1f2a4ab7dbf11bef7142aae7033
+ - grafana/grafana:4.2.0
+ sizeBytes: 277940263
+ - names:
+ - influxdb@sha256:7dddf03376348876ed4bdf33d6dfa3326f45a2bae0930dbd80781a374eb519bc
+ - influxdb:1.2.2
+ sizeBytes: 223948571
+ - names:
+ - gcr.io/stackdriver-agents/stackdriver-logging-agent@sha256:f8d5231b67b9c53f60068b535a11811d29d1b3efd53d2b79f2a2591ea338e4f2
+ - gcr.io/stackdriver-agents/stackdriver-logging-agent:0.6-1.6.0-1
+ sizeBytes: 223242132
+ - names:
+ - nginx@sha256:35779791c05d119df4fe476db8f47c0bee5943c83eba5656a15fc046db48178b
+ - nginx:1.10.1
+ sizeBytes: 180708613
+ - names:
+ - registry.k8s.io/fluentd-elasticsearch@sha256:b8c94527b489fb61d3d81ce5ad7f3ddbb7be71e9620a3a36e2bede2f2e487d73
+ - registry.k8s.io/fluentd-elasticsearch:v2.0.4
+ sizeBytes: 135716379
+ - names:
+ - nginx@sha256:00be67d6ba53d5318cd91c57771530f5251cfbe028b7be2c4b70526f988cfc9f
+ - nginx:latest
+ sizeBytes: 109357355
+ - names:
+ - registry.k8s.io/kubernetes-dashboard-amd64@sha256:dc4026c1b595435ef5527ca598e1e9c4343076926d7d62b365c44831395adbd0
+ - registry.k8s.io/kubernetes-dashboard-amd64:v1.8.3
+ sizeBytes: 102319441
+ - names:
+ - gcr.io/google_containers/kube-proxy:v1.11.10-gke.5
+ - registry.k8s.io/kube-proxy:v1.11.10-gke.5
+ sizeBytes: 102279340
+ - names:
+ - registry.k8s.io/event-exporter@sha256:7f9cd7cb04d6959b0aa960727d04fa86759008048c785397b7b0d9dff0007516
+ - registry.k8s.io/event-exporter:v0.2.3
+ sizeBytes: 94171943
+ - names:
+ - registry.k8s.io/prometheus-to-sd@sha256:6c0c742475363d537ff059136e5d5e4ab1f512ee0fd9b7ca42ea48bc309d1662
+ - registry.k8s.io/prometheus-to-sd:v0.3.1
+ sizeBytes: 88077694
+ - names:
+ - registry.k8s.io/fluentd-gcp-scaler@sha256:a5ace7506d393c4ed65eb2cbb6312c64ab357fcea16dff76b9055bc6e498e5ff
+ - registry.k8s.io/fluentd-gcp-scaler:0.5.1
+ sizeBytes: 86637208
+ - names:
+ - registry.k8s.io/heapster-amd64@sha256:9fae0af136ce0cf4f88393b3670f7139ffc464692060c374d2ae748e13144521
+ - registry.k8s.io/heapster-amd64:v1.6.0-beta.1
+ sizeBytes: 76016169
+ - names:
+ - registry.k8s.io/ingress-glbc-amd64@sha256:31d36bbd9c44caffa135fc78cf0737266fcf25e3cf0cd1c2fcbfbc4f7309cc52
+ - registry.k8s.io/ingress-glbc-amd64:v1.1.1
+ sizeBytes: 67801919
+ - names:
+ - registry.k8s.io/kube-addon-manager@sha256:d53486c3a0b49ebee019932878dc44232735d5622a51dbbdcec7124199020d09
+ - registry.k8s.io/kube-addon-manager:v8.7
+ sizeBytes: 63322109
+ - names:
+ - nginx@sha256:4aacdcf186934dcb02f642579314075910f1855590fd3039d8fa4c9f96e48315
+ - nginx:1.10-alpine
+ sizeBytes: 54042627
+ - names:
+ - registry.k8s.io/cpvpa-amd64@sha256:cfe7b0a11c9c8e18c87b1eb34fef9a7cbb8480a8da11fc2657f78dbf4739f869
+ - registry.k8s.io/cpvpa-amd64:v0.6.0
+ sizeBytes: 51785854
+ - names:
+ - registry.k8s.io/cluster-proportional-autoscaler-amd64@sha256:003f98d9f411ddfa6ff6d539196355e03ddd69fa4ed38c7ffb8fec6f729afe2d
+ - registry.k8s.io/cluster-proportional-autoscaler-amd64:1.1.2-r2
+ sizeBytes: 49648481
+ - names:
+ - registry.k8s.io/ip-masq-agent-amd64@sha256:1ffda57d87901bc01324c82ceb2145fe6a0448d3f0dd9cb65aa76a867cd62103
+ - registry.k8s.io/ip-masq-agent-amd64:v2.1.1
+ sizeBytes: 49612505
+ - names:
+ - registry.k8s.io/k8s-dns-kube-dns-amd64@sha256:b99fc3eee2a9f052f7eb4cc00f15eb12fc405fa41019baa2d6b79847ae7284a8
+ - registry.k8s.io/k8s-dns-kube-dns-amd64:1.14.10
+ sizeBytes: 49549457
+ - names:
+ - registry.k8s.io/rescheduler@sha256:156cfbfd05a5a815206fd2eeb6cbdaf1596d71ea4b415d3a6c43071dd7b99450
+ - registry.k8s.io/rescheduler:v0.4.0
+ sizeBytes: 48973149
+ - names:
+ - registry.k8s.io/event-exporter@sha256:16ca66e2b5dc7a1ce6a5aafcb21d0885828b75cdfc08135430480f7ad2364adc
+ - registry.k8s.io/event-exporter:v0.2.4
+ sizeBytes: 47261019
+ - names:
+ - registry.k8s.io/coredns@sha256:db2bf53126ed1c761d5a41f24a1b82a461c85f736ff6e90542e9522be4757848
+ - registry.k8s.io/coredns:1.1.3
+ sizeBytes: 45587362
+ - names:
+ - prom/prometheus@sha256:483f4c9d7733699ba79facca9f8bcce1cef1af43dfc3e7c5a1882aa85f53cb74
+ - prom/prometheus:v1.1.3
+ sizeBytes: 45493941
+ nodeInfo:
+ architecture: amd64
+ bootID: a32eca78-4ad4-4b76-9252-f143d6c2ae61
+ containerRuntimeVersion: docker://17.3.2
+ kernelVersion: 4.14.127+
+ kubeProxyVersion: v1.11.10-gke.5
+ kubeletVersion: v1.11.10-gke.5
+ machineID: 1739555e5b231057f0f9a0b5fa29511b
+ operatingSystem: linux
+ osImage: Container-Optimized OS from Google
+ systemUUID: 1739555E-5B23-1057-F0F9-A0B5FA29511B
+ volumesAttached:
+ - devicePath: /dev/disk/by-id/b9772-pvc-c787c67d-14d7-11e7-9baf-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-c787c67d-14d7-11e7-9baf-42010a800049
+ - devicePath: /dev/disk/by-id/b9772-pvc-8895a852-fd42-11e6-94d4-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-8895a852-fd42-11e6-94d4-42010a800049
+ - devicePath: /dev/disk/by-id/some-random-clusterb9772-pvc-72e1c7f1-fd41-11e6-94d4-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-72e1c7f1-fd41-11e6-94d4-42010a800049
+ - devicePath: /dev/disk/by-id/some-random-clusterb9772-pvc-c2435a06-14d7-11e7-9baf-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-c2435a06-14d7-11e7-9baf-42010a800049
+ - devicePath: /dev/disk/by-id/some-random-clusterb9772-pvc-8bf50554-fd42-11e6-94d4-42010a800049
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-8bf50554-fd42-11e6-94d4-42010a800049
+ - devicePath: /dev/disk/by-id/some-random-clusterb9772-pvc-8fb5e386-4641-11e7-a490-42010a800283
+ name: kubernetes.io/pd/some-random-clusterb9772-pvc-8fb5e386-4641-11e7-a490-42010a800283
+ volumesInUse:
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-72e1c7f1-fd41-11e6-94d4-42010a800049
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-8895a852-fd42-11e6-94d4-42010a800049
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-8bf50554-fd42-11e6-94d4-42010a800049
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-8fb5e386-4641-11e7-a490-42010a800283
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-c2435a06-14d7-11e7-9baf-42010a800049
+ - kubernetes.io/pd/some-random-clusterb9772-pvc-c787c67d-14d7-11e7-9baf-42010a800049
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/pod.yaml b/vendor/k8s.io/apimachinery/pkg/util/managedfields/pod.yaml
new file mode 100644
index 000000000..3fb0877d6
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/pod.yaml
@@ -0,0 +1,121 @@
+apiVersion: v1
+kind: Pod
+metadata:
+ labels:
+ app: some-app
+ plugin1: some-value
+ plugin2: some-value
+ plugin3: some-value
+ plugin4: some-value
+ name: some-name
+ namespace: default
+ ownerReferences:
+ - apiVersion: apps/v1
+ blockOwnerDeletion: true
+ controller: true
+ kind: ReplicaSet
+ name: some-name
+ uid: 0a9d2b9e-779e-11e7-b422-42010a8001be
+spec:
+ containers:
+ - args:
+ - one
+ - two
+ - three
+ - four
+ - five
+ - six
+ - seven
+ - eight
+ - nine
+ env:
+ - name: VAR_3
+ valueFrom:
+ secretKeyRef:
+ key: some-other-key
+ name: some-oher-name
+ - name: VAR_2
+ valueFrom:
+ secretKeyRef:
+ key: other-key
+ name: other-name
+ - name: VAR_1
+ valueFrom:
+ secretKeyRef:
+ key: some-key
+ name: some-name
+ image: some-image-name
+ imagePullPolicy: IfNotPresent
+ name: some-name
+ resources:
+ requests:
+ cpu: '0'
+ terminationMessagePath: /dev/termination-log
+ terminationMessagePolicy: File
+ volumeMounts:
+ - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
+ name: default-token-hu5jz
+ readOnly: true
+ dnsPolicy: ClusterFirst
+ nodeName: node-name
+ priority: 0
+ restartPolicy: Always
+ schedulerName: default-scheduler
+ securityContext: {}
+ serviceAccount: default
+ serviceAccountName: default
+ terminationGracePeriodSeconds: 30
+ tolerations:
+ - effect: NoExecute
+ key: node.kubernetes.io/not-ready
+ operator: Exists
+ tolerationSeconds: 300
+ - effect: NoExecute
+ key: node.kubernetes.io/unreachable
+ operator: Exists
+ tolerationSeconds: 300
+ volumes:
+ - name: default-token-hu5jz
+ secret:
+ defaultMode: 420
+ secretName: default-token-hu5jz
+status:
+ conditions:
+ - lastProbeTime: null
+ lastTransitionTime: '2019-07-08T09:31:18Z'
+ status: 'True'
+ type: Initialized
+ - lastProbeTime: null
+ lastTransitionTime: '2019-07-08T09:41:59Z'
+ status: 'True'
+ type: Ready
+ - lastProbeTime: null
+ lastTransitionTime: null
+ status: 'True'
+ type: ContainersReady
+ - lastProbeTime: null
+ lastTransitionTime: '2019-07-08T09:31:18Z'
+ status: 'True'
+ type: PodScheduled
+ containerStatuses:
+ - containerID: docker://885e82a1ed0b7356541bb410a0126921ac42439607c09875cd8097dd5d7b5376
+ image: some-image-name
+ imageID: docker-pullable://some-image-id
+ lastState:
+ terminated:
+ containerID: docker://d57290f9e00fad626b20d2dd87a3cf69bbc22edae07985374f86a8b2b4e39565
+ exitCode: 255
+ finishedAt: '2019-07-08T09:39:09Z'
+ reason: Error
+ startedAt: '2019-07-08T09:38:54Z'
+ name: name
+ ready: true
+ restartCount: 6
+ state:
+ running:
+ startedAt: '2019-07-08T09:41:59Z'
+ hostIP: 10.0.0.1
+ phase: Running
+ podIP: 10.0.0.1
+ qosClass: BestEffort
+ startTime: '2019-07-08T09:31:18Z'
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/scalehandler.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/scalehandler.go
new file mode 100644
index 000000000..48b774cec
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/scalehandler.go
@@ -0,0 +1,174 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package managedfields
+
+import (
+ "fmt"
+
+ "k8s.io/apimachinery/pkg/api/meta"
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+ "k8s.io/apimachinery/pkg/util/managedfields/internal"
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+)
+
+var (
+ scaleGroupVersion = schema.GroupVersion{Group: "autoscaling", Version: "v1"}
+ replicasPathInScale = fieldpath.MakePathOrDie("spec", "replicas")
+)
+
+// ResourcePathMappings maps a group/version to its replicas path. The
+// assumption is that all the paths correspond to leaf fields.
+type ResourcePathMappings map[string]fieldpath.Path
+
+// ScaleHandler manages the conversion of managed fields between a main
+// resource and the scale subresource
+type ScaleHandler struct {
+ parentEntries []metav1.ManagedFieldsEntry
+ groupVersion schema.GroupVersion
+ mappings ResourcePathMappings
+}
+
+// NewScaleHandler creates a new ScaleHandler
+func NewScaleHandler(parentEntries []metav1.ManagedFieldsEntry, groupVersion schema.GroupVersion, mappings ResourcePathMappings) *ScaleHandler {
+ return &ScaleHandler{
+ parentEntries: parentEntries,
+ groupVersion: groupVersion,
+ mappings: mappings,
+ }
+}
+
+// ToSubresource filter the managed fields of the main resource and convert
+// them so that they can be handled by scale.
+// For the managed fields that have a replicas path it performs two changes:
+// 1. APIVersion is changed to the APIVersion of the scale subresource
+// 2. Replicas path of the main resource is transformed to the replicas path of
+// the scale subresource
+func (h *ScaleHandler) ToSubresource() ([]metav1.ManagedFieldsEntry, error) {
+ managed, err := internal.DecodeManagedFields(h.parentEntries)
+ if err != nil {
+ return nil, err
+ }
+
+ f := fieldpath.ManagedFields{}
+ t := map[string]*metav1.Time{}
+ for manager, versionedSet := range managed.Fields() {
+ path, ok := h.mappings[string(versionedSet.APIVersion())]
+ // Skip the entry if the APIVersion is unknown
+ if !ok || path == nil {
+ continue
+ }
+
+ if versionedSet.Set().Has(path) {
+ newVersionedSet := fieldpath.NewVersionedSet(
+ fieldpath.NewSet(replicasPathInScale),
+ fieldpath.APIVersion(scaleGroupVersion.String()),
+ versionedSet.Applied(),
+ )
+
+ f[manager] = newVersionedSet
+ t[manager] = managed.Times()[manager]
+ }
+ }
+
+ return managedFieldsEntries(internal.NewManaged(f, t))
+}
+
+// ToParent merges `scaleEntries` with the entries of the main resource and
+// transforms them accordingly
+func (h *ScaleHandler) ToParent(scaleEntries []metav1.ManagedFieldsEntry) ([]metav1.ManagedFieldsEntry, error) {
+ decodedParentEntries, err := internal.DecodeManagedFields(h.parentEntries)
+ if err != nil {
+ return nil, err
+ }
+ parentFields := decodedParentEntries.Fields()
+
+ decodedScaleEntries, err := internal.DecodeManagedFields(scaleEntries)
+ if err != nil {
+ return nil, err
+ }
+ scaleFields := decodedScaleEntries.Fields()
+
+ f := fieldpath.ManagedFields{}
+ t := map[string]*metav1.Time{}
+
+ for manager, versionedSet := range parentFields {
+ // Get the main resource "replicas" path
+ path, ok := h.mappings[string(versionedSet.APIVersion())]
+ // Drop the entry if the APIVersion is unknown.
+ if !ok {
+ continue
+ }
+
+ // If the parent entry does not have the replicas path or it is nil, just
+ // keep it as it is. The path is nil for Custom Resources without scale
+ // subresource.
+ if path == nil || !versionedSet.Set().Has(path) {
+ f[manager] = versionedSet
+ t[manager] = decodedParentEntries.Times()[manager]
+ continue
+ }
+
+ if _, ok := scaleFields[manager]; !ok {
+ // "Steal" the replicas path from the main resource entry
+ newSet := versionedSet.Set().Difference(fieldpath.NewSet(path))
+
+ if !newSet.Empty() {
+ newVersionedSet := fieldpath.NewVersionedSet(
+ newSet,
+ versionedSet.APIVersion(),
+ versionedSet.Applied(),
+ )
+ f[manager] = newVersionedSet
+ t[manager] = decodedParentEntries.Times()[manager]
+ }
+ } else {
+ // Field wasn't stolen, let's keep the entry as it is.
+ f[manager] = versionedSet
+ t[manager] = decodedParentEntries.Times()[manager]
+ delete(scaleFields, manager)
+ }
+ }
+
+ for manager, versionedSet := range scaleFields {
+ if !versionedSet.Set().Has(replicasPathInScale) {
+ continue
+ }
+ newVersionedSet := fieldpath.NewVersionedSet(
+ fieldpath.NewSet(h.mappings[h.groupVersion.String()]),
+ fieldpath.APIVersion(h.groupVersion.String()),
+ versionedSet.Applied(),
+ )
+ f[manager] = newVersionedSet
+ t[manager] = decodedParentEntries.Times()[manager]
+ }
+
+ return managedFieldsEntries(internal.NewManaged(f, t))
+}
+
+func managedFieldsEntries(entries internal.ManagedInterface) ([]metav1.ManagedFieldsEntry, error) {
+ obj := &unstructured.Unstructured{Object: map[string]interface{}{}}
+ if err := internal.EncodeObjectManagedFields(obj, entries); err != nil {
+ return nil, err
+ }
+ accessor, err := meta.Accessor(obj)
+ if err != nil {
+ panic(fmt.Sprintf("couldn't get accessor: %v", err))
+ }
+ return accessor.GetManagedFields(), nil
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/typeconverter.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/typeconverter.go
new file mode 100644
index 000000000..d031eefaa
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/typeconverter.go
@@ -0,0 +1,47 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package managedfields
+
+import (
+ "k8s.io/apimachinery/pkg/util/managedfields/internal"
+ "k8s.io/kube-openapi/pkg/validation/spec"
+)
+
+// TypeConverter allows you to convert from runtime.Object to
+// typed.TypedValue and the other way around.
+type TypeConverter = internal.TypeConverter
+
+// NewDeducedTypeConverter creates a TypeConverter for CRDs that don't
+// have a schema. It does implement the same interface though (and
+// create the same types of objects), so that everything can still work
+// the same. CRDs are merged with all their fields being "atomic" (lists
+// included).
+func NewDeducedTypeConverter() TypeConverter {
+ return internal.NewDeducedTypeConverter()
+}
+
+// NewTypeConverter builds a TypeConverter from a map of OpenAPIV3 schemas.
+// This will automatically find the proper version of the object, and the
+// corresponding schema information.
+// The keys to the map must be consistent with the names
+// used by Refs within the schemas.
+// The schemas should conform to the Kubernetes Structural Schema OpenAPI
+// restrictions found in docs:
+// https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema
+func NewTypeConverter(openapiSpec map[string]*spec.Schema, preserveUnknownFields bool) (TypeConverter, error) {
+ return internal.NewTypeConverter(openapiSpec, preserveUnknownFields)
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go
index e39627568..25626cf3a 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go
@@ -20,7 +20,7 @@ import (
"fmt"
"reflect"
- "github.com/davecgh/go-spew/spew"
+ "k8s.io/apimachinery/pkg/util/dump"
"sigs.k8s.io/yaml"
)
@@ -76,7 +76,7 @@ func ToYAMLOrError(v interface{}) string {
func toYAML(v interface{}) (string, error) {
y, err := yaml.Marshal(v)
if err != nil {
- return "", fmt.Errorf("yaml marshal failed:%v\n%v\n", err, spew.Sdump(v))
+ return "", fmt.Errorf("yaml marshal failed:%v\n%v\n", err, dump.Pretty(v))
}
return string(y), nil
@@ -88,8 +88,7 @@ func toYAML(v interface{}) (string, error) {
// supports JSON merge patch semantics.
//
// NOTE: Numbers with different types (e.g. int(0) vs int64(0)) will be detected as conflicts.
-//
-// Make sure the unmarshaling of left and right are consistent (e.g. use the same library).
+// Make sure the unmarshaling of left and right are consistent (e.g. use the same library).
func HasConflicts(left, right interface{}) (bool, error) {
switch typedLeft := left.(type) {
case map[string]interface{}:
diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/util.go b/vendor/k8s.io/apimachinery/pkg/util/net/util.go
index 1c2aba55f..1635e69a5 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/net/util.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/net/util.go
@@ -20,6 +20,7 @@ import (
"errors"
"net"
"reflect"
+ "strings"
"syscall"
)
@@ -47,6 +48,11 @@ func IsConnectionReset(err error) bool {
return false
}
+// Returns if the given err is "http2: client connection lost" error.
+func IsHTTP2ConnectionLost(err error) bool {
+ return err != nil && strings.Contains(err.Error(), "http2: client connection lost")
+}
+
// Returns if the given err is "connection refused" error
func IsConnectionRefused(err error) bool {
var errno syscall.Errno
diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
index d738725ca..4fe0c5eb2 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
@@ -17,6 +17,7 @@ limitations under the License.
package runtime
import (
+ "context"
"fmt"
"net/http"
"runtime"
@@ -35,7 +36,7 @@ var (
)
// PanicHandlers is a list of functions which will be invoked when a panic happens.
-var PanicHandlers = []func(interface{}){logPanic}
+var PanicHandlers = []func(context.Context, interface{}){logPanic}
// HandleCrash simply catches a crash and logs an error. Meant to be called via
// defer. Additional context-specific handlers can be provided, and will be
@@ -43,23 +44,54 @@ var PanicHandlers = []func(interface{}){logPanic}
// handlers and logging the panic message.
//
// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
+//
+// TODO(pohly): logcheck:context // HandleCrashWithContext should be used instead of HandleCrash in code which supports contextual logging.
func HandleCrash(additionalHandlers ...func(interface{})) {
if r := recover(); r != nil {
- for _, fn := range PanicHandlers {
- fn(r)
- }
- for _, fn := range additionalHandlers {
- fn(r)
- }
- if ReallyCrash {
- // Actually proceed to panic.
- panic(r)
+ additionalHandlersWithContext := make([]func(context.Context, interface{}), len(additionalHandlers))
+ for i, handler := range additionalHandlers {
+ handler := handler // capture loop variable
+ additionalHandlersWithContext[i] = func(_ context.Context, r interface{}) {
+ handler(r)
+ }
}
+
+ handleCrash(context.Background(), r, additionalHandlersWithContext...)
+ }
+}
+
+// HandleCrashWithContext simply catches a crash and logs an error. Meant to be called via
+// defer. Additional context-specific handlers can be provided, and will be
+// called in case of panic. HandleCrash actually crashes, after calling the
+// handlers and logging the panic message.
+//
+// E.g., you can provide one or more additional handlers for something like shutting down go routines gracefully.
+//
+// The context is used to determine how to log.
+func HandleCrashWithContext(ctx context.Context, additionalHandlers ...func(context.Context, interface{})) {
+ if r := recover(); r != nil {
+ handleCrash(ctx, r, additionalHandlers...)
+ }
+}
+
+// handleCrash is the common implementation of HandleCrash and HandleCrash.
+// Having those call a common implementation ensures that the stack depth
+// is the same regardless through which path the handlers get invoked.
+func handleCrash(ctx context.Context, r any, additionalHandlers ...func(context.Context, interface{})) {
+ for _, fn := range PanicHandlers {
+ fn(ctx, r)
+ }
+ for _, fn := range additionalHandlers {
+ fn(ctx, r)
+ }
+ if ReallyCrash {
+ // Actually proceed to panic.
+ panic(r)
}
}
// logPanic logs the caller tree when a panic occurs (except in the special case of http.ErrAbortHandler).
-func logPanic(r interface{}) {
+func logPanic(ctx context.Context, r interface{}) {
if r == http.ErrAbortHandler {
// honor the http.ErrAbortHandler sentinel panic value:
// ErrAbortHandler is a sentinel panic value to abort a handler.
@@ -73,10 +105,20 @@ func logPanic(r interface{}) {
const size = 64 << 10
stacktrace := make([]byte, size)
stacktrace = stacktrace[:runtime.Stack(stacktrace, false)]
+
+ // We don't really know how many call frames to skip because the Go
+ // panic handler is between us and the code where the panic occurred.
+ // If it's one function (as in Go 1.21), then skipping four levels
+ // gets us to the function which called the `defer HandleCrashWithontext(...)`.
+ logger := klog.FromContext(ctx).WithCallDepth(4)
+
+ // For backwards compatibility, conversion to string
+ // is handled here instead of defering to the logging
+ // backend.
if _, ok := r.(string); ok {
- klog.Errorf("Observed a panic: %s\n%s", r, stacktrace)
+ logger.Error(nil, "Observed a panic", "panic", r, "stacktrace", string(stacktrace))
} else {
- klog.Errorf("Observed a panic: %#v (%v)\n%s", r, r, stacktrace)
+ logger.Error(nil, "Observed a panic", "panic", fmt.Sprintf("%v", r), "panicGoValue", fmt.Sprintf("%#v", r), "stacktrace", string(stacktrace))
}
}
@@ -84,35 +126,76 @@ func logPanic(r interface{}) {
// error occurs.
// TODO(lavalamp): for testability, this and the below HandleError function
// should be packaged up into a testable and reusable object.
-var ErrorHandlers = []func(error){
+var ErrorHandlers = []ErrorHandler{
logError,
- (&rudimentaryErrorBackoff{
- lastErrorTime: time.Now(),
- // 1ms was the number folks were able to stomach as a global rate limit.
- // If you need to log errors more than 1000 times a second you
- // should probably consider fixing your code instead. :)
- minPeriod: time.Millisecond,
- }).OnError,
+ func(_ context.Context, _ error, _ string, _ ...interface{}) {
+ (&rudimentaryErrorBackoff{
+ lastErrorTime: time.Now(),
+ // 1ms was the number folks were able to stomach as a global rate limit.
+ // If you need to log errors more than 1000 times a second you
+ // should probably consider fixing your code instead. :)
+ minPeriod: time.Millisecond,
+ }).OnError()
+ },
}
+type ErrorHandler func(ctx context.Context, err error, msg string, keysAndValues ...interface{})
+
// HandlerError is a method to invoke when a non-user facing piece of code cannot
// return an error and needs to indicate it has been ignored. Invoking this method
// is preferable to logging the error - the default behavior is to log but the
// errors may be sent to a remote server for analysis.
+//
+// TODO(pohly): logcheck:context // HandleErrorWithContext should be used instead of HandleError in code which supports contextual logging.
func HandleError(err error) {
// this is sometimes called with a nil error. We probably shouldn't fail and should do nothing instead
if err == nil {
return
}
+ handleError(context.Background(), err, "Unhandled Error")
+}
+
+// HandlerErrorWithContext is a method to invoke when a non-user facing piece of code cannot
+// return an error and needs to indicate it has been ignored. Invoking this method
+// is preferable to logging the error - the default behavior is to log but the
+// errors may be sent to a remote server for analysis. The context is used to
+// determine how to log the error.
+//
+// If contextual logging is enabled, the default log output is equivalent to
+//
+// logr.FromContext(ctx).WithName("UnhandledError").Error(err, msg, keysAndValues...)
+//
+// Without contextual logging, it is equivalent to:
+//
+// klog.ErrorS(err, msg, keysAndValues...)
+//
+// In contrast to HandleError, passing nil for the error is still going to
+// trigger a log entry. Don't construct a new error or wrap an error
+// with fmt.Errorf. Instead, add additional information via the mssage
+// and key/value pairs.
+//
+// This variant should be used instead of HandleError because it supports
+// structured, contextual logging.
+func HandleErrorWithContext(ctx context.Context, err error, msg string, keysAndValues ...interface{}) {
+ handleError(ctx, err, msg, keysAndValues...)
+}
+
+// handleError is the common implementation of HandleError and HandleErrorWithContext.
+// Using this common implementation ensures that the stack depth
+// is the same regardless through which path the handlers get invoked.
+func handleError(ctx context.Context, err error, msg string, keysAndValues ...interface{}) {
for _, fn := range ErrorHandlers {
- fn(err)
+ fn(ctx, err, msg, keysAndValues...)
}
}
-// logError prints an error with the call stack of the location it was reported
-func logError(err error) {
- klog.ErrorDepth(2, err)
+// logError prints an error with the call stack of the location it was reported.
+// It expects to be called as -> HandleError[WithContext] -> handleError -> logError.
+func logError(ctx context.Context, err error, msg string, keysAndValues ...interface{}) {
+ logger := klog.FromContext(ctx).WithCallDepth(3)
+ logger = klog.LoggerWithName(logger, "UnhandledError")
+ logger.Error(err, msg, keysAndValues...) //nolint:logcheck // logcheck complains about unknown key/value pairs.
}
type rudimentaryErrorBackoff struct {
@@ -125,15 +208,18 @@ type rudimentaryErrorBackoff struct {
// OnError will block if it is called more often than the embedded period time.
// This will prevent overly tight hot error loops.
-func (r *rudimentaryErrorBackoff) OnError(error) {
+func (r *rudimentaryErrorBackoff) OnError() {
+ now := time.Now() // start the timer before acquiring the lock
r.lastErrorTimeLock.Lock()
- defer r.lastErrorTimeLock.Unlock()
- d := time.Since(r.lastErrorTime)
- if d < r.minPeriod {
- // If the time moves backwards for any reason, do nothing
- time.Sleep(r.minPeriod - d)
- }
+ d := now.Sub(r.lastErrorTime)
r.lastErrorTime = time.Now()
+ r.lastErrorTimeLock.Unlock()
+
+ // Do not sleep with the lock held because that causes all callers of HandleError to block.
+ // We only want the current goroutine to block.
+ // A negative or zero duration causes time.Sleep to return immediately.
+ // If the time moves backwards for any reason, do nothing.
+ time.Sleep(r.minPeriod - d)
}
// GetCaller returns the caller of the function that calls it.
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go b/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go
index 194883390..fd281bdb8 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/doc.go
@@ -16,4 +16,4 @@ limitations under the License.
// Package sets has generic set and specified sets. Generic set will
// replace specified ones over time. And specific ones are deprecated.
-package sets
+package sets // import "k8s.io/apimachinery/pkg/util/sets"
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/ordered.go b/vendor/k8s.io/apimachinery/pkg/util/sets/ordered.go
deleted file mode 100644
index 443dac62e..000000000
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/ordered.go
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright 2022 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package sets
-
-// ordered is a constraint that permits any ordered type: any type
-// that supports the operators < <= >= >.
-// If future releases of Go add new ordered types,
-// this constraint will be modified to include them.
-type ordered interface {
- integer | float | ~string
-}
-
-// integer is a constraint that permits any integer type.
-// If future releases of Go add new predeclared integer types,
-// this constraint will be modified to include them.
-type integer interface {
- signed | unsigned
-}
-
-// float is a constraint that permits any floating-point type.
-// If future releases of Go add new predeclared floating-point types,
-// this constraint will be modified to include them.
-type float interface {
- ~float32 | ~float64
-}
-
-// signed is a constraint that permits any signed integer type.
-// If future releases of Go add new predeclared signed integer types,
-// this constraint will be modified to include them.
-type signed interface {
- ~int | ~int8 | ~int16 | ~int32 | ~int64
-}
-
-// unsigned is a constraint that permits any unsigned integer type.
-// If future releases of Go add new predeclared unsigned integer types,
-// this constraint will be modified to include them.
-type unsigned interface {
- ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/set.go b/vendor/k8s.io/apimachinery/pkg/util/sets/set.go
index 99c292fed..cd961c8c5 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/sets/set.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/sets/set.go
@@ -17,6 +17,7 @@ limitations under the License.
package sets
import (
+ "cmp"
"sort"
)
@@ -37,7 +38,7 @@ func New[T comparable](items ...T) Set[T] {
// KeySet creates a Set from a keys of a map[comparable](? extends interface{}).
// If the value passed in is not actually a map, this will panic.
func KeySet[T comparable, V any](theMap map[T]V) Set[T] {
- ret := Set[T]{}
+ ret := make(Set[T], len(theMap))
for keyValue := range theMap {
ret.Insert(keyValue)
}
@@ -64,6 +65,14 @@ func (s Set[T]) Delete(items ...T) Set[T] {
return s
}
+// Clear empties the set.
+// It is preferable to replace the set with a newly constructed set,
+// but not all callers can do that (when there are other references to the map).
+func (s Set[T]) Clear() Set[T] {
+ clear(s)
+ return s
+}
+
// Has returns true if and only if item is contained in the set.
func (s Set[T]) Has(item T) bool {
_, contained := s[item]
@@ -179,7 +188,7 @@ func (s1 Set[T]) Equal(s2 Set[T]) bool {
return len(s1) == len(s2) && s1.IsSuperset(s2)
}
-type sortableSliceOfGeneric[T ordered] []T
+type sortableSliceOfGeneric[T cmp.Ordered] []T
func (g sortableSliceOfGeneric[T]) Len() int { return len(g) }
func (g sortableSliceOfGeneric[T]) Less(i, j int) bool { return less[T](g[i], g[j]) }
@@ -189,7 +198,7 @@ func (g sortableSliceOfGeneric[T]) Swap(i, j int) { g[i], g[j] = g[j], g[i]
//
// This is a separate function and not a method because not all types supported
// by Generic are ordered and only those can be sorted.
-func List[T ordered](s Set[T]) []T {
+func List[T cmp.Ordered](s Set[T]) []T {
res := make(sortableSliceOfGeneric[T], 0, len(s))
for key := range s {
res = append(res, key)
@@ -222,6 +231,6 @@ func (s Set[T]) Len() int {
return len(s)
}
-func less[T ordered](lhs, rhs T) bool {
+func less[T cmp.Ordered](lhs, rhs T) bool {
return lhs < rhs
}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS
index 4443bafd1..73244449f 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS
+++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS
@@ -1,6 +1,7 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
+ - apelisse
- pwittrock
reviewers:
- apelisse
diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go
index df305b712..85b0cfc07 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go
@@ -20,12 +20,17 @@ import (
"errors"
"fmt"
"reflect"
+ "strings"
"k8s.io/apimachinery/pkg/util/mergepatch"
forkedjson "k8s.io/apimachinery/third_party/forked/golang/json"
openapi "k8s.io/kube-openapi/pkg/util/proto"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
+const patchMergeKey = "x-kubernetes-patch-merge-key"
+const patchStrategy = "x-kubernetes-patch-strategy"
+
type PatchMeta struct {
patchStrategies []string
patchMergeKey string
@@ -148,6 +153,90 @@ func GetTagStructTypeOrDie(dataStruct interface{}) reflect.Type {
return t
}
+type PatchMetaFromOpenAPIV3 struct {
+ // SchemaList is required to resolve OpenAPI V3 references
+ SchemaList map[string]*spec.Schema
+ Schema *spec.Schema
+}
+
+func (s PatchMetaFromOpenAPIV3) traverse(key string) (PatchMetaFromOpenAPIV3, error) {
+ if s.Schema == nil {
+ return PatchMetaFromOpenAPIV3{}, nil
+ }
+ if len(s.Schema.Properties) == 0 {
+ return PatchMetaFromOpenAPIV3{}, fmt.Errorf("unable to find api field \"%s\"", key)
+ }
+ subschema, ok := s.Schema.Properties[key]
+ if !ok {
+ return PatchMetaFromOpenAPIV3{}, fmt.Errorf("unable to find api field \"%s\"", key)
+ }
+ return PatchMetaFromOpenAPIV3{SchemaList: s.SchemaList, Schema: &subschema}, nil
+}
+
+func resolve(l *PatchMetaFromOpenAPIV3) error {
+ if len(l.Schema.AllOf) > 0 {
+ l.Schema = &l.Schema.AllOf[0]
+ }
+ if refString := l.Schema.Ref.String(); refString != "" {
+ str := strings.TrimPrefix(refString, "#/components/schemas/")
+ sch, ok := l.SchemaList[str]
+ if ok {
+ l.Schema = sch
+ } else {
+ return fmt.Errorf("unable to resolve %s in OpenAPI V3", refString)
+ }
+ }
+ return nil
+}
+
+func (s PatchMetaFromOpenAPIV3) LookupPatchMetadataForStruct(key string) (LookupPatchMeta, PatchMeta, error) {
+ l, err := s.traverse(key)
+ if err != nil {
+ return l, PatchMeta{}, err
+ }
+ p := PatchMeta{}
+ f, ok := l.Schema.Extensions[patchMergeKey]
+ if ok {
+ p.SetPatchMergeKey(f.(string))
+ }
+ g, ok := l.Schema.Extensions[patchStrategy]
+ if ok {
+ p.SetPatchStrategies(strings.Split(g.(string), ","))
+ }
+
+ err = resolve(&l)
+ return l, p, err
+}
+
+func (s PatchMetaFromOpenAPIV3) LookupPatchMetadataForSlice(key string) (LookupPatchMeta, PatchMeta, error) {
+ l, err := s.traverse(key)
+ if err != nil {
+ return l, PatchMeta{}, err
+ }
+ p := PatchMeta{}
+ f, ok := l.Schema.Extensions[patchMergeKey]
+ if ok {
+ p.SetPatchMergeKey(f.(string))
+ }
+ g, ok := l.Schema.Extensions[patchStrategy]
+ if ok {
+ p.SetPatchStrategies(strings.Split(g.(string), ","))
+ }
+ if l.Schema.Items != nil {
+ l.Schema = l.Schema.Items.Schema
+ }
+ err = resolve(&l)
+ return l, p, err
+}
+
+func (s PatchMetaFromOpenAPIV3) Name() string {
+ schema := s.Schema
+ if len(schema.Type) > 0 {
+ return strings.Join(schema.Type, "")
+ }
+ return "Struct"
+}
+
type PatchMetaFromOpenAPI struct {
Schema openapi.Schema
}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
index 6fb369732..6825a808e 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go
@@ -1106,7 +1106,7 @@ func applyRetainKeysDirective(original, patch map[string]interface{}, options Me
// Then, sort them by the relative order in setElementOrder, patch list and live list.
// The precedence is $setElementOrder > order in patch list > order in live list.
// This function will delete the item after merging it to prevent process it again in the future.
-// Ref: https://git.k8s.io/community/contributors/design-proposals/cli/preserve-order-in-strategic-merge-patch.md
+// Ref: https://git.k8s.io/design-proposals-archive/cli/preserve-order-in-strategic-merge-patch.md
func mergePatchIntoOriginal(original, patch map[string]interface{}, schema LookupPatchMeta, mergeOptions MergeOptions) error {
for key, patchV := range patch {
// Do nothing if there is no ordering directive
@@ -1182,7 +1182,13 @@ func mergePatchIntoOriginal(original, patch map[string]interface{}, schema Looku
merged = originalFieldValue
case !foundOriginal && foundPatch:
// list was added
- merged = patchFieldValue
+ v, keep := removeDirectives(patchFieldValue)
+ if !keep {
+ // Shouldn't be possible since patchFieldValue is a slice
+ continue
+ }
+
+ merged = v.([]interface{})
case foundOriginal && foundPatch:
merged, err = mergeSliceHandler(originalList, patchList, subschema,
patchStrategy, patchMeta.GetPatchMergeKey(), false, mergeOptions)
@@ -1270,6 +1276,42 @@ func partitionMapsByPresentInList(original, partitionBy []interface{}, mergeKey
return patch, serverOnly, nil
}
+// Removes directives from an object and returns value to use instead and whether
+// or not the field/index should even be kept
+// May modify input
+func removeDirectives(obj interface{}) (interface{}, bool) {
+ if obj == nil {
+ return obj, true
+ } else if typedV, ok := obj.(map[string]interface{}); ok {
+ if _, hasDirective := typedV[directiveMarker]; hasDirective {
+ return nil, false
+ }
+
+ for k, v := range typedV {
+ var keep bool
+ typedV[k], keep = removeDirectives(v)
+ if !keep {
+ delete(typedV, k)
+ }
+ }
+ return typedV, true
+ } else if typedV, ok := obj.([]interface{}); ok {
+ var res []interface{}
+ if typedV != nil {
+ // Make sure res is non-nil if patch is non-nil
+ res = []interface{}{}
+ }
+ for _, v := range typedV {
+ if newV, keep := removeDirectives(v); keep {
+ res = append(res, newV)
+ }
+ }
+ return res, true
+ } else {
+ return obj, true
+ }
+}
+
// Merge fields from a patch map into the original map. Note: This may modify
// both the original map and the patch because getting a deep copy of a map in
// golang is highly non-trivial.
@@ -1319,6 +1361,10 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
// original. Otherwise, check if we want to preserve it or skip it.
// Preserving the null value is useful when we want to send an explicit
// delete to the API server.
+ // In some cases, this may lead to inconsistent behavior with create.
+ // ref: https://github.com/kubernetes/kubernetes/issues/123304
+ // To avoid breaking compatibility,
+ // we made corresponding changes on the client side to ensure that the create and patch behaviors are idempotent.
if patchV == nil {
delete(original, k)
if mergeOptions.IgnoreUnmatchedNulls {
@@ -1333,7 +1379,10 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
if mergeOptions.IgnoreUnmatchedNulls {
discardNullValuesFromPatch(patchV)
}
- original[k] = patchV
+ original[k], ok = removeDirectives(patchV)
+ if !ok {
+ delete(original, k)
+ }
}
continue
}
@@ -1345,7 +1394,10 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
if mergeOptions.IgnoreUnmatchedNulls {
discardNullValuesFromPatch(patchV)
}
- original[k] = patchV
+ original[k], ok = removeDirectives(patchV)
+ if !ok {
+ delete(original, k)
+ }
}
continue
}
@@ -1372,7 +1424,11 @@ func mergeMap(original, patch map[string]interface{}, schema LookupPatchMeta, me
}
original[k], err = mergeSliceHandler(original[k], patchV, subschema, patchStrategy, patchMeta.GetPatchMergeKey(), isDeleteList, mergeOptions)
default:
- original[k] = patchV
+ original[k], ok = removeDirectives(patchV)
+ if !ok {
+ // if patchV itself is a directive, then don't keep it
+ delete(original, k)
+ }
}
if err != nil {
return nil, err
@@ -1425,7 +1481,8 @@ func mergeSliceHandler(original, patch interface{}, schema LookupPatchMeta,
return nil, err
}
- if fieldPatchStrategy == mergeDirective {
+ // Delete lists are handled the same way regardless of what the field's patch strategy is
+ if fieldPatchStrategy == mergeDirective || isDeleteList {
return mergeSlice(typedOriginal, typedPatch, schema, fieldPatchMergeKey, mergeOptions, isDeleteList)
} else {
return typedPatch, nil
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/OWNERS b/vendor/k8s.io/apimachinery/pkg/util/validation/OWNERS
new file mode 100644
index 000000000..402373247
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/validation/OWNERS
@@ -0,0 +1,11 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+# Disable inheritance as this is an api owners file
+options:
+ no_parent_owners: true
+approvers:
+ - api-approvers
+reviewers:
+ - api-reviewers
+labels:
+ - kind/api-change
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
index ae73bda96..bc387d011 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go
@@ -200,12 +200,12 @@ func Invalid(field *Path, value interface{}, detail string) *Error {
// NotSupported returns a *Error indicating "unsupported value".
// This is used to report unknown values for enumerated fields (e.g. a list of
// valid values).
-func NotSupported(field *Path, value interface{}, validValues []string) *Error {
+func NotSupported[T ~string](field *Path, value interface{}, validValues []T) *Error {
detail := ""
if len(validValues) > 0 {
quotedValues := make([]string, len(validValues))
for i, v := range validValues {
- quotedValues[i] = strconv.Quote(v)
+ quotedValues[i] = strconv.Quote(fmt.Sprint(v))
}
detail = "supported values: " + strings.Join(quotedValues, ", ")
}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go b/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
index e767092dd..b32644902 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/validation/validation.go
@@ -19,10 +19,9 @@ package validation
import (
"fmt"
"math"
- "net"
"regexp"
- "strconv"
"strings"
+ "unicode"
"k8s.io/apimachinery/pkg/util/validation/field"
netutils "k8s.io/utils/net"
@@ -191,7 +190,13 @@ func IsDNS1123Label(value string) []string {
errs = append(errs, MaxLenError(DNS1123LabelMaxLength))
}
if !dns1123LabelRegexp.MatchString(value) {
- errs = append(errs, RegexError(dns1123LabelErrMsg, dns1123LabelFmt, "my-name", "123-abc"))
+ if dns1123SubdomainRegexp.MatchString(value) {
+ // It was a valid subdomain and not a valid label. Since we
+ // already checked length, it must be dots.
+ errs = append(errs, "must not contain dots")
+ } else {
+ errs = append(errs, RegexError(dns1123LabelErrMsg, dns1123LabelFmt, "my-name", "123-abc"))
+ }
}
return errs
}
@@ -346,11 +351,12 @@ func IsValidPortName(port string) []string {
}
// IsValidIP tests that the argument is a valid IP address.
-func IsValidIP(value string) []string {
+func IsValidIP(fldPath *field.Path, value string) field.ErrorList {
+ var allErrors field.ErrorList
if netutils.ParseIPSloppy(value) == nil {
- return []string{"must be a valid IP address, (e.g. 10.9.8.7 or 2001:db8::ffff)"}
+ allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid IP address, (e.g. 10.9.8.7 or 2001:db8::ffff)"))
}
- return nil
+ return allErrors
}
// IsValidIPv4Address tests that the argument is a valid IPv4 address.
@@ -373,6 +379,16 @@ func IsValidIPv6Address(fldPath *field.Path, value string) field.ErrorList {
return allErrors
}
+// IsValidCIDR tests that the argument is a valid CIDR value.
+func IsValidCIDR(fldPath *field.Path, value string) field.ErrorList {
+ var allErrors field.ErrorList
+ _, _, err := netutils.ParseCIDRSloppy(value)
+ if err != nil {
+ allErrors = append(allErrors, field.Invalid(fldPath, value, "must be a valid CIDR value, (e.g. 10.9.8.0/24 or 2001:db8::/64)"))
+ }
+ return allErrors
+}
+
const percentFmt string = "[0-9]+%"
const percentErrMsg string = "a valid percent string must be a numeric string followed by an ending '%'"
@@ -403,6 +419,9 @@ func IsHTTPHeaderName(value string) []string {
const envVarNameFmt = "[-._a-zA-Z][-._a-zA-Z0-9]*"
const envVarNameFmtErrMsg string = "a valid environment variable name must consist of alphabetic characters, digits, '_', '-', or '.', and must not start with a digit"
+// TODO(hirazawaui): Rename this when the RelaxedEnvironmentVariableValidation gate is removed.
+const relaxedEnvVarNameFmtErrMsg string = "a valid environment variable name must consist only of printable ASCII characters other than '='"
+
var envVarNameRegexp = regexp.MustCompile("^" + envVarNameFmt + "$")
// IsEnvVarName tests if a string is a valid environment variable name.
@@ -416,6 +435,24 @@ func IsEnvVarName(value string) []string {
return errs
}
+// IsRelaxedEnvVarName tests if a string is a valid environment variable name.
+func IsRelaxedEnvVarName(value string) []string {
+ var errs []string
+
+ if len(value) == 0 {
+ errs = append(errs, "environment variable name "+EmptyError())
+ }
+
+ for _, r := range value {
+ if r > unicode.MaxASCII || !unicode.IsPrint(r) || r == '=' {
+ errs = append(errs, relaxedEnvVarNameFmtErrMsg)
+ break
+ }
+ }
+
+ return errs
+}
+
const configMapKeyFmt = `[-._a-zA-Z0-9]+`
const configMapKeyErrMsg string = "a valid config key must consist of alphanumeric characters, '-', '_' or '.'"
@@ -487,18 +524,3 @@ func hasChDirPrefix(value string) []string {
}
return errs
}
-
-// IsValidSocketAddr checks that string represents a valid socket address
-// as defined in RFC 789. (e.g 0.0.0.0:10254 or [::]:10254))
-func IsValidSocketAddr(value string) []string {
- var errs []string
- ip, port, err := net.SplitHostPort(value)
- if err != nil {
- errs = append(errs, "must be a valid socket address format, (e.g. 0.0.0.0:10254 or [::]:10254)")
- return errs
- }
- portInt, _ := strconv.Atoi(port)
- errs = append(errs, IsValidPortNum(portInt)...)
- errs = append(errs, IsValidIP(ip)...)
- return errs
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go b/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go
new file mode 100644
index 000000000..418761925
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/backoff.go
@@ -0,0 +1,502 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "math"
+ "sync"
+ "time"
+
+ "k8s.io/apimachinery/pkg/util/runtime"
+ "k8s.io/utils/clock"
+)
+
+// Backoff holds parameters applied to a Backoff function.
+type Backoff struct {
+ // The initial duration.
+ Duration time.Duration
+ // Duration is multiplied by factor each iteration, if factor is not zero
+ // and the limits imposed by Steps and Cap have not been reached.
+ // Should not be negative.
+ // The jitter does not contribute to the updates to the duration parameter.
+ Factor float64
+ // The sleep at each iteration is the duration plus an additional
+ // amount chosen uniformly at random from the interval between
+ // zero and `jitter*duration`.
+ Jitter float64
+ // The remaining number of iterations in which the duration
+ // parameter may change (but progress can be stopped earlier by
+ // hitting the cap). If not positive, the duration is not
+ // changed. Used for exponential backoff in combination with
+ // Factor and Cap.
+ Steps int
+ // A limit on revised values of the duration parameter. If a
+ // multiplication by the factor parameter would make the duration
+ // exceed the cap then the duration is set to the cap and the
+ // steps parameter is set to zero.
+ Cap time.Duration
+}
+
+// Step returns an amount of time to sleep determined by the original
+// Duration and Jitter. The backoff is mutated to update its Steps and
+// Duration. A nil Backoff always has a zero-duration step.
+func (b *Backoff) Step() time.Duration {
+ if b == nil {
+ return 0
+ }
+ var nextDuration time.Duration
+ nextDuration, b.Duration, b.Steps = delay(b.Steps, b.Duration, b.Cap, b.Factor, b.Jitter)
+ return nextDuration
+}
+
+// DelayFunc returns a function that will compute the next interval to
+// wait given the arguments in b. It does not mutate the original backoff
+// but the function is safe to use only from a single goroutine.
+func (b Backoff) DelayFunc() DelayFunc {
+ steps := b.Steps
+ duration := b.Duration
+ cap := b.Cap
+ factor := b.Factor
+ jitter := b.Jitter
+
+ return func() time.Duration {
+ var nextDuration time.Duration
+ // jitter is applied per step and is not cumulative over multiple steps
+ nextDuration, duration, steps = delay(steps, duration, cap, factor, jitter)
+ return nextDuration
+ }
+}
+
+// Timer returns a timer implementation appropriate to this backoff's parameters
+// for use with wait functions.
+func (b Backoff) Timer() Timer {
+ if b.Steps > 1 || b.Jitter != 0 {
+ return &variableTimer{new: internalClock.NewTimer, fn: b.DelayFunc()}
+ }
+ if b.Duration > 0 {
+ return &fixedTimer{new: internalClock.NewTicker, interval: b.Duration}
+ }
+ return newNoopTimer()
+}
+
+// delay implements the core delay algorithm used in this package.
+func delay(steps int, duration, cap time.Duration, factor, jitter float64) (_ time.Duration, next time.Duration, nextSteps int) {
+ // when steps is non-positive, do not alter the base duration
+ if steps < 1 {
+ if jitter > 0 {
+ return Jitter(duration, jitter), duration, 0
+ }
+ return duration, duration, 0
+ }
+ steps--
+
+ // calculate the next step's interval
+ if factor != 0 {
+ next = time.Duration(float64(duration) * factor)
+ if cap > 0 && next > cap {
+ next = cap
+ steps = 0
+ }
+ } else {
+ next = duration
+ }
+
+ // add jitter for this step
+ if jitter > 0 {
+ duration = Jitter(duration, jitter)
+ }
+
+ return duration, next, steps
+
+}
+
+// DelayWithReset returns a DelayFunc that will return the appropriate next interval to
+// wait. Every resetInterval the backoff parameters are reset to their initial state.
+// This method is safe to invoke from multiple goroutines, but all calls will advance
+// the backoff state when Factor is set. If Factor is zero, this method is the same as
+// invoking b.DelayFunc() since Steps has no impact without Factor. If resetInterval is
+// zero no backoff will be performed as the same calling DelayFunc with a zero factor
+// and steps.
+func (b Backoff) DelayWithReset(c clock.Clock, resetInterval time.Duration) DelayFunc {
+ if b.Factor <= 0 {
+ return b.DelayFunc()
+ }
+ if resetInterval <= 0 {
+ b.Steps = 0
+ b.Factor = 0
+ return b.DelayFunc()
+ }
+ return (&backoffManager{
+ backoff: b,
+ initialBackoff: b,
+ resetInterval: resetInterval,
+
+ clock: c,
+ lastStart: c.Now(),
+ timer: nil,
+ }).Step
+}
+
+// Until loops until stop channel is closed, running f every period.
+//
+// Until is syntactic sugar on top of JitterUntil with zero jitter factor and
+// with sliding = true (which means the timer for period starts after the f
+// completes).
+func Until(f func(), period time.Duration, stopCh <-chan struct{}) {
+ JitterUntil(f, period, 0.0, true, stopCh)
+}
+
+// UntilWithContext loops until context is done, running f every period.
+//
+// UntilWithContext is syntactic sugar on top of JitterUntilWithContext
+// with zero jitter factor and with sliding = true (which means the timer
+// for period starts after the f completes).
+func UntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
+ JitterUntilWithContext(ctx, f, period, 0.0, true)
+}
+
+// NonSlidingUntil loops until stop channel is closed, running f every
+// period.
+//
+// NonSlidingUntil is syntactic sugar on top of JitterUntil with zero jitter
+// factor, with sliding = false (meaning the timer for period starts at the same
+// time as the function starts).
+func NonSlidingUntil(f func(), period time.Duration, stopCh <-chan struct{}) {
+ JitterUntil(f, period, 0.0, false, stopCh)
+}
+
+// NonSlidingUntilWithContext loops until context is done, running f every
+// period.
+//
+// NonSlidingUntilWithContext is syntactic sugar on top of JitterUntilWithContext
+// with zero jitter factor, with sliding = false (meaning the timer for period
+// starts at the same time as the function starts).
+func NonSlidingUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
+ JitterUntilWithContext(ctx, f, period, 0.0, false)
+}
+
+// JitterUntil loops until stop channel is closed, running f every period.
+//
+// If jitterFactor is positive, the period is jittered before every run of f.
+// If jitterFactor is not positive, the period is unchanged and not jittered.
+//
+// If sliding is true, the period is computed after f runs. If it is false then
+// period includes the runtime for f.
+//
+// Close stopCh to stop. f may not be invoked if stop channel is already
+// closed. Pass NeverStop to if you don't want it stop.
+func JitterUntil(f func(), period time.Duration, jitterFactor float64, sliding bool, stopCh <-chan struct{}) {
+ BackoffUntil(f, NewJitteredBackoffManager(period, jitterFactor, &clock.RealClock{}), sliding, stopCh)
+}
+
+// BackoffUntil loops until stop channel is closed, run f every duration given by BackoffManager.
+//
+// If sliding is true, the period is computed after f runs. If it is false then
+// period includes the runtime for f.
+func BackoffUntil(f func(), backoff BackoffManager, sliding bool, stopCh <-chan struct{}) {
+ var t clock.Timer
+ for {
+ select {
+ case <-stopCh:
+ return
+ default:
+ }
+
+ if !sliding {
+ t = backoff.Backoff()
+ }
+
+ func() {
+ defer runtime.HandleCrash()
+ f()
+ }()
+
+ if sliding {
+ t = backoff.Backoff()
+ }
+
+ // NOTE: b/c there is no priority selection in golang
+ // it is possible for this to race, meaning we could
+ // trigger t.C and stopCh, and t.C select falls through.
+ // In order to mitigate we re-check stopCh at the beginning
+ // of every loop to prevent extra executions of f().
+ select {
+ case <-stopCh:
+ if !t.Stop() {
+ <-t.C()
+ }
+ return
+ case <-t.C():
+ }
+ }
+}
+
+// JitterUntilWithContext loops until context is done, running f every period.
+//
+// If jitterFactor is positive, the period is jittered before every run of f.
+// If jitterFactor is not positive, the period is unchanged and not jittered.
+//
+// If sliding is true, the period is computed after f runs. If it is false then
+// period includes the runtime for f.
+//
+// Cancel context to stop. f may not be invoked if context is already expired.
+func JitterUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration, jitterFactor float64, sliding bool) {
+ JitterUntil(func() { f(ctx) }, period, jitterFactor, sliding, ctx.Done())
+}
+
+// backoffManager provides simple backoff behavior in a threadsafe manner to a caller.
+type backoffManager struct {
+ backoff Backoff
+ initialBackoff Backoff
+ resetInterval time.Duration
+
+ clock clock.Clock
+
+ lock sync.Mutex
+ lastStart time.Time
+ timer clock.Timer
+}
+
+// Step returns the expected next duration to wait.
+func (b *backoffManager) Step() time.Duration {
+ b.lock.Lock()
+ defer b.lock.Unlock()
+
+ switch {
+ case b.resetInterval == 0:
+ b.backoff = b.initialBackoff
+ case b.clock.Now().Sub(b.lastStart) > b.resetInterval:
+ b.backoff = b.initialBackoff
+ b.lastStart = b.clock.Now()
+ }
+ return b.backoff.Step()
+}
+
+// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer
+// for exponential backoff. The returned timer must be drained before calling Backoff() the second
+// time.
+func (b *backoffManager) Backoff() clock.Timer {
+ b.lock.Lock()
+ defer b.lock.Unlock()
+ if b.timer == nil {
+ b.timer = b.clock.NewTimer(b.Step())
+ } else {
+ b.timer.Reset(b.Step())
+ }
+ return b.timer
+}
+
+// Timer returns a new Timer instance that shares the clock and the reset behavior with all other
+// timers.
+func (b *backoffManager) Timer() Timer {
+ return DelayFunc(b.Step).Timer(b.clock)
+}
+
+// BackoffManager manages backoff with a particular scheme based on its underlying implementation.
+type BackoffManager interface {
+ // Backoff returns a shared clock.Timer that is Reset on every invocation. This method is not
+ // safe for use from multiple threads. It returns a timer for backoff, and caller shall backoff
+ // until Timer.C() drains. If the second Backoff() is called before the timer from the first
+ // Backoff() call finishes, the first timer will NOT be drained and result in undetermined
+ // behavior.
+ Backoff() clock.Timer
+}
+
+// Deprecated: Will be removed when the legacy polling functions are removed.
+type exponentialBackoffManagerImpl struct {
+ backoff *Backoff
+ backoffTimer clock.Timer
+ lastBackoffStart time.Time
+ initialBackoff time.Duration
+ backoffResetDuration time.Duration
+ clock clock.Clock
+}
+
+// NewExponentialBackoffManager returns a manager for managing exponential backoff. Each backoff is jittered and
+// backoff will not exceed the given max. If the backoff is not called within resetDuration, the backoff is reset.
+// This backoff manager is used to reduce load during upstream unhealthiness.
+//
+// Deprecated: Will be removed when the legacy Poll methods are removed. Callers should construct a
+// Backoff struct, use DelayWithReset() to get a DelayFunc that periodically resets itself, and then
+// invoke Timer() when calling wait.BackoffUntil.
+//
+// Instead of:
+//
+// bm := wait.NewExponentialBackoffManager(init, max, reset, factor, jitter, clock)
+// ...
+// wait.BackoffUntil(..., bm.Backoff, ...)
+//
+// Use:
+//
+// delayFn := wait.Backoff{
+// Duration: init,
+// Cap: max,
+// Steps: int(math.Ceil(float64(max) / float64(init))), // now a required argument
+// Factor: factor,
+// Jitter: jitter,
+// }.DelayWithReset(reset, clock)
+// wait.BackoffUntil(..., delayFn.Timer(), ...)
+func NewExponentialBackoffManager(initBackoff, maxBackoff, resetDuration time.Duration, backoffFactor, jitter float64, c clock.Clock) BackoffManager {
+ return &exponentialBackoffManagerImpl{
+ backoff: &Backoff{
+ Duration: initBackoff,
+ Factor: backoffFactor,
+ Jitter: jitter,
+
+ // the current impl of wait.Backoff returns Backoff.Duration once steps are used up, which is not
+ // what we ideally need here, we set it to max int and assume we will never use up the steps
+ Steps: math.MaxInt32,
+ Cap: maxBackoff,
+ },
+ backoffTimer: nil,
+ initialBackoff: initBackoff,
+ lastBackoffStart: c.Now(),
+ backoffResetDuration: resetDuration,
+ clock: c,
+ }
+}
+
+func (b *exponentialBackoffManagerImpl) getNextBackoff() time.Duration {
+ if b.clock.Now().Sub(b.lastBackoffStart) > b.backoffResetDuration {
+ b.backoff.Steps = math.MaxInt32
+ b.backoff.Duration = b.initialBackoff
+ }
+ b.lastBackoffStart = b.clock.Now()
+ return b.backoff.Step()
+}
+
+// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for exponential backoff.
+// The returned timer must be drained before calling Backoff() the second time
+func (b *exponentialBackoffManagerImpl) Backoff() clock.Timer {
+ if b.backoffTimer == nil {
+ b.backoffTimer = b.clock.NewTimer(b.getNextBackoff())
+ } else {
+ b.backoffTimer.Reset(b.getNextBackoff())
+ }
+ return b.backoffTimer
+}
+
+// Deprecated: Will be removed when the legacy polling functions are removed.
+type jitteredBackoffManagerImpl struct {
+ clock clock.Clock
+ duration time.Duration
+ jitter float64
+ backoffTimer clock.Timer
+}
+
+// NewJitteredBackoffManager returns a BackoffManager that backoffs with given duration plus given jitter. If the jitter
+// is negative, backoff will not be jittered.
+//
+// Deprecated: Will be removed when the legacy Poll methods are removed. Callers should construct a
+// Backoff struct and invoke Timer() when calling wait.BackoffUntil.
+//
+// Instead of:
+//
+// bm := wait.NewJitteredBackoffManager(duration, jitter, clock)
+// ...
+// wait.BackoffUntil(..., bm.Backoff, ...)
+//
+// Use:
+//
+// wait.BackoffUntil(..., wait.Backoff{Duration: duration, Jitter: jitter}.Timer(), ...)
+func NewJitteredBackoffManager(duration time.Duration, jitter float64, c clock.Clock) BackoffManager {
+ return &jitteredBackoffManagerImpl{
+ clock: c,
+ duration: duration,
+ jitter: jitter,
+ backoffTimer: nil,
+ }
+}
+
+func (j *jitteredBackoffManagerImpl) getNextBackoff() time.Duration {
+ jitteredPeriod := j.duration
+ if j.jitter > 0.0 {
+ jitteredPeriod = Jitter(j.duration, j.jitter)
+ }
+ return jitteredPeriod
+}
+
+// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for jittered backoff.
+// The returned timer must be drained before calling Backoff() the second time
+func (j *jitteredBackoffManagerImpl) Backoff() clock.Timer {
+ backoff := j.getNextBackoff()
+ if j.backoffTimer == nil {
+ j.backoffTimer = j.clock.NewTimer(backoff)
+ } else {
+ j.backoffTimer.Reset(backoff)
+ }
+ return j.backoffTimer
+}
+
+// ExponentialBackoff repeats a condition check with exponential backoff.
+//
+// It repeatedly checks the condition and then sleeps, using `backoff.Step()`
+// to determine the length of the sleep and adjust Duration and Steps.
+// Stops and returns as soon as:
+// 1. the condition check returns true or an error,
+// 2. `backoff.Steps` checks of the condition have been done, or
+// 3. a sleep truncated by the cap on duration has been completed.
+// In case (1) the returned error is what the condition function returned.
+// In all other cases, ErrWaitTimeout is returned.
+//
+// Since backoffs are often subject to cancellation, we recommend using
+// ExponentialBackoffWithContext and passing a context to the method.
+func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error {
+ for backoff.Steps > 0 {
+ if ok, err := runConditionWithCrashProtection(condition); err != nil || ok {
+ return err
+ }
+ if backoff.Steps == 1 {
+ break
+ }
+ time.Sleep(backoff.Step())
+ }
+ return ErrWaitTimeout
+}
+
+// ExponentialBackoffWithContext repeats a condition check with exponential backoff.
+// It immediately returns an error if the condition returns an error, the context is cancelled
+// or hits the deadline, or if the maximum attempts defined in backoff is exceeded (ErrWaitTimeout).
+// If an error is returned by the condition the backoff stops immediately. The condition will
+// never be invoked more than backoff.Steps times.
+func ExponentialBackoffWithContext(ctx context.Context, backoff Backoff, condition ConditionWithContextFunc) error {
+ for backoff.Steps > 0 {
+ select {
+ case <-ctx.Done():
+ return ctx.Err()
+ default:
+ }
+
+ if ok, err := runConditionWithCrashProtectionWithContext(ctx, condition); err != nil || ok {
+ return err
+ }
+
+ if backoff.Steps == 1 {
+ break
+ }
+
+ waitBeforeRetry := backoff.Step()
+ select {
+ case <-ctx.Done():
+ return ctx.Err()
+ case <-time.After(waitBeforeRetry):
+ }
+ }
+
+ return ErrWaitTimeout
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/delay.go b/vendor/k8s.io/apimachinery/pkg/util/wait/delay.go
new file mode 100644
index 000000000..1d3dcaa74
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/delay.go
@@ -0,0 +1,51 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "sync"
+ "time"
+
+ "k8s.io/utils/clock"
+)
+
+// DelayFunc returns the next time interval to wait.
+type DelayFunc func() time.Duration
+
+// Timer takes an arbitrary delay function and returns a timer that can handle arbitrary interval changes.
+// Use Backoff{...}.Timer() for simple delays and more efficient timers.
+func (fn DelayFunc) Timer(c clock.Clock) Timer {
+ return &variableTimer{fn: fn, new: c.NewTimer}
+}
+
+// Until takes an arbitrary delay function and runs until cancelled or the condition indicates exit. This
+// offers all of the functionality of the methods in this package.
+func (fn DelayFunc) Until(ctx context.Context, immediate, sliding bool, condition ConditionWithContextFunc) error {
+ return loopConditionUntilContext(ctx, &variableTimer{fn: fn, new: internalClock.NewTimer}, immediate, sliding, condition)
+}
+
+// Concurrent returns a version of this DelayFunc that is safe for use by multiple goroutines that
+// wish to share a single delay timer.
+func (fn DelayFunc) Concurrent() DelayFunc {
+ var lock sync.Mutex
+ return func() time.Duration {
+ lock.Lock()
+ defer lock.Unlock()
+ return fn()
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/error.go b/vendor/k8s.io/apimachinery/pkg/util/wait/error.go
new file mode 100644
index 000000000..dd75801d8
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/error.go
@@ -0,0 +1,96 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "errors"
+)
+
+// ErrWaitTimeout is returned when the condition was not satisfied in time.
+//
+// Deprecated: This type will be made private in favor of Interrupted()
+// for checking errors or ErrorInterrupted(err) for returning a wrapped error.
+var ErrWaitTimeout = ErrorInterrupted(errors.New("timed out waiting for the condition"))
+
+// Interrupted returns true if the error indicates a Poll, ExponentialBackoff, or
+// Until loop exited for any reason besides the condition returning true or an
+// error. A loop is considered interrupted if the calling context is cancelled,
+// the context reaches its deadline, or a backoff reaches its maximum allowed
+// steps.
+//
+// Callers should use this method instead of comparing the error value directly to
+// ErrWaitTimeout, as methods that cancel a context may not return that error.
+//
+// Instead of:
+//
+// err := wait.Poll(...)
+// if err == wait.ErrWaitTimeout {
+// log.Infof("Wait for operation exceeded")
+// } else ...
+//
+// Use:
+//
+// err := wait.Poll(...)
+// if wait.Interrupted(err) {
+// log.Infof("Wait for operation exceeded")
+// } else ...
+func Interrupted(err error) bool {
+ switch {
+ case errors.Is(err, errWaitTimeout),
+ errors.Is(err, context.Canceled),
+ errors.Is(err, context.DeadlineExceeded):
+ return true
+ default:
+ return false
+ }
+}
+
+// errInterrupted
+type errInterrupted struct {
+ cause error
+}
+
+// ErrorInterrupted returns an error that indicates the wait was ended
+// early for a given reason. If no cause is provided a generic error
+// will be used but callers are encouraged to provide a real cause for
+// clarity in debugging.
+func ErrorInterrupted(cause error) error {
+ switch cause.(type) {
+ case errInterrupted:
+ // no need to wrap twice since errInterrupted is only needed
+ // once in a chain
+ return cause
+ default:
+ return errInterrupted{cause}
+ }
+}
+
+// errWaitTimeout is the private version of the previous ErrWaitTimeout
+// and is private to prevent direct comparison. Use ErrorInterrupted(err)
+// to get an error that will return true for Interrupted(err).
+var errWaitTimeout = errInterrupted{}
+
+func (e errInterrupted) Unwrap() error { return e.cause }
+func (e errInterrupted) Is(target error) bool { return target == errWaitTimeout }
+func (e errInterrupted) Error() string {
+ if e.cause == nil {
+ // returns the same error message as historical behavior
+ return "timed out waiting for the condition"
+ }
+ return e.cause.Error()
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go b/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go
new file mode 100644
index 000000000..107bfc132
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/loop.go
@@ -0,0 +1,95 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "time"
+
+ "k8s.io/apimachinery/pkg/util/runtime"
+)
+
+// loopConditionUntilContext executes the provided condition at intervals defined by
+// the provided timer until the provided context is cancelled, the condition returns
+// true, or the condition returns an error. If sliding is true, the period is computed
+// after condition runs. If it is false then period includes the runtime for condition.
+// If immediate is false the first delay happens before any call to condition, if
+// immediate is true the condition will be invoked before waiting and guarantees that
+// the condition is invoked at least once, regardless of whether the context has been
+// cancelled. The returned error is the error returned by the last condition or the
+// context error if the context was terminated.
+//
+// This is the common loop construct for all polling in the wait package.
+func loopConditionUntilContext(ctx context.Context, t Timer, immediate, sliding bool, condition ConditionWithContextFunc) error {
+ defer t.Stop()
+
+ var timeCh <-chan time.Time
+ doneCh := ctx.Done()
+
+ if !sliding {
+ timeCh = t.C()
+ }
+
+ // if immediate is true the condition is
+ // guaranteed to be executed at least once,
+ // if we haven't requested immediate execution, delay once
+ if immediate {
+ if ok, err := func() (bool, error) {
+ defer runtime.HandleCrash()
+ return condition(ctx)
+ }(); err != nil || ok {
+ return err
+ }
+ }
+
+ if sliding {
+ timeCh = t.C()
+ }
+
+ for {
+
+ // Wait for either the context to be cancelled or the next invocation be called
+ select {
+ case <-doneCh:
+ return ctx.Err()
+ case <-timeCh:
+ }
+
+ // IMPORTANT: Because there is no channel priority selection in golang
+ // it is possible for very short timers to "win" the race in the previous select
+ // repeatedly even when the context has been canceled. We therefore must
+ // explicitly check for context cancellation on every loop and exit if true to
+ // guarantee that we don't invoke condition more than once after context has
+ // been cancelled.
+ if err := ctx.Err(); err != nil {
+ return err
+ }
+
+ if !sliding {
+ t.Next()
+ }
+ if ok, err := func() (bool, error) {
+ defer runtime.HandleCrash()
+ return condition(ctx)
+ }(); err != nil || ok {
+ return err
+ }
+ if sliding {
+ t.Next()
+ }
+ }
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/poll.go b/vendor/k8s.io/apimachinery/pkg/util/wait/poll.go
new file mode 100644
index 000000000..231d4c384
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/poll.go
@@ -0,0 +1,315 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "context"
+ "time"
+)
+
+// PollUntilContextCancel tries a condition func until it returns true, an error, or the context
+// is cancelled or hits a deadline. condition will be invoked after the first interval if the
+// context is not cancelled first. The returned error will be from ctx.Err(), the condition's
+// err return value, or nil. If invoking condition takes longer than interval the next condition
+// will be invoked immediately. When using very short intervals, condition may be invoked multiple
+// times before a context cancellation is detected. If immediate is true, condition will be
+// invoked before waiting and guarantees that condition is invoked at least once, regardless of
+// whether the context has been cancelled.
+func PollUntilContextCancel(ctx context.Context, interval time.Duration, immediate bool, condition ConditionWithContextFunc) error {
+ return loopConditionUntilContext(ctx, Backoff{Duration: interval}.Timer(), immediate, false, condition)
+}
+
+// PollUntilContextTimeout will terminate polling after timeout duration by setting a context
+// timeout. This is provided as a convenience function for callers not currently executing under
+// a deadline and is equivalent to:
+//
+// deadlineCtx, deadlineCancel := context.WithTimeout(ctx, timeout)
+// err := PollUntilContextCancel(deadlineCtx, interval, immediate, condition)
+//
+// The deadline context will be cancelled if the Poll succeeds before the timeout, simplifying
+// inline usage. All other behavior is identical to PollUntilContextCancel.
+func PollUntilContextTimeout(ctx context.Context, interval, timeout time.Duration, immediate bool, condition ConditionWithContextFunc) error {
+ deadlineCtx, deadlineCancel := context.WithTimeout(ctx, timeout)
+ defer deadlineCancel()
+ return loopConditionUntilContext(deadlineCtx, Backoff{Duration: interval}.Timer(), immediate, false, condition)
+}
+
+// Poll tries a condition func until it returns true, an error, or the timeout
+// is reached.
+//
+// Poll always waits the interval before the run of 'condition'.
+// 'condition' will always be invoked at least once.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// If you want to Poll something forever, see PollInfinite.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextTimeout.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func Poll(interval, timeout time.Duration, condition ConditionFunc) error {
+ return PollWithContext(context.Background(), interval, timeout, condition.WithContext())
+}
+
+// PollWithContext tries a condition func until it returns true, an error,
+// or when the context expires or the timeout is reached, whichever
+// happens first.
+//
+// PollWithContext always waits the interval before the run of 'condition'.
+// 'condition' will always be invoked at least once.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// If you want to Poll something forever, see PollInfinite.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextTimeout.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollWithContext(ctx context.Context, interval, timeout time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, false, poller(interval, timeout), condition)
+}
+
+// PollUntil tries a condition func until it returns true, an error or stopCh is
+// closed.
+//
+// PollUntil always waits interval before the first run of 'condition'.
+// 'condition' will always be invoked at least once.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
+ return PollUntilWithContext(ContextForChannel(stopCh), interval, condition.WithContext())
+}
+
+// PollUntilWithContext tries a condition func until it returns true,
+// an error or the specified context is cancelled or expired.
+//
+// PollUntilWithContext always waits interval before the first run of 'condition'.
+// 'condition' will always be invoked at least once.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollUntilWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, false, poller(interval, 0), condition)
+}
+
+// PollInfinite tries a condition func until it returns true or an error
+//
+// PollInfinite always waits the interval before the run of 'condition'.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollInfinite(interval time.Duration, condition ConditionFunc) error {
+ return PollInfiniteWithContext(context.Background(), interval, condition.WithContext())
+}
+
+// PollInfiniteWithContext tries a condition func until it returns true or an error
+//
+// PollInfiniteWithContext always waits the interval before the run of 'condition'.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollInfiniteWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, false, poller(interval, 0), condition)
+}
+
+// PollImmediate tries a condition func until it returns true, an error, or the timeout
+// is reached.
+//
+// PollImmediate always checks 'condition' before waiting for the interval. 'condition'
+// will always be invoked at least once.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// If you want to immediately Poll something forever, see PollImmediateInfinite.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextTimeout.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediate(interval, timeout time.Duration, condition ConditionFunc) error {
+ return PollImmediateWithContext(context.Background(), interval, timeout, condition.WithContext())
+}
+
+// PollImmediateWithContext tries a condition func until it returns true, an error,
+// or the timeout is reached or the specified context expires, whichever happens first.
+//
+// PollImmediateWithContext always checks 'condition' before waiting for the interval.
+// 'condition' will always be invoked at least once.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// If you want to immediately Poll something forever, see PollImmediateInfinite.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextTimeout.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateWithContext(ctx context.Context, interval, timeout time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, true, poller(interval, timeout), condition)
+}
+
+// PollImmediateUntil tries a condition func until it returns true, an error or stopCh is closed.
+//
+// PollImmediateUntil runs the 'condition' before waiting for the interval.
+// 'condition' will always be invoked at least once.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
+ return PollImmediateUntilWithContext(ContextForChannel(stopCh), interval, condition.WithContext())
+}
+
+// PollImmediateUntilWithContext tries a condition func until it returns true,
+// an error or the specified context is cancelled or expired.
+//
+// PollImmediateUntilWithContext runs the 'condition' before waiting for the interval.
+// 'condition' will always be invoked at least once.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateUntilWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, true, poller(interval, 0), condition)
+}
+
+// PollImmediateInfinite tries a condition func until it returns true or an error
+//
+// PollImmediateInfinite runs the 'condition' before waiting for the interval.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateInfinite(interval time.Duration, condition ConditionFunc) error {
+ return PollImmediateInfiniteWithContext(context.Background(), interval, condition.WithContext())
+}
+
+// PollImmediateInfiniteWithContext tries a condition func until it returns true
+// or an error or the specified context gets cancelled or expired.
+//
+// PollImmediateInfiniteWithContext runs the 'condition' before waiting for the interval.
+//
+// Some intervals may be missed if the condition takes too long or the time
+// window is too short.
+//
+// Deprecated: This method does not return errors from context, use PollUntilContextCancel.
+// Note that the new method will no longer return ErrWaitTimeout and instead return errors
+// defined by the context package. Will be removed in a future release.
+func PollImmediateInfiniteWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
+ return poll(ctx, true, poller(interval, 0), condition)
+}
+
+// Internally used, each of the public 'Poll*' function defined in this
+// package should invoke this internal function with appropriate parameters.
+// ctx: the context specified by the caller, for infinite polling pass
+// a context that never gets cancelled or expired.
+// immediate: if true, the 'condition' will be invoked before waiting for the interval,
+// in this case 'condition' will always be invoked at least once.
+// wait: user specified WaitFunc function that controls at what interval the condition
+// function should be invoked periodically and whether it is bound by a timeout.
+// condition: user specified ConditionWithContextFunc function.
+//
+// Deprecated: will be removed in favor of loopConditionUntilContext.
+func poll(ctx context.Context, immediate bool, wait waitWithContextFunc, condition ConditionWithContextFunc) error {
+ if immediate {
+ done, err := runConditionWithCrashProtectionWithContext(ctx, condition)
+ if err != nil {
+ return err
+ }
+ if done {
+ return nil
+ }
+ }
+
+ select {
+ case <-ctx.Done():
+ // returning ctx.Err() will break backward compatibility, use new PollUntilContext*
+ // methods instead
+ return ErrWaitTimeout
+ default:
+ return waitForWithContext(ctx, wait, condition)
+ }
+}
+
+// poller returns a WaitFunc that will send to the channel every interval until
+// timeout has elapsed and then closes the channel.
+//
+// Over very short intervals you may receive no ticks before the channel is
+// closed. A timeout of 0 is interpreted as an infinity, and in such a case
+// it would be the caller's responsibility to close the done channel.
+// Failure to do so would result in a leaked goroutine.
+//
+// Output ticks are not buffered. If the channel is not ready to receive an
+// item, the tick is skipped.
+//
+// Deprecated: Will be removed in a future release.
+func poller(interval, timeout time.Duration) waitWithContextFunc {
+ return waitWithContextFunc(func(ctx context.Context) <-chan struct{} {
+ ch := make(chan struct{})
+
+ go func() {
+ defer close(ch)
+
+ tick := time.NewTicker(interval)
+ defer tick.Stop()
+
+ var after <-chan time.Time
+ if timeout != 0 {
+ // time.After is more convenient, but it
+ // potentially leaves timers around much longer
+ // than necessary if we exit early.
+ timer := time.NewTimer(timeout)
+ after = timer.C
+ defer timer.Stop()
+ }
+
+ for {
+ select {
+ case <-tick.C:
+ // If the consumer isn't ready for this signal drop it and
+ // check the other channels.
+ select {
+ case ch <- struct{}{}:
+ default:
+ }
+ case <-after:
+ return
+ case <-ctx.Done():
+ return
+ }
+ }
+ }()
+
+ return ch
+ })
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/timer.go b/vendor/k8s.io/apimachinery/pkg/util/wait/timer.go
new file mode 100644
index 000000000..3efba3213
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/timer.go
@@ -0,0 +1,121 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package wait
+
+import (
+ "time"
+
+ "k8s.io/utils/clock"
+)
+
+// Timer abstracts how wait functions interact with time runtime efficiently. Test
+// code may implement this interface directly but package consumers are encouraged
+// to use the Backoff type as the primary mechanism for acquiring a Timer. The
+// interface is a simplification of clock.Timer to prevent misuse. Timers are not
+// expected to be safe for calls from multiple goroutines.
+type Timer interface {
+ // C returns a channel that will receive a struct{} each time the timer fires.
+ // The channel should not be waited on after Stop() is invoked. It is allowed
+ // to cache the returned value of C() for the lifetime of the Timer.
+ C() <-chan time.Time
+ // Next is invoked by wait functions to signal timers that the next interval
+ // should begin. You may only use Next() if you have drained the channel C().
+ // You should not call Next() after Stop() is invoked.
+ Next()
+ // Stop releases the timer. It is safe to invoke if no other methods have been
+ // called.
+ Stop()
+}
+
+type noopTimer struct {
+ closedCh <-chan time.Time
+}
+
+// newNoopTimer creates a timer with a unique channel to avoid contention
+// for the channel's lock across multiple unrelated timers.
+func newNoopTimer() noopTimer {
+ ch := make(chan time.Time)
+ close(ch)
+ return noopTimer{closedCh: ch}
+}
+
+func (t noopTimer) C() <-chan time.Time {
+ return t.closedCh
+}
+func (noopTimer) Next() {}
+func (noopTimer) Stop() {}
+
+type variableTimer struct {
+ fn DelayFunc
+ t clock.Timer
+ new func(time.Duration) clock.Timer
+}
+
+func (t *variableTimer) C() <-chan time.Time {
+ if t.t == nil {
+ d := t.fn()
+ t.t = t.new(d)
+ }
+ return t.t.C()
+}
+func (t *variableTimer) Next() {
+ if t.t == nil {
+ return
+ }
+ d := t.fn()
+ t.t.Reset(d)
+}
+func (t *variableTimer) Stop() {
+ if t.t == nil {
+ return
+ }
+ t.t.Stop()
+ t.t = nil
+}
+
+type fixedTimer struct {
+ interval time.Duration
+ t clock.Ticker
+ new func(time.Duration) clock.Ticker
+}
+
+func (t *fixedTimer) C() <-chan time.Time {
+ if t.t == nil {
+ t.t = t.new(t.interval)
+ }
+ return t.t.C()
+}
+func (t *fixedTimer) Next() {
+ // no-op for fixed timers
+}
+func (t *fixedTimer) Stop() {
+ if t.t == nil {
+ return
+ }
+ t.t.Stop()
+ t.t = nil
+}
+
+var (
+ // RealTimer can be passed to methods that need a clock.Timer.
+ RealTimer = clock.RealClock{}.NewTimer
+)
+
+var (
+ // internalClock is used for test injection of clocks
+ internalClock = clock.RealClock{}
+)
diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go b/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
index 137627b40..6805e8cf9 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go
@@ -18,14 +18,11 @@ package wait
import (
"context"
- "errors"
- "math"
"math/rand"
"sync"
"time"
"k8s.io/apimachinery/pkg/util/runtime"
- "k8s.io/utils/clock"
)
// For any test of the style:
@@ -83,113 +80,6 @@ func Forever(f func(), period time.Duration) {
Until(f, period, NeverStop)
}
-// Until loops until stop channel is closed, running f every period.
-//
-// Until is syntactic sugar on top of JitterUntil with zero jitter factor and
-// with sliding = true (which means the timer for period starts after the f
-// completes).
-func Until(f func(), period time.Duration, stopCh <-chan struct{}) {
- JitterUntil(f, period, 0.0, true, stopCh)
-}
-
-// UntilWithContext loops until context is done, running f every period.
-//
-// UntilWithContext is syntactic sugar on top of JitterUntilWithContext
-// with zero jitter factor and with sliding = true (which means the timer
-// for period starts after the f completes).
-func UntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
- JitterUntilWithContext(ctx, f, period, 0.0, true)
-}
-
-// NonSlidingUntil loops until stop channel is closed, running f every
-// period.
-//
-// NonSlidingUntil is syntactic sugar on top of JitterUntil with zero jitter
-// factor, with sliding = false (meaning the timer for period starts at the same
-// time as the function starts).
-func NonSlidingUntil(f func(), period time.Duration, stopCh <-chan struct{}) {
- JitterUntil(f, period, 0.0, false, stopCh)
-}
-
-// NonSlidingUntilWithContext loops until context is done, running f every
-// period.
-//
-// NonSlidingUntilWithContext is syntactic sugar on top of JitterUntilWithContext
-// with zero jitter factor, with sliding = false (meaning the timer for period
-// starts at the same time as the function starts).
-func NonSlidingUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration) {
- JitterUntilWithContext(ctx, f, period, 0.0, false)
-}
-
-// JitterUntil loops until stop channel is closed, running f every period.
-//
-// If jitterFactor is positive, the period is jittered before every run of f.
-// If jitterFactor is not positive, the period is unchanged and not jittered.
-//
-// If sliding is true, the period is computed after f runs. If it is false then
-// period includes the runtime for f.
-//
-// Close stopCh to stop. f may not be invoked if stop channel is already
-// closed. Pass NeverStop to if you don't want it stop.
-func JitterUntil(f func(), period time.Duration, jitterFactor float64, sliding bool, stopCh <-chan struct{}) {
- BackoffUntil(f, NewJitteredBackoffManager(period, jitterFactor, &clock.RealClock{}), sliding, stopCh)
-}
-
-// BackoffUntil loops until stop channel is closed, run f every duration given by BackoffManager.
-//
-// If sliding is true, the period is computed after f runs. If it is false then
-// period includes the runtime for f.
-func BackoffUntil(f func(), backoff BackoffManager, sliding bool, stopCh <-chan struct{}) {
- var t clock.Timer
- for {
- select {
- case <-stopCh:
- return
- default:
- }
-
- if !sliding {
- t = backoff.Backoff()
- }
-
- func() {
- defer runtime.HandleCrash()
- f()
- }()
-
- if sliding {
- t = backoff.Backoff()
- }
-
- // NOTE: b/c there is no priority selection in golang
- // it is possible for this to race, meaning we could
- // trigger t.C and stopCh, and t.C select falls through.
- // In order to mitigate we re-check stopCh at the beginning
- // of every loop to prevent extra executions of f().
- select {
- case <-stopCh:
- if !t.Stop() {
- <-t.C()
- }
- return
- case <-t.C():
- }
- }
-}
-
-// JitterUntilWithContext loops until context is done, running f every period.
-//
-// If jitterFactor is positive, the period is jittered before every run of f.
-// If jitterFactor is not positive, the period is unchanged and not jittered.
-//
-// If sliding is true, the period is computed after f runs. If it is false then
-// period includes the runtime for f.
-//
-// Cancel context to stop. f may not be invoked if context is already expired.
-func JitterUntilWithContext(ctx context.Context, f func(context.Context), period time.Duration, jitterFactor float64, sliding bool) {
- JitterUntil(func() { f(ctx) }, period, jitterFactor, sliding, ctx.Done())
-}
-
// Jitter returns a time.Duration between duration and duration + maxFactor *
// duration.
//
@@ -203,9 +93,6 @@ func Jitter(duration time.Duration, maxFactor float64) time.Duration {
return wait
}
-// ErrWaitTimeout is returned when the condition exited without success.
-var ErrWaitTimeout = errors.New("timed out waiting for the condition")
-
// ConditionFunc returns true if the condition is satisfied, or an error
// if the loop should be aborted.
type ConditionFunc func() (done bool, err error)
@@ -223,425 +110,80 @@ func (cf ConditionFunc) WithContext() ConditionWithContextFunc {
}
}
-// runConditionWithCrashProtection runs a ConditionFunc with crash protection
-func runConditionWithCrashProtection(condition ConditionFunc) (bool, error) {
- return runConditionWithCrashProtectionWithContext(context.TODO(), condition.WithContext())
-}
-
-// runConditionWithCrashProtectionWithContext runs a
-// ConditionWithContextFunc with crash protection.
-func runConditionWithCrashProtectionWithContext(ctx context.Context, condition ConditionWithContextFunc) (bool, error) {
- defer runtime.HandleCrash()
- return condition(ctx)
-}
-
-// Backoff holds parameters applied to a Backoff function.
-type Backoff struct {
- // The initial duration.
- Duration time.Duration
- // Duration is multiplied by factor each iteration, if factor is not zero
- // and the limits imposed by Steps and Cap have not been reached.
- // Should not be negative.
- // The jitter does not contribute to the updates to the duration parameter.
- Factor float64
- // The sleep at each iteration is the duration plus an additional
- // amount chosen uniformly at random from the interval between
- // zero and `jitter*duration`.
- Jitter float64
- // The remaining number of iterations in which the duration
- // parameter may change (but progress can be stopped earlier by
- // hitting the cap). If not positive, the duration is not
- // changed. Used for exponential backoff in combination with
- // Factor and Cap.
- Steps int
- // A limit on revised values of the duration parameter. If a
- // multiplication by the factor parameter would make the duration
- // exceed the cap then the duration is set to the cap and the
- // steps parameter is set to zero.
- Cap time.Duration
-}
-
-// Step (1) returns an amount of time to sleep determined by the
-// original Duration and Jitter and (2) mutates the provided Backoff
-// to update its Steps and Duration.
-func (b *Backoff) Step() time.Duration {
- if b.Steps < 1 {
- if b.Jitter > 0 {
- return Jitter(b.Duration, b.Jitter)
- }
- return b.Duration
- }
- b.Steps--
-
- duration := b.Duration
-
- // calculate the next step
- if b.Factor != 0 {
- b.Duration = time.Duration(float64(b.Duration) * b.Factor)
- if b.Cap > 0 && b.Duration > b.Cap {
- b.Duration = b.Cap
- b.Steps = 0
- }
- }
-
- if b.Jitter > 0 {
- duration = Jitter(duration, b.Jitter)
- }
- return duration
-}
-
-// ContextForChannel derives a child context from a parent channel.
-//
-// The derived context's Done channel is closed when the returned cancel function
-// is called or when the parent channel is closed, whichever happens first.
-//
-// Note the caller must *always* call the CancelFunc, otherwise resources may be leaked.
-func ContextForChannel(parentCh <-chan struct{}) (context.Context, context.CancelFunc) {
- ctx, cancel := context.WithCancel(context.Background())
-
- go func() {
- select {
- case <-parentCh:
- cancel()
- case <-ctx.Done():
- }
- }()
- return ctx, cancel
-}
-
-// BackoffManager manages backoff with a particular scheme based on its underlying implementation. It provides
-// an interface to return a timer for backoff, and caller shall backoff until Timer.C() drains. If the second Backoff()
-// is called before the timer from the first Backoff() call finishes, the first timer will NOT be drained and result in
-// undetermined behavior.
-// The BackoffManager is supposed to be called in a single-threaded environment.
-type BackoffManager interface {
- Backoff() clock.Timer
-}
-
-type exponentialBackoffManagerImpl struct {
- backoff *Backoff
- backoffTimer clock.Timer
- lastBackoffStart time.Time
- initialBackoff time.Duration
- backoffResetDuration time.Duration
- clock clock.Clock
-}
-
-// NewExponentialBackoffManager returns a manager for managing exponential backoff. Each backoff is jittered and
-// backoff will not exceed the given max. If the backoff is not called within resetDuration, the backoff is reset.
-// This backoff manager is used to reduce load during upstream unhealthiness.
-func NewExponentialBackoffManager(initBackoff, maxBackoff, resetDuration time.Duration, backoffFactor, jitter float64, c clock.Clock) BackoffManager {
- return &exponentialBackoffManagerImpl{
- backoff: &Backoff{
- Duration: initBackoff,
- Factor: backoffFactor,
- Jitter: jitter,
-
- // the current impl of wait.Backoff returns Backoff.Duration once steps are used up, which is not
- // what we ideally need here, we set it to max int and assume we will never use up the steps
- Steps: math.MaxInt32,
- Cap: maxBackoff,
- },
- backoffTimer: nil,
- initialBackoff: initBackoff,
- lastBackoffStart: c.Now(),
- backoffResetDuration: resetDuration,
- clock: c,
- }
-}
-
-func (b *exponentialBackoffManagerImpl) getNextBackoff() time.Duration {
- if b.clock.Now().Sub(b.lastBackoffStart) > b.backoffResetDuration {
- b.backoff.Steps = math.MaxInt32
- b.backoff.Duration = b.initialBackoff
- }
- b.lastBackoffStart = b.clock.Now()
- return b.backoff.Step()
-}
-
-// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for exponential backoff.
-// The returned timer must be drained before calling Backoff() the second time
-func (b *exponentialBackoffManagerImpl) Backoff() clock.Timer {
- if b.backoffTimer == nil {
- b.backoffTimer = b.clock.NewTimer(b.getNextBackoff())
- } else {
- b.backoffTimer.Reset(b.getNextBackoff())
- }
- return b.backoffTimer
-}
-
-type jitteredBackoffManagerImpl struct {
- clock clock.Clock
- duration time.Duration
- jitter float64
- backoffTimer clock.Timer
-}
-
-// NewJitteredBackoffManager returns a BackoffManager that backoffs with given duration plus given jitter. If the jitter
-// is negative, backoff will not be jittered.
-func NewJitteredBackoffManager(duration time.Duration, jitter float64, c clock.Clock) BackoffManager {
- return &jitteredBackoffManagerImpl{
- clock: c,
- duration: duration,
- jitter: jitter,
- backoffTimer: nil,
- }
-}
-
-func (j *jitteredBackoffManagerImpl) getNextBackoff() time.Duration {
- jitteredPeriod := j.duration
- if j.jitter > 0.0 {
- jitteredPeriod = Jitter(j.duration, j.jitter)
- }
- return jitteredPeriod
+// ContextForChannel provides a context that will be treated as cancelled
+// when the provided parentCh is closed. The implementation returns
+// context.Canceled for Err() if and only if the parentCh is closed.
+func ContextForChannel(parentCh <-chan struct{}) context.Context {
+ return channelContext{stopCh: parentCh}
}
-// Backoff implements BackoffManager.Backoff, it returns a timer so caller can block on the timer for jittered backoff.
-// The returned timer must be drained before calling Backoff() the second time
-func (j *jitteredBackoffManagerImpl) Backoff() clock.Timer {
- backoff := j.getNextBackoff()
- if j.backoffTimer == nil {
- j.backoffTimer = j.clock.NewTimer(backoff)
- } else {
- j.backoffTimer.Reset(backoff)
- }
- return j.backoffTimer
-}
+var _ context.Context = channelContext{}
-// ExponentialBackoff repeats a condition check with exponential backoff.
-//
-// It repeatedly checks the condition and then sleeps, using `backoff.Step()`
-// to determine the length of the sleep and adjust Duration and Steps.
-// Stops and returns as soon as:
-// 1. the condition check returns true or an error,
-// 2. `backoff.Steps` checks of the condition have been done, or
-// 3. a sleep truncated by the cap on duration has been completed.
-// In case (1) the returned error is what the condition function returned.
-// In all other cases, ErrWaitTimeout is returned.
-func ExponentialBackoff(backoff Backoff, condition ConditionFunc) error {
- for backoff.Steps > 0 {
- if ok, err := runConditionWithCrashProtection(condition); err != nil || ok {
- return err
- }
- if backoff.Steps == 1 {
- break
- }
- time.Sleep(backoff.Step())
- }
- return ErrWaitTimeout
-}
-
-// Poll tries a condition func until it returns true, an error, or the timeout
-// is reached.
-//
-// Poll always waits the interval before the run of 'condition'.
-// 'condition' will always be invoked at least once.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-//
-// If you want to Poll something forever, see PollInfinite.
-func Poll(interval, timeout time.Duration, condition ConditionFunc) error {
- return PollWithContext(context.Background(), interval, timeout, condition.WithContext())
-}
-
-// PollWithContext tries a condition func until it returns true, an error,
-// or when the context expires or the timeout is reached, whichever
-// happens first.
-//
-// PollWithContext always waits the interval before the run of 'condition'.
-// 'condition' will always be invoked at least once.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-//
-// If you want to Poll something forever, see PollInfinite.
-func PollWithContext(ctx context.Context, interval, timeout time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, false, poller(interval, timeout), condition)
-}
-
-// PollUntil tries a condition func until it returns true, an error or stopCh is
+// channelContext will behave as if the context were cancelled when stopCh is
// closed.
-//
-// PollUntil always waits interval before the first run of 'condition'.
-// 'condition' will always be invoked at least once.
-func PollUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
- ctx, cancel := ContextForChannel(stopCh)
- defer cancel()
- return PollUntilWithContext(ctx, interval, condition.WithContext())
-}
-
-// PollUntilWithContext tries a condition func until it returns true,
-// an error or the specified context is cancelled or expired.
-//
-// PollUntilWithContext always waits interval before the first run of 'condition'.
-// 'condition' will always be invoked at least once.
-func PollUntilWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, false, poller(interval, 0), condition)
-}
-
-// PollInfinite tries a condition func until it returns true or an error
-//
-// PollInfinite always waits the interval before the run of 'condition'.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-func PollInfinite(interval time.Duration, condition ConditionFunc) error {
- return PollInfiniteWithContext(context.Background(), interval, condition.WithContext())
-}
-
-// PollInfiniteWithContext tries a condition func until it returns true or an error
-//
-// PollInfiniteWithContext always waits the interval before the run of 'condition'.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-func PollInfiniteWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, false, poller(interval, 0), condition)
+type channelContext struct {
+ stopCh <-chan struct{}
}
-// PollImmediate tries a condition func until it returns true, an error, or the timeout
-// is reached.
-//
-// PollImmediate always checks 'condition' before waiting for the interval. 'condition'
-// will always be invoked at least once.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-//
-// If you want to immediately Poll something forever, see PollImmediateInfinite.
-func PollImmediate(interval, timeout time.Duration, condition ConditionFunc) error {
- return PollImmediateWithContext(context.Background(), interval, timeout, condition.WithContext())
-}
-
-// PollImmediateWithContext tries a condition func until it returns true, an error,
-// or the timeout is reached or the specified context expires, whichever happens first.
-//
-// PollImmediateWithContext always checks 'condition' before waiting for the interval.
-// 'condition' will always be invoked at least once.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-//
-// If you want to immediately Poll something forever, see PollImmediateInfinite.
-func PollImmediateWithContext(ctx context.Context, interval, timeout time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, true, poller(interval, timeout), condition)
-}
-
-// PollImmediateUntil tries a condition func until it returns true, an error or stopCh is closed.
-//
-// PollImmediateUntil runs the 'condition' before waiting for the interval.
-// 'condition' will always be invoked at least once.
-func PollImmediateUntil(interval time.Duration, condition ConditionFunc, stopCh <-chan struct{}) error {
- ctx, cancel := ContextForChannel(stopCh)
- defer cancel()
- return PollImmediateUntilWithContext(ctx, interval, condition.WithContext())
-}
-
-// PollImmediateUntilWithContext tries a condition func until it returns true,
-// an error or the specified context is cancelled or expired.
-//
-// PollImmediateUntilWithContext runs the 'condition' before waiting for the interval.
-// 'condition' will always be invoked at least once.
-func PollImmediateUntilWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, true, poller(interval, 0), condition)
+func (c channelContext) Done() <-chan struct{} { return c.stopCh }
+func (c channelContext) Err() error {
+ select {
+ case <-c.stopCh:
+ return context.Canceled
+ default:
+ return nil
+ }
}
+func (c channelContext) Deadline() (time.Time, bool) { return time.Time{}, false }
+func (c channelContext) Value(key any) any { return nil }
-// PollImmediateInfinite tries a condition func until it returns true or an error
+// runConditionWithCrashProtection runs a ConditionFunc with crash protection.
//
-// PollImmediateInfinite runs the 'condition' before waiting for the interval.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-func PollImmediateInfinite(interval time.Duration, condition ConditionFunc) error {
- return PollImmediateInfiniteWithContext(context.Background(), interval, condition.WithContext())
+// Deprecated: Will be removed when the legacy polling methods are removed.
+func runConditionWithCrashProtection(condition ConditionFunc) (bool, error) {
+ defer runtime.HandleCrash()
+ return condition()
}
-// PollImmediateInfiniteWithContext tries a condition func until it returns true
-// or an error or the specified context gets cancelled or expired.
+// runConditionWithCrashProtectionWithContext runs a ConditionWithContextFunc
+// with crash protection.
//
-// PollImmediateInfiniteWithContext runs the 'condition' before waiting for the interval.
-//
-// Some intervals may be missed if the condition takes too long or the time
-// window is too short.
-func PollImmediateInfiniteWithContext(ctx context.Context, interval time.Duration, condition ConditionWithContextFunc) error {
- return poll(ctx, true, poller(interval, 0), condition)
-}
-
-// Internally used, each of the public 'Poll*' function defined in this
-// package should invoke this internal function with appropriate parameters.
-// ctx: the context specified by the caller, for infinite polling pass
-// a context that never gets cancelled or expired.
-// immediate: if true, the 'condition' will be invoked before waiting for the interval,
-// in this case 'condition' will always be invoked at least once.
-// wait: user specified WaitFunc function that controls at what interval the condition
-// function should be invoked periodically and whether it is bound by a timeout.
-// condition: user specified ConditionWithContextFunc function.
-func poll(ctx context.Context, immediate bool, wait WaitWithContextFunc, condition ConditionWithContextFunc) error {
- if immediate {
- done, err := runConditionWithCrashProtectionWithContext(ctx, condition)
- if err != nil {
- return err
- }
- if done {
- return nil
- }
- }
-
- select {
- case <-ctx.Done():
- // returning ctx.Err() will break backward compatibility
- return ErrWaitTimeout
- default:
- return WaitForWithContext(ctx, wait, condition)
- }
+// Deprecated: Will be removed when the legacy polling methods are removed.
+func runConditionWithCrashProtectionWithContext(ctx context.Context, condition ConditionWithContextFunc) (bool, error) {
+ defer runtime.HandleCrash()
+ return condition(ctx)
}
-// WaitFunc creates a channel that receives an item every time a test
+// waitFunc creates a channel that receives an item every time a test
// should be executed and is closed when the last test should be invoked.
-type WaitFunc func(done <-chan struct{}) <-chan struct{}
+//
+// Deprecated: Will be removed in a future release in favor of
+// loopConditionUntilContext.
+type waitFunc func(done <-chan struct{}) <-chan struct{}
// WithContext converts the WaitFunc to an equivalent WaitWithContextFunc
-func (w WaitFunc) WithContext() WaitWithContextFunc {
+func (w waitFunc) WithContext() waitWithContextFunc {
return func(ctx context.Context) <-chan struct{} {
return w(ctx.Done())
}
}
-// WaitWithContextFunc creates a channel that receives an item every time a test
+// waitWithContextFunc creates a channel that receives an item every time a test
// should be executed and is closed when the last test should be invoked.
//
// When the specified context gets cancelled or expires the function
// stops sending item and returns immediately.
-type WaitWithContextFunc func(ctx context.Context) <-chan struct{}
-
-// WaitFor continually checks 'fn' as driven by 'wait'.
//
-// WaitFor gets a channel from 'wait()”, and then invokes 'fn' once for every value
-// placed on the channel and once more when the channel is closed. If the channel is closed
-// and 'fn' returns false without error, WaitFor returns ErrWaitTimeout.
-//
-// If 'fn' returns an error the loop ends and that error is returned. If
-// 'fn' returns true the loop ends and nil is returned.
-//
-// ErrWaitTimeout will be returned if the 'done' channel is closed without fn ever
-// returning true.
-//
-// When the done channel is closed, because the golang `select` statement is
-// "uniform pseudo-random", the `fn` might still run one or multiple time,
-// though eventually `WaitFor` will return.
-func WaitFor(wait WaitFunc, fn ConditionFunc, done <-chan struct{}) error {
- ctx, cancel := ContextForChannel(done)
- defer cancel()
- return WaitForWithContext(ctx, wait.WithContext(), fn.WithContext())
-}
+// Deprecated: Will be removed in a future release in favor of
+// loopConditionUntilContext.
+type waitWithContextFunc func(ctx context.Context) <-chan struct{}
-// WaitForWithContext continually checks 'fn' as driven by 'wait'.
+// waitForWithContext continually checks 'fn' as driven by 'wait'.
//
-// WaitForWithContext gets a channel from 'wait()”, and then invokes 'fn'
+// waitForWithContext gets a channel from 'wait()”, and then invokes 'fn'
// once for every value placed on the channel and once more when the
// channel is closed. If the channel is closed and 'fn'
-// returns false without error, WaitForWithContext returns ErrWaitTimeout.
+// returns false without error, waitForWithContext returns ErrWaitTimeout.
//
// If 'fn' returns an error the loop ends and that error is returned. If
// 'fn' returns true the loop ends and nil is returned.
@@ -651,8 +193,11 @@ func WaitFor(wait WaitFunc, fn ConditionFunc, done <-chan struct{}) error {
//
// When the ctx.Done() channel is closed, because the golang `select` statement is
// "uniform pseudo-random", the `fn` might still run one or multiple times,
-// though eventually `WaitForWithContext` will return.
-func WaitForWithContext(ctx context.Context, wait WaitWithContextFunc, fn ConditionWithContextFunc) error {
+// though eventually `waitForWithContext` will return.
+//
+// Deprecated: Will be removed in a future release in favor of
+// loopConditionUntilContext.
+func waitForWithContext(ctx context.Context, wait waitWithContextFunc, fn ConditionWithContextFunc) error {
waitCtx, cancel := context.WithCancel(context.Background())
defer cancel()
c := wait(waitCtx)
@@ -670,88 +215,9 @@ func WaitForWithContext(ctx context.Context, wait WaitWithContextFunc, fn Condit
return ErrWaitTimeout
}
case <-ctx.Done():
- // returning ctx.Err() will break backward compatibility
+ // returning ctx.Err() will break backward compatibility, use new PollUntilContext*
+ // methods instead
return ErrWaitTimeout
}
}
}
-
-// poller returns a WaitFunc that will send to the channel every interval until
-// timeout has elapsed and then closes the channel.
-//
-// Over very short intervals you may receive no ticks before the channel is
-// closed. A timeout of 0 is interpreted as an infinity, and in such a case
-// it would be the caller's responsibility to close the done channel.
-// Failure to do so would result in a leaked goroutine.
-//
-// Output ticks are not buffered. If the channel is not ready to receive an
-// item, the tick is skipped.
-func poller(interval, timeout time.Duration) WaitWithContextFunc {
- return WaitWithContextFunc(func(ctx context.Context) <-chan struct{} {
- ch := make(chan struct{})
-
- go func() {
- defer close(ch)
-
- tick := time.NewTicker(interval)
- defer tick.Stop()
-
- var after <-chan time.Time
- if timeout != 0 {
- // time.After is more convenient, but it
- // potentially leaves timers around much longer
- // than necessary if we exit early.
- timer := time.NewTimer(timeout)
- after = timer.C
- defer timer.Stop()
- }
-
- for {
- select {
- case <-tick.C:
- // If the consumer isn't ready for this signal drop it and
- // check the other channels.
- select {
- case ch <- struct{}{}:
- default:
- }
- case <-after:
- return
- case <-ctx.Done():
- return
- }
- }
- }()
-
- return ch
- })
-}
-
-// ExponentialBackoffWithContext works with a request context and a Backoff. It ensures that the retry wait never
-// exceeds the deadline specified by the request context.
-func ExponentialBackoffWithContext(ctx context.Context, backoff Backoff, condition ConditionFunc) error {
- for backoff.Steps > 0 {
- select {
- case <-ctx.Done():
- return ctx.Err()
- default:
- }
-
- if ok, err := runConditionWithCrashProtection(condition); err != nil || ok {
- return err
- }
-
- if backoff.Steps == 1 {
- break
- }
-
- waitBeforeRetry := backoff.Step()
- select {
- case <-ctx.Done():
- return ctx.Err()
- case <-time.After(waitBeforeRetry):
- }
- }
-
- return ErrWaitTimeout
-}
diff --git a/vendor/k8s.io/apimachinery/pkg/util/waitgroup/ratelimited_waitgroup.go b/vendor/k8s.io/apimachinery/pkg/util/waitgroup/ratelimited_waitgroup.go
new file mode 100644
index 000000000..8766390fc
--- /dev/null
+++ b/vendor/k8s.io/apimachinery/pkg/util/waitgroup/ratelimited_waitgroup.go
@@ -0,0 +1,134 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package waitgroup
+
+import (
+ "context"
+ "fmt"
+ "sync"
+)
+
+// RateLimiter abstracts the rate limiter used by RateLimitedSafeWaitGroup.
+// The implementation must be thread-safe.
+type RateLimiter interface {
+ Wait(ctx context.Context) error
+}
+
+// RateLimiterFactoryFunc is used by the RateLimitedSafeWaitGroup to create a new
+// instance of a RateLimiter that will be used to rate limit the return rate
+// of the active number of request(s). 'count' is the number of requests in
+// flight that are expected to invoke 'Done' on this wait group.
+type RateLimiterFactoryFunc func(count int) (RateLimiter, context.Context, context.CancelFunc)
+
+// RateLimitedSafeWaitGroup must not be copied after first use.
+type RateLimitedSafeWaitGroup struct {
+ wg sync.WaitGroup
+ // Once Wait is initiated, all consecutive Done invocation will be
+ // rate limited using this rate limiter.
+ limiter RateLimiter
+ stopCtx context.Context
+
+ mu sync.Mutex
+ // wait indicate whether Wait is called, if true,
+ // then any Add with positive delta will return error.
+ wait bool
+ // number of request(s) currently using the wait group
+ count int
+}
+
+// Add adds delta, which may be negative, similar to sync.WaitGroup.
+// If Add with a positive delta happens after Wait, it will return error,
+// which prevent unsafe Add.
+func (wg *RateLimitedSafeWaitGroup) Add(delta int) error {
+ wg.mu.Lock()
+ defer wg.mu.Unlock()
+
+ if wg.wait && delta > 0 {
+ return fmt.Errorf("add with positive delta after Wait is forbidden")
+ }
+ wg.wg.Add(delta)
+ wg.count += delta
+ return nil
+}
+
+// Done decrements the WaitGroup counter, rate limiting is applied only
+// when the wait group is in waiting mode.
+func (wg *RateLimitedSafeWaitGroup) Done() {
+ var limiter RateLimiter
+ func() {
+ wg.mu.Lock()
+ defer wg.mu.Unlock()
+
+ wg.count -= 1
+ if wg.wait {
+ // we are using the limiter outside the scope of the lock
+ limiter = wg.limiter
+ }
+ }()
+
+ defer wg.wg.Done()
+ if limiter != nil {
+ limiter.Wait(wg.stopCtx)
+ }
+}
+
+// Wait blocks until the WaitGroup counter is zero or a hard limit has elapsed.
+// It returns the number of active request(s) accounted for at the time Wait
+// has been invoked, number of request(s) that have drianed (done using the
+// wait group immediately before Wait returns).
+// Ideally, the both numbers returned should be equal, to indicate that all
+// request(s) using the wait group have released their lock.
+func (wg *RateLimitedSafeWaitGroup) Wait(limiterFactory RateLimiterFactoryFunc) (int, int, error) {
+ if limiterFactory == nil {
+ return 0, 0, fmt.Errorf("rate limiter factory must be specified")
+ }
+
+ var cancel context.CancelFunc
+ var countNow, countAfter int
+ func() {
+ wg.mu.Lock()
+ defer wg.mu.Unlock()
+
+ wg.limiter, wg.stopCtx, cancel = limiterFactory(wg.count)
+ countNow = wg.count
+ wg.wait = true
+ }()
+
+ defer cancel()
+ // there should be a hard stop, in case request(s) are not responsive
+ // enough to invoke Done before the grace period is over.
+ waitDoneCh := make(chan struct{})
+ go func() {
+ defer close(waitDoneCh)
+ wg.wg.Wait()
+ }()
+
+ var err error
+ select {
+ case <-wg.stopCtx.Done():
+ err = wg.stopCtx.Err()
+ case <-waitDoneCh:
+ }
+
+ func() {
+ wg.mu.Lock()
+ defer wg.mu.Unlock()
+
+ countAfter = wg.count
+ }()
+ return countNow, countAfter, err
+}
diff --git a/vendor/k8s.io/apimachinery/pkg/watch/watch.go b/vendor/k8s.io/apimachinery/pkg/watch/watch.go
index b6c7bbfa8..ce37fd8c1 100644
--- a/vendor/k8s.io/apimachinery/pkg/watch/watch.go
+++ b/vendor/k8s.io/apimachinery/pkg/watch/watch.go
@@ -27,13 +27,25 @@ import (
// Interface can be implemented by anything that knows how to watch and report changes.
type Interface interface {
- // Stop stops watching. Will close the channel returned by ResultChan(). Releases
- // any resources used by the watch.
+ // Stop tells the producer that the consumer is done watching, so the
+ // producer should stop sending events and close the result channel. The
+ // consumer should keep watching for events until the result channel is
+ // closed.
+ //
+ // Because some implementations may create channels when constructed, Stop
+ // must always be called, even if the consumer has not yet called
+ // ResultChan().
+ //
+ // Only the consumer should call Stop(), not the producer. If the producer
+ // errors and needs to stop the watch prematurely, it should instead send
+ // an error event and close the result channel.
Stop()
- // ResultChan returns a chan which will receive all the events. If an error occurs
- // or Stop() is called, the implementation will close this channel and
- // release any resources used by the watch.
+ // ResultChan returns a channel which will receive events from the event
+ // producer. If an error occurs or Stop() is called, the producer must
+ // close this channel and release any resources used by the watch.
+ // Closing the result channel tells the consumer that no more events will be
+ // sent.
ResultChan() <-chan Event
}
@@ -322,3 +334,21 @@ func (pw *ProxyWatcher) ResultChan() <-chan Event {
func (pw *ProxyWatcher) StopChan() <-chan struct{} {
return pw.stopCh
}
+
+// MockWatcher implements watch.Interface with mockable functions.
+type MockWatcher struct {
+ StopFunc func()
+ ResultChanFunc func() <-chan Event
+}
+
+var _ Interface = &MockWatcher{}
+
+// Stop calls StopFunc
+func (mw MockWatcher) Stop() {
+ mw.StopFunc()
+}
+
+// ResultChan calls ResultChanFunc
+func (mw MockWatcher) ResultChan() <-chan Event {
+ return mw.ResultChanFunc()
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go b/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go
index 98be932cb..1c4cb5bf8 100644
--- a/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go
+++ b/vendor/k8s.io/kube-openapi/pkg/builder/openapi.go
@@ -152,7 +152,7 @@ func (o *openAPI) finalizeSwagger() (*spec.Swagger, error) {
}
}
- return o.swagger, nil
+ return deduplicateParameters(o.swagger)
}
func (o *openAPI) buildDefinitionRecursively(name string) error {
diff --git a/vendor/k8s.io/kube-openapi/pkg/builder/parameters.go b/vendor/k8s.io/kube-openapi/pkg/builder/parameters.go
new file mode 100644
index 000000000..2bb8bd885
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/builder/parameters.go
@@ -0,0 +1,259 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package builder
+
+import (
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "hash/fnv"
+ "sort"
+ "strconv"
+ "strings"
+
+ "k8s.io/kube-openapi/pkg/validation/spec"
+)
+
+// deduplicateParameters finds parameters that are shared across multiple endpoints and replace them with
+// references to the shared parameters in order to avoid repetition.
+//
+// deduplicateParameters does not mutate the source.
+func deduplicateParameters(sp *spec.Swagger) (*spec.Swagger, error) {
+ names, parameters, err := collectSharedParameters(sp)
+ if err != nil {
+ return nil, err
+ }
+
+ if sp.Parameters != nil {
+ return nil, fmt.Errorf("shared parameters already exist") // should not happen with the builder, but to be sure
+ }
+
+ clone := *sp
+ clone.Parameters = parameters
+ return replaceSharedParameters(names, &clone)
+}
+
+// collectSharedParameters finds parameters that show up for many endpoints. These
+// are basically all parameters with the exceptions of those where we know they are
+// endpoint specific, e.g. because they reference the schema of the kind, or have
+// the kind or resource name in the description.
+func collectSharedParameters(sp *spec.Swagger) (namesByJSON map[string]string, ret map[string]spec.Parameter, err error) {
+ if sp == nil || sp.Paths == nil {
+ return nil, nil, nil
+ }
+
+ countsByJSON := map[string]int{}
+ shared := map[string]spec.Parameter{}
+ var keys []string
+
+ collect := func(p *spec.Parameter) error {
+ if (p.In == "query" || p.In == "path") && p.Name == "name" {
+ return nil // ignore name parameter as they are never shared with the Kind in the description
+ }
+ if p.In == "query" && p.Name == "fieldValidation" {
+ return nil // keep fieldValidation parameter unshared because kubectl uses it (until 1.27) to detect server-side field validation support
+ }
+ if p.In == "query" && p.Name == "dryRun" {
+ return nil // keep fieldValidation parameter unshared because kubectl uses it (until 1.26) to detect dry-run support
+ }
+ if p.Schema != nil && p.In == "body" && p.Name == "body" && !strings.HasPrefix(p.Schema.Ref.String(), "#/definitions/io.k8s.apimachinery") {
+ return nil // ignore non-generic body parameters as they reference the custom schema of the kind
+ }
+
+ bs, err := json.Marshal(p)
+ if err != nil {
+ return err
+ }
+
+ k := string(bs)
+ countsByJSON[k]++
+ if count := countsByJSON[k]; count == 1 {
+ shared[k] = *p
+ keys = append(keys, k)
+ }
+
+ return nil
+ }
+
+ for _, path := range sp.Paths.Paths {
+ // per operation parameters
+ for _, op := range operations(&path) {
+ if op == nil {
+ continue // shouldn't happen, but ignore if it does; tested through unit test
+ }
+ for _, p := range op.Parameters {
+ if p.Ref.String() != "" {
+ // shouldn't happen, but ignore if it does
+ continue
+ }
+ if err := collect(&p); err != nil {
+ return nil, nil, err
+ }
+ }
+ }
+
+ // per path parameters
+ for _, p := range path.Parameters {
+ if p.Ref.String() != "" {
+ continue // shouldn't happen, but ignore if it does
+ }
+ if err := collect(&p); err != nil {
+ return nil, nil, err
+ }
+ }
+ }
+
+ // name deterministically
+ sort.Strings(keys)
+ ret = map[string]spec.Parameter{}
+ namesByJSON = map[string]string{}
+ for _, k := range keys {
+ name := shared[k].Name
+ if name == "" {
+ // this should never happen as the name is a required field. But if it does, let's be safe.
+ name = "param"
+ }
+ name += "-" + base64Hash(k)
+ i := 0
+ for {
+ if _, ok := ret[name]; !ok {
+ ret[name] = shared[k]
+ namesByJSON[k] = name
+ break
+ }
+ i++ // only on hash conflict, unlikely with our few variants
+ name = shared[k].Name + "-" + strconv.Itoa(i)
+ }
+ }
+
+ return namesByJSON, ret, nil
+}
+
+func operations(path *spec.PathItem) []*spec.Operation {
+ return []*spec.Operation{path.Get, path.Put, path.Post, path.Delete, path.Options, path.Head, path.Patch}
+}
+
+func base64Hash(s string) string {
+ hash := fnv.New64()
+ hash.Write([]byte(s)) //nolint:errcheck
+ return base64.URLEncoding.EncodeToString(hash.Sum(make([]byte, 0, 8))[:6]) // 8 characters
+}
+
+func replaceSharedParameters(sharedParameterNamesByJSON map[string]string, sp *spec.Swagger) (*spec.Swagger, error) {
+ if sp == nil || sp.Paths == nil {
+ return sp, nil
+ }
+
+ ret := sp
+
+ firstPathChange := true
+ for k, path := range sp.Paths.Paths {
+ pathChanged := false
+
+ // per operation parameters
+ for _, op := range []**spec.Operation{&path.Get, &path.Put, &path.Post, &path.Delete, &path.Options, &path.Head, &path.Patch} {
+ if *op == nil {
+ continue
+ }
+
+ firstParamChange := true
+ for i := range (*op).Parameters {
+ p := (*op).Parameters[i]
+
+ if p.Ref.String() != "" {
+ // shouldn't happen, but be idem-potent if it does
+ continue
+ }
+
+ bs, err := json.Marshal(p)
+ if err != nil {
+ return nil, err
+ }
+
+ if name, ok := sharedParameterNamesByJSON[string(bs)]; ok {
+ if firstParamChange {
+ orig := *op
+ *op = &spec.Operation{}
+ **op = *orig
+ (*op).Parameters = make([]spec.Parameter, len(orig.Parameters))
+ copy((*op).Parameters, orig.Parameters)
+ firstParamChange = false
+ }
+
+ (*op).Parameters[i] = spec.Parameter{
+ Refable: spec.Refable{
+ Ref: spec.MustCreateRef("#/parameters/" + name),
+ },
+ }
+ pathChanged = true
+ }
+ }
+ }
+
+ // per path parameters
+ firstParamChange := true
+ for i := range path.Parameters {
+ p := path.Parameters[i]
+
+ if p.Ref.String() != "" {
+ // shouldn't happen, but be idem-potent if it does
+ continue
+ }
+
+ bs, err := json.Marshal(p)
+ if err != nil {
+ return nil, err
+ }
+
+ if name, ok := sharedParameterNamesByJSON[string(bs)]; ok {
+ if firstParamChange {
+ orig := path.Parameters
+ path.Parameters = make([]spec.Parameter, len(orig))
+ copy(path.Parameters, orig)
+ firstParamChange = false
+ }
+
+ path.Parameters[i] = spec.Parameter{
+ Refable: spec.Refable{
+ Ref: spec.MustCreateRef("#/parameters/" + name),
+ },
+ }
+ pathChanged = true
+ }
+ }
+
+ if pathChanged {
+ if firstPathChange {
+ clone := *sp
+ ret = &clone
+
+ pathsClone := *ret.Paths
+ ret.Paths = &pathsClone
+
+ ret.Paths.Paths = make(map[string]spec.PathItem, len(sp.Paths.Paths))
+ for k, v := range sp.Paths.Paths {
+ ret.Paths.Paths[k] = v
+ }
+
+ firstPathChange = false
+ }
+ ret.Paths.Paths[k] = path
+ }
+ }
+
+ return ret, nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/builder3/openapi.go b/vendor/k8s.io/kube-openapi/pkg/builder3/openapi.go
index a0c00f07f..081dae306 100644
--- a/vendor/k8s.io/kube-openapi/pkg/builder3/openapi.go
+++ b/vendor/k8s.io/kube-openapi/pkg/builder3/openapi.go
@@ -156,7 +156,9 @@ func (o *openAPI) buildRequestBody(parameters []common.Parameter, consumes []str
}
r := &spec3.RequestBody{
RequestBodyProps: spec3.RequestBodyProps{
- Content: map[string]*spec3.MediaType{},
+ Content: map[string]*spec3.MediaType{},
+ Description: param.Description(),
+ Required: param.Required(),
},
}
for _, consume := range consumes {
@@ -172,9 +174,9 @@ func (o *openAPI) buildRequestBody(parameters []common.Parameter, consumes []str
return nil, nil
}
-func newOpenAPI(config *common.Config) openAPI {
+func newOpenAPI(config *common.OpenAPIV3Config) openAPI {
o := openAPI{
- config: common.ConvertConfigToV3(config),
+ config: config,
spec: &spec3.OpenAPI{
Version: "3.0.0",
Info: config.Info,
@@ -313,20 +315,38 @@ func (o *openAPI) buildOpenAPISpec(webServices []common.RouteContainer) error {
// BuildOpenAPISpec builds OpenAPI v3 spec given a list of route containers and common.Config to customize it.
//
// Deprecated: BuildOpenAPISpecFromRoutes should be used instead.
-func BuildOpenAPISpec(webServices []*restful.WebService, config *common.Config) (*spec3.OpenAPI, error) {
+func BuildOpenAPISpec(webServices []*restful.WebService, config *common.OpenAPIV3Config) (*spec3.OpenAPI, error) {
return BuildOpenAPISpecFromRoutes(restfuladapter.AdaptWebServices(webServices), config)
}
// BuildOpenAPISpecFromRoutes builds OpenAPI v3 spec given a list of route containers and common.Config to customize it.
-func BuildOpenAPISpecFromRoutes(webServices []common.RouteContainer, config *common.Config) (*spec3.OpenAPI, error) {
+func BuildOpenAPISpecFromRoutes(webServices []common.RouteContainer, config *common.OpenAPIV3Config) (*spec3.OpenAPI, error) {
a := newOpenAPI(config)
err := a.buildOpenAPISpec(webServices)
if err != nil {
return nil, err
}
+ if config.PostProcessSpec != nil {
+ return config.PostProcessSpec(a.spec)
+ }
return a.spec, nil
}
+// BuildOpenAPIDefinitionsForResource builds a partial OpenAPI spec given a sample object and common.Config to customize it.
+// BuildOpenAPIDefinitionsForResources returns the OpenAPI spec which includes the definitions for the
+// passed type names.
+func BuildOpenAPIDefinitionsForResources(config *common.OpenAPIV3Config, names ...string) (map[string]*spec.Schema, error) {
+ o := newOpenAPI(config)
+ // We can discard the return value of toSchema because all we care about is the side effect of calling it.
+ // All the models created for this resource get added to o.swagger.Definitions
+ for _, name := range names {
+ _, err := o.toSchema(name)
+ if err != nil {
+ return nil, err
+ }
+ }
+ return o.spec.Components.Schemas, nil
+}
func (o *openAPI) findCommonParameters(routes []common.Route) (map[interface{}]*spec3.Parameter, error) {
commonParamsMap := make(map[interface{}]*spec3.Parameter, 0)
paramOpsCountByName := make(map[interface{}]int, 0)
diff --git a/vendor/k8s.io/kube-openapi/pkg/cached/cache.go b/vendor/k8s.io/kube-openapi/pkg/cached/cache.go
new file mode 100644
index 000000000..a66fe8a09
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/cached/cache.go
@@ -0,0 +1,290 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Package cached provides a cache mechanism based on etags to lazily
+// build, and/or cache results from expensive operation such that those
+// operations are not repeated unnecessarily. The operations can be
+// created as a tree, and replaced dynamically as needed.
+//
+// All the operations in this module are thread-safe.
+//
+// # Dependencies and types of caches
+//
+// This package uses a source/transform/sink model of caches to build
+// the dependency tree, and can be used as follows:
+// - [Func]: A source cache that recomputes the content every time.
+// - [Once]: A source cache that always produces the
+// same content, it is only called once.
+// - [Transform]: A cache that transforms data from one format to
+// another. It's only refreshed when the source changes.
+// - [Merge]: A cache that aggregates multiple caches in a map into one.
+// It's only refreshed when the source changes.
+// - [MergeList]: A cache that aggregates multiple caches in a list into one.
+// It's only refreshed when the source changes.
+// - [Atomic]: A cache adapter that atomically replaces the source with a new one.
+// - [LastSuccess]: A cache adapter that caches the last successful and returns
+// it if the next call fails. It extends [Atomic].
+//
+// # Etags
+//
+// Etags in this library is a cache version identifier. It doesn't
+// necessarily strictly match to the semantics of http `etags`, but are
+// somewhat inspired from it and function with the same principles.
+// Hashing the content is a good way to guarantee that your function is
+// never going to be called spuriously. In Kubernetes world, this could
+// be a `resourceVersion`, this can be an actual etag, a hash, a UUID
+// (if the cache always changes), or even a made-up string when the
+// content of the cache never changes.
+package cached
+
+import (
+ "fmt"
+ "sync"
+ "sync/atomic"
+)
+
+// Value is wrapping a value behind a getter for lazy evaluation.
+type Value[T any] interface {
+ Get() (value T, etag string, err error)
+}
+
+// Result is wrapping T and error into a struct for cases where a tuple is more
+// convenient or necessary in Golang.
+type Result[T any] struct {
+ Value T
+ Etag string
+ Err error
+}
+
+func (r Result[T]) Get() (T, string, error) {
+ return r.Value, r.Etag, r.Err
+}
+
+// Func wraps a (thread-safe) function as a Value[T].
+func Func[T any](fn func() (T, string, error)) Value[T] {
+ return valueFunc[T](fn)
+}
+
+type valueFunc[T any] func() (T, string, error)
+
+func (c valueFunc[T]) Get() (T, string, error) {
+ return c()
+}
+
+// Static returns constant values.
+func Static[T any](value T, etag string) Value[T] {
+ return Result[T]{Value: value, Etag: etag}
+}
+
+// Merge merges a of cached values. The merge function only gets called if any of
+// the dependency has changed.
+//
+// If any of the dependency returned an error before, or any of the
+// dependency returned an error this time, or if the mergeFn failed
+// before, then the function is run again.
+//
+// Note that this assumes there is no "partial" merge, the merge
+// function will remerge all the dependencies together everytime. Since
+// the list of dependencies is constant, there is no way to save some
+// partial merge information either.
+//
+// Also note that Golang map iteration is not stable. If the mergeFn
+// depends on the order iteration to be stable, it will need to
+// implement its own sorting or iteration order.
+func Merge[K comparable, T, V any](mergeFn func(results map[K]Result[T]) (V, string, error), caches map[K]Value[T]) Value[V] {
+ list := make([]Value[T], 0, len(caches))
+
+ // map from index to key
+ indexes := make(map[int]K, len(caches))
+ i := 0
+ for k := range caches {
+ list = append(list, caches[k])
+ indexes[i] = k
+ i++
+ }
+
+ return MergeList(func(results []Result[T]) (V, string, error) {
+ if len(results) != len(indexes) {
+ panic(fmt.Errorf("invalid result length %d, expected %d", len(results), len(indexes)))
+ }
+ m := make(map[K]Result[T], len(results))
+ for i := range results {
+ m[indexes[i]] = results[i]
+ }
+ return mergeFn(m)
+ }, list)
+}
+
+// MergeList merges a list of cached values. The function only gets called if
+// any of the dependency has changed.
+//
+// The benefit of ListMerger over the basic Merger is that caches are
+// stored in an ordered list so the order of the cache will be
+// preserved in the order of the results passed to the mergeFn.
+//
+// If any of the dependency returned an error before, or any of the
+// dependency returned an error this time, or if the mergeFn failed
+// before, then the function is reran.
+//
+// Note that this assumes there is no "partial" merge, the merge
+// function will remerge all the dependencies together everytime. Since
+// the list of dependencies is constant, there is no way to save some
+// partial merge information either.
+func MergeList[T, V any](mergeFn func(results []Result[T]) (V, string, error), delegates []Value[T]) Value[V] {
+ return &listMerger[T, V]{
+ mergeFn: mergeFn,
+ delegates: delegates,
+ }
+}
+
+type listMerger[T, V any] struct {
+ lock sync.Mutex
+ mergeFn func([]Result[T]) (V, string, error)
+ delegates []Value[T]
+ cache []Result[T]
+ result Result[V]
+}
+
+func (c *listMerger[T, V]) prepareResultsLocked() []Result[T] {
+ cacheResults := make([]Result[T], len(c.delegates))
+ ch := make(chan struct {
+ int
+ Result[T]
+ }, len(c.delegates))
+ for i := range c.delegates {
+ go func(index int) {
+ value, etag, err := c.delegates[index].Get()
+ ch <- struct {
+ int
+ Result[T]
+ }{index, Result[T]{Value: value, Etag: etag, Err: err}}
+ }(i)
+ }
+ for i := 0; i < len(c.delegates); i++ {
+ res := <-ch
+ cacheResults[res.int] = res.Result
+ }
+ return cacheResults
+}
+
+func (c *listMerger[T, V]) needsRunningLocked(results []Result[T]) bool {
+ if c.cache == nil {
+ return true
+ }
+ if c.result.Err != nil {
+ return true
+ }
+ if len(results) != len(c.cache) {
+ panic(fmt.Errorf("invalid number of results: %v (expected %v)", len(results), len(c.cache)))
+ }
+ for i, oldResult := range c.cache {
+ newResult := results[i]
+ if newResult.Etag != oldResult.Etag || newResult.Err != nil || oldResult.Err != nil {
+ return true
+ }
+ }
+ return false
+}
+
+func (c *listMerger[T, V]) Get() (V, string, error) {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+ cacheResults := c.prepareResultsLocked()
+ if c.needsRunningLocked(cacheResults) {
+ c.cache = cacheResults
+ c.result.Value, c.result.Etag, c.result.Err = c.mergeFn(c.cache)
+ }
+ return c.result.Value, c.result.Etag, c.result.Err
+}
+
+// Transform the result of another cached value. The transformFn will only be called
+// if the source has updated, otherwise, the result will be returned.
+//
+// If the dependency returned an error before, or it returns an error
+// this time, or if the transformerFn failed before, the function is
+// reran.
+func Transform[T, V any](transformerFn func(T, string, error) (V, string, error), source Value[T]) Value[V] {
+ return MergeList(func(delegates []Result[T]) (V, string, error) {
+ if len(delegates) != 1 {
+ panic(fmt.Errorf("invalid cache for transformer cache: %v", delegates))
+ }
+ return transformerFn(delegates[0].Value, delegates[0].Etag, delegates[0].Err)
+ }, []Value[T]{source})
+}
+
+// Once calls Value[T].Get() lazily and only once, even in case of an error result.
+func Once[T any](d Value[T]) Value[T] {
+ return &once[T]{
+ data: d,
+ }
+}
+
+type once[T any] struct {
+ once sync.Once
+ data Value[T]
+ result Result[T]
+}
+
+func (c *once[T]) Get() (T, string, error) {
+ c.once.Do(func() {
+ c.result.Value, c.result.Etag, c.result.Err = c.data.Get()
+ })
+ return c.result.Value, c.result.Etag, c.result.Err
+}
+
+// Replaceable extends the Value[T] interface with the ability to change the
+// underlying Value[T] after construction.
+type Replaceable[T any] interface {
+ Value[T]
+ Store(Value[T])
+}
+
+// Atomic wraps a Value[T] as an atomic value that can be replaced. It implements
+// Replaceable[T].
+type Atomic[T any] struct {
+ value atomic.Pointer[Value[T]]
+}
+
+var _ Replaceable[[]byte] = &Atomic[[]byte]{}
+
+func (x *Atomic[T]) Store(val Value[T]) { x.value.Store(&val) }
+func (x *Atomic[T]) Get() (T, string, error) { return (*x.value.Load()).Get() }
+
+// LastSuccess calls Value[T].Get(), but hides errors by returning the last
+// success if there has been any.
+type LastSuccess[T any] struct {
+ Atomic[T]
+ success atomic.Pointer[Result[T]]
+}
+
+var _ Replaceable[[]byte] = &LastSuccess[[]byte]{}
+
+func (c *LastSuccess[T]) Get() (T, string, error) {
+ success := c.success.Load()
+ value, etag, err := c.Atomic.Get()
+ if err == nil {
+ if success == nil {
+ c.success.CompareAndSwap(nil, &Result[T]{Value: value, Etag: etag, Err: err})
+ }
+ return value, etag, err
+ }
+
+ if success != nil {
+ return success.Value, success.Etag, success.Err
+ }
+
+ return value, etag, err
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/common/common.go b/vendor/k8s.io/kube-openapi/pkg/common/common.go
index 24f2b0e88..e4ce843b0 100644
--- a/vendor/k8s.io/kube-openapi/pkg/common/common.go
+++ b/vendor/k8s.io/kube-openapi/pkg/common/common.go
@@ -22,7 +22,6 @@ import (
"github.com/emicklei/go-restful/v3"
- "k8s.io/kube-openapi/pkg/openapiconv"
"k8s.io/kube-openapi/pkg/spec3"
"k8s.io/kube-openapi/pkg/validation/spec"
)
@@ -165,6 +164,9 @@ type OpenAPIV3Config struct {
// It is an optional function to customize model names.
GetDefinitionName func(name string) (string, spec.Extensions)
+ // PostProcessSpec runs after the spec is ready to serve. It allows a final modification to the spec before serving.
+ PostProcessSpec func(*spec3.OpenAPI) (*spec3.OpenAPI, error)
+
// SecuritySchemes is list of all security schemes for OpenAPI service.
SecuritySchemes spec3.SecuritySchemes
@@ -172,43 +174,6 @@ type OpenAPIV3Config struct {
DefaultSecurity []map[string][]string
}
-// ConvertConfigToV3 converts a Config object to an OpenAPIV3Config object
-func ConvertConfigToV3(config *Config) *OpenAPIV3Config {
- if config == nil {
- return nil
- }
-
- v3Config := &OpenAPIV3Config{
- Info: config.Info,
- IgnorePrefixes: config.IgnorePrefixes,
- GetDefinitions: config.GetDefinitions,
- GetOperationIDAndTags: config.GetOperationIDAndTags,
- GetOperationIDAndTagsFromRoute: config.GetOperationIDAndTagsFromRoute,
- GetDefinitionName: config.GetDefinitionName,
- Definitions: config.Definitions,
- SecuritySchemes: make(spec3.SecuritySchemes),
- DefaultSecurity: config.DefaultSecurity,
- DefaultResponse: openapiconv.ConvertResponse(config.DefaultResponse, []string{"application/json"}),
-
- CommonResponses: make(map[int]*spec3.Response),
- ResponseDefinitions: make(map[string]*spec3.Response),
- }
-
- if config.SecurityDefinitions != nil {
- for s, securityScheme := range *config.SecurityDefinitions {
- v3Config.SecuritySchemes[s] = openapiconv.ConvertSecurityScheme(securityScheme)
- }
- }
- for k, commonResponse := range config.CommonResponses {
- v3Config.CommonResponses[k] = openapiconv.ConvertResponse(&commonResponse, []string{"application/json"})
- }
-
- for k, responseDefinition := range config.ResponseDefinitions {
- v3Config.ResponseDefinitions[k] = openapiconv.ConvertResponse(&responseDefinition, []string{"application/json"})
- }
- return v3Config
-}
-
type typeInfo struct {
name string
format string
@@ -246,38 +211,42 @@ var schemaTypeFormatMap = map[string]typeInfo{
// the spec does not need to be simple type,format) or can even return a simple type,format (e.g. IntOrString). For simple
// type formats, the benefit of adding OpenAPIDefinitionGetter interface is to keep both type and property documentation.
// Example:
-// type Sample struct {
-// ...
-// // port of the server
-// port IntOrString
-// ...
-// }
+//
+// type Sample struct {
+// ...
+// // port of the server
+// port IntOrString
+// ...
+// }
+//
// // IntOrString documentation...
// type IntOrString { ... }
//
// Adding IntOrString to this function:
-// "port" : {
-// format: "string",
-// type: "int-or-string",
-// Description: "port of the server"
-// }
+//
+// "port" : {
+// format: "string",
+// type: "int-or-string",
+// Description: "port of the server"
+// }
//
// Implement OpenAPIDefinitionGetter for IntOrString:
//
-// "port" : {
-// $Ref: "#/definitions/IntOrString"
-// Description: "port of the server"
-// }
+// "port" : {
+// $Ref: "#/definitions/IntOrString"
+// Description: "port of the server"
+// }
+//
// ...
// definitions:
-// {
-// "IntOrString": {
-// format: "string",
-// type: "int-or-string",
-// Description: "IntOrString documentation..." // new
-// }
-// }
//
+// {
+// "IntOrString": {
+// format: "string",
+// type: "int-or-string",
+// Description: "IntOrString documentation..." // new
+// }
+// }
func OpenAPITypeFormat(typeName string) (string, string) {
mapped, ok := schemaTypeFormatMap[typeName]
if !ok {
diff --git a/vendor/k8s.io/kube-openapi/pkg/common/restfuladapter/adapter.go b/vendor/k8s.io/kube-openapi/pkg/common/restfuladapter/adapter.go
index 6755f8760..932b84a01 100644
--- a/vendor/k8s.io/kube-openapi/pkg/common/restfuladapter/adapter.go
+++ b/vendor/k8s.io/kube-openapi/pkg/common/restfuladapter/adapter.go
@@ -13,4 +13,3 @@ func AdaptWebServices(webServices []*restful.WebService) []common.RouteContainer
}
return containers
}
-
diff --git a/vendor/k8s.io/kube-openapi/pkg/handler/handler.go b/vendor/k8s.io/kube-openapi/pkg/handler/handler.go
index 7a2590dcb..5fc629773 100644
--- a/vendor/k8s.io/kube-openapi/pkg/handler/handler.go
+++ b/vendor/k8s.io/kube-openapi/pkg/handler/handler.go
@@ -18,36 +18,31 @@ package handler
import (
"bytes"
- "compress/gzip"
"crypto/sha512"
- "encoding/json"
"fmt"
- "mime"
"net/http"
"strconv"
- "sync"
"time"
"github.com/NYTimes/gziphandler"
"github.com/emicklei/go-restful/v3"
"github.com/golang/protobuf/proto"
- openapi_v2 "github.com/google/gnostic/openapiv2"
+ openapi_v2 "github.com/google/gnostic-models/openapiv2"
+ "github.com/google/uuid"
"github.com/munnerz/goautoneg"
+
klog "k8s.io/klog/v2"
"k8s.io/kube-openapi/pkg/builder"
+ "k8s.io/kube-openapi/pkg/cached"
"k8s.io/kube-openapi/pkg/common"
"k8s.io/kube-openapi/pkg/common/restfuladapter"
- "k8s.io/kube-openapi/pkg/internal/handler"
"k8s.io/kube-openapi/pkg/validation/spec"
)
const (
- jsonExt = ".json"
-
- mimeJson = "application/json"
- // TODO(mehdy): change @68f4ded to a version tag when gnostic add version tags.
- mimePb = "application/com.github.googleapis.gnostic.OpenAPIv2@68f4ded+protobuf"
- mimePbGz = "application/x-gzip"
+ subTypeProtobufDeprecated = "com.github.proto-openapi.spec.v2@v1.0+protobuf"
+ subTypeProtobuf = "com.github.proto-openapi.spec.v2.v1.0+protobuf"
+ subTypeJSON = "json"
)
func computeETag(data []byte) string {
@@ -57,87 +52,62 @@ func computeETag(data []byte) string {
return fmt.Sprintf("%X", sha512.Sum512(data))
}
-// OpenAPIService is the service responsible for serving OpenAPI spec. It has
-// the ability to safely change the spec while serving it.
-type OpenAPIService struct {
- // rwMutex protects All members of this service.
- rwMutex sync.RWMutex
-
+type timedSpec struct {
+ spec []byte
lastModified time.Time
-
- jsonCache handler.HandlerCache
- protoCache handler.HandlerCache
- etagCache handler.HandlerCache
}
-func init() {
- mime.AddExtensionType(".json", mimeJson)
- mime.AddExtensionType(".pb-v1", mimePb)
- mime.AddExtensionType(".gz", mimePbGz)
+// OpenAPIService is the service responsible for serving OpenAPI spec. It has
+// the ability to safely change the spec while serving it.
+type OpenAPIService struct {
+ specCache cached.LastSuccess[*spec.Swagger]
+ jsonCache cached.Value[timedSpec]
+ protoCache cached.Value[timedSpec]
}
// NewOpenAPIService builds an OpenAPIService starting with the given spec.
-func NewOpenAPIService(spec *spec.Swagger) (*OpenAPIService, error) {
- o := &OpenAPIService{}
- if err := o.UpdateSpec(spec); err != nil {
- return nil, err
- }
- return o, nil
+func NewOpenAPIService(swagger *spec.Swagger) *OpenAPIService {
+ return NewOpenAPIServiceLazy(cached.Static(swagger, uuid.New().String()))
}
-func (o *OpenAPIService) getSwaggerBytes() ([]byte, string, time.Time, error) {
- o.rwMutex.RLock()
- defer o.rwMutex.RUnlock()
- specBytes, err := o.jsonCache.Get()
- if err != nil {
- return nil, "", time.Time{}, err
- }
- etagBytes, err := o.etagCache.Get()
- if err != nil {
- return nil, "", time.Time{}, err
- }
- return specBytes, string(etagBytes), o.lastModified, nil
-}
-
-func (o *OpenAPIService) getSwaggerPbBytes() ([]byte, string, time.Time, error) {
- o.rwMutex.RLock()
- defer o.rwMutex.RUnlock()
- specPb, err := o.protoCache.Get()
- if err != nil {
- return nil, "", time.Time{}, err
- }
- etagBytes, err := o.etagCache.Get()
- if err != nil {
- return nil, "", time.Time{}, err
- }
- return specPb, string(etagBytes), o.lastModified, nil
-}
+// NewOpenAPIServiceLazy builds an OpenAPIService from lazy spec.
+func NewOpenAPIServiceLazy(swagger cached.Value[*spec.Swagger]) *OpenAPIService {
+ o := &OpenAPIService{}
+ o.UpdateSpecLazy(swagger)
-func (o *OpenAPIService) UpdateSpec(openapiSpec *spec.Swagger) (err error) {
- o.rwMutex.Lock()
- defer o.rwMutex.Unlock()
- o.jsonCache = o.jsonCache.New(func() ([]byte, error) {
- return json.Marshal(openapiSpec)
- })
- o.protoCache = o.protoCache.New(func() ([]byte, error) {
- json, err := o.jsonCache.Get()
+ o.jsonCache = cached.Transform[*spec.Swagger](func(spec *spec.Swagger, etag string, err error) (timedSpec, string, error) {
+ if err != nil {
+ return timedSpec{}, "", err
+ }
+ json, err := spec.MarshalJSON()
+ if err != nil {
+ return timedSpec{}, "", err
+ }
+ return timedSpec{spec: json, lastModified: time.Now()}, computeETag(json), nil
+ }, &o.specCache)
+ o.protoCache = cached.Transform(func(ts timedSpec, etag string, err error) (timedSpec, string, error) {
if err != nil {
- return nil, err
+ return timedSpec{}, "", err
}
- return ToProtoBinary(json)
- })
- o.etagCache = o.etagCache.New(func() ([]byte, error) {
- json, err := o.jsonCache.Get()
+ proto, err := ToProtoBinary(ts.spec)
if err != nil {
- return nil, err
+ return timedSpec{}, "", err
}
- return []byte(computeETag(json)), nil
- })
- o.lastModified = time.Now()
+ // We can re-use the same etag as json because of the Vary header.
+ return timedSpec{spec: proto, lastModified: ts.lastModified}, etag, nil
+ }, o.jsonCache)
+ return o
+}
+func (o *OpenAPIService) UpdateSpec(swagger *spec.Swagger) error {
+ o.UpdateSpecLazy(cached.Static(swagger, uuid.New().String()))
return nil
}
+func (o *OpenAPIService) UpdateSpecLazy(swagger cached.Value[*spec.Swagger]) {
+ o.specCache.Store(swagger)
+}
+
func ToProtoBinary(json []byte) ([]byte, error) {
document, err := openapi_v2.ParseDocument(json)
if err != nil {
@@ -146,34 +116,26 @@ func ToProtoBinary(json []byte) ([]byte, error) {
return proto.Marshal(document)
}
-func toGzip(data []byte) []byte {
- var buf bytes.Buffer
- zw := gzip.NewWriter(&buf)
- zw.Write(data)
- zw.Close()
- return buf.Bytes()
-}
-
// RegisterOpenAPIVersionedService registers a handler to provide access to provided swagger spec.
//
// Deprecated: use OpenAPIService.RegisterOpenAPIVersionedService instead.
-func RegisterOpenAPIVersionedService(spec *spec.Swagger, servePath string, handler common.PathHandler) (*OpenAPIService, error) {
- o, err := NewOpenAPIService(spec)
- if err != nil {
- return nil, err
- }
- return o, o.RegisterOpenAPIVersionedService(servePath, handler)
+func RegisterOpenAPIVersionedService(spec *spec.Swagger, servePath string, handler common.PathHandler) *OpenAPIService {
+ o := NewOpenAPIService(spec)
+ o.RegisterOpenAPIVersionedService(servePath, handler)
+ return o
}
// RegisterOpenAPIVersionedService registers a handler to provide access to provided swagger spec.
-func (o *OpenAPIService) RegisterOpenAPIVersionedService(servePath string, handler common.PathHandler) error {
+func (o *OpenAPIService) RegisterOpenAPIVersionedService(servePath string, handler common.PathHandler) {
accepted := []struct {
- Type string
- SubType string
- GetDataAndETag func() ([]byte, string, time.Time, error)
+ Type string
+ SubType string
+ ReturnedContentType string
+ GetDataAndEtag cached.Value[timedSpec]
}{
- {"application", "json", o.getSwaggerBytes},
- {"application", "com.github.proto-openapi.spec.v2@v1.0+protobuf", o.getSwaggerPbBytes},
+ {"application", subTypeJSON, "application/" + subTypeJSON, o.jsonCache},
+ {"application", subTypeProtobufDeprecated, "application/" + subTypeProtobuf, o.protoCache},
+ {"application", subTypeProtobuf, "application/" + subTypeProtobuf, o.protoCache},
}
handler.Handle(servePath, gziphandler.GzipHandler(http.HandlerFunc(
@@ -192,21 +154,23 @@ func (o *OpenAPIService) RegisterOpenAPIVersionedService(servePath string, handl
if clause.SubType != accepts.SubType && clause.SubType != "*" {
continue
}
-
// serve the first matching media type in the sorted clause list
- data, etag, lastModified, err := accepts.GetDataAndETag()
+ ts, etag, err := accepts.GetDataAndEtag.Get()
if err != nil {
klog.Errorf("Error in OpenAPI handler: %s", err)
// only return a 503 if we have no older cache data to serve
- if data == nil {
+ if ts.spec == nil {
w.WriteHeader(http.StatusServiceUnavailable)
return
}
}
+ // Set Content-Type header in the reponse
+ w.Header().Set("Content-Type", accepts.ReturnedContentType)
+
// ETag must be enclosed in double quotes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
w.Header().Set("Etag", strconv.Quote(etag))
// ServeContent will take care of caching using eTag.
- http.ServeContent(w, r, servePath, lastModified, bytes.NewReader(data))
+ http.ServeContent(w, r, servePath, ts.lastModified, bytes.NewReader(ts.spec))
return
}
}
@@ -215,8 +179,6 @@ func (o *OpenAPIService) RegisterOpenAPIVersionedService(servePath string, handl
return
}),
))
-
- return nil
}
// BuildAndRegisterOpenAPIVersionedService builds the spec and registers a handler to provide access to it.
@@ -234,9 +196,7 @@ func BuildAndRegisterOpenAPIVersionedServiceFromRoutes(servePath string, routeCo
if err != nil {
return nil, err
}
- o, err := NewOpenAPIService(spec)
- if err != nil {
- return nil, err
- }
- return o, o.RegisterOpenAPIVersionedService(servePath, handler)
+ o := NewOpenAPIService(spec)
+ o.RegisterOpenAPIVersionedService(servePath, handler)
+ return o, nil
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/handler3/handler.go b/vendor/k8s.io/kube-openapi/pkg/handler3/handler.go
index ec4adcdec..fc4563488 100644
--- a/vendor/k8s.io/kube-openapi/pkg/handler3/handler.go
+++ b/vendor/k8s.io/kube-openapi/pkg/handler3/handler.go
@@ -21,35 +21,29 @@ import (
"crypto/sha512"
"encoding/json"
"fmt"
- "mime"
"net/http"
"net/url"
"path"
- "sort"
"strconv"
"strings"
"sync"
"time"
"github.com/golang/protobuf/proto"
- openapi_v3 "github.com/google/gnostic/openapiv3"
+ openapi_v3 "github.com/google/gnostic-models/openapiv3"
+ "github.com/google/uuid"
"github.com/munnerz/goautoneg"
+
+ "k8s.io/klog/v2"
+ "k8s.io/kube-openapi/pkg/cached"
"k8s.io/kube-openapi/pkg/common"
- "k8s.io/kube-openapi/pkg/internal/handler"
"k8s.io/kube-openapi/pkg/spec3"
- "k8s.io/kube-openapi/pkg/validation/spec"
)
const (
- jsonExt = ".json"
-
- mimeJson = "application/json"
- // TODO(mehdy): change @68f4ded to a version tag when gnostic add version tags.
- mimePb = "application/com.github.googleapis.gnostic.OpenAPIv3@68f4ded+protobuf"
- mimePbGz = "application/x-gzip"
-
- subTypeProtobuf = "com.github.proto-openapi.spec.v3@v1.0+protobuf"
- subTypeJSON = "json"
+ subTypeProtobufDeprecated = "com.github.proto-openapi.spec.v3@v1.0+protobuf"
+ subTypeProtobuf = "com.github.proto-openapi.spec.v3.v1.0+protobuf"
+ subTypeJSON = "json"
)
// OpenAPIV3Discovery is the format of the Discovery document for OpenAPI V3
@@ -65,29 +59,63 @@ type OpenAPIV3DiscoveryGroupVersion struct {
ServerRelativeURL string `json:"serverRelativeURL"`
}
-// OpenAPIService is the service responsible for serving OpenAPI spec. It has
-// the ability to safely change the spec while serving it.
-type OpenAPIService struct {
- // rwMutex protects All members of this service.
- rwMutex sync.RWMutex
+func ToV3ProtoBinary(json []byte) ([]byte, error) {
+ document, err := openapi_v3.ParseDocument(json)
+ if err != nil {
+ return nil, err
+ }
+ return proto.Marshal(document)
+}
+
+type timedSpec struct {
+ spec []byte
lastModified time.Time
- v3Schema map[string]*OpenAPIV3Group
}
-type OpenAPIV3Group struct {
- rwMutex sync.RWMutex
+// This type is protected by the lock on OpenAPIService.
+type openAPIV3Group struct {
+ specCache cached.LastSuccess[*spec3.OpenAPI]
+ pbCache cached.Value[timedSpec]
+ jsonCache cached.Value[timedSpec]
+}
- lastModified time.Time
+func newOpenAPIV3Group() *openAPIV3Group {
+ o := &openAPIV3Group{}
+ o.jsonCache = cached.Transform[*spec3.OpenAPI](func(spec *spec3.OpenAPI, etag string, err error) (timedSpec, string, error) {
+ if err != nil {
+ return timedSpec{}, "", err
+ }
+ json, err := json.Marshal(spec)
+ if err != nil {
+ return timedSpec{}, "", err
+ }
+ return timedSpec{spec: json, lastModified: time.Now()}, computeETag(json), nil
+ }, &o.specCache)
+ o.pbCache = cached.Transform(func(ts timedSpec, etag string, err error) (timedSpec, string, error) {
+ if err != nil {
+ return timedSpec{}, "", err
+ }
+ proto, err := ToV3ProtoBinary(ts.spec)
+ if err != nil {
+ return timedSpec{}, "", err
+ }
+ return timedSpec{spec: proto, lastModified: ts.lastModified}, etag, nil
+ }, o.jsonCache)
+ return o
+}
- pbCache handler.HandlerCache
- jsonCache handler.HandlerCache
- etagCache handler.HandlerCache
+func (o *openAPIV3Group) UpdateSpec(openapi cached.Value[*spec3.OpenAPI]) {
+ o.specCache.Store(openapi)
}
-func init() {
- mime.AddExtensionType(".json", mimeJson)
- mime.AddExtensionType(".pb-v1", mimePb)
- mime.AddExtensionType(".gz", mimePbGz)
+// OpenAPIService is the service responsible for serving OpenAPI spec. It has
+// the ability to safely change the spec while serving it.
+type OpenAPIService struct {
+ // Mutex protects the schema map.
+ mutex sync.Mutex
+ v3Schema map[string]*openAPIV3Group
+
+ discoveryCache cached.LastSuccess[timedSpec]
}
func computeETag(data []byte) string {
@@ -106,92 +134,90 @@ func constructServerRelativeURL(gvString, etag string) string {
}
// NewOpenAPIService builds an OpenAPIService starting with the given spec.
-func NewOpenAPIService(spec *spec.Swagger) (*OpenAPIService, error) {
+func NewOpenAPIService() *OpenAPIService {
o := &OpenAPIService{}
- o.v3Schema = make(map[string]*OpenAPIV3Group)
- return o, nil
+ o.v3Schema = make(map[string]*openAPIV3Group)
+ // We're not locked because we haven't shared the structure yet.
+ o.discoveryCache.Store(o.buildDiscoveryCacheLocked())
+ return o
}
-func (o *OpenAPIService) getGroupBytes() ([]byte, error) {
- o.rwMutex.RLock()
- defer o.rwMutex.RUnlock()
- keys := make([]string, len(o.v3Schema))
- i := 0
- for k := range o.v3Schema {
- keys[i] = k
- i++
+func (o *OpenAPIService) buildDiscoveryCacheLocked() cached.Value[timedSpec] {
+ caches := make(map[string]cached.Value[timedSpec], len(o.v3Schema))
+ for gvName, group := range o.v3Schema {
+ caches[gvName] = group.jsonCache
}
-
- sort.Strings(keys)
- discovery := &OpenAPIV3Discovery{Paths: make(map[string]OpenAPIV3DiscoveryGroupVersion)}
- for gvString, groupVersion := range o.v3Schema {
- etagBytes, err := groupVersion.etagCache.Get()
- if err != nil {
- return nil, err
+ return cached.Merge(func(results map[string]cached.Result[timedSpec]) (timedSpec, string, error) {
+ discovery := &OpenAPIV3Discovery{Paths: make(map[string]OpenAPIV3DiscoveryGroupVersion)}
+ for gvName, result := range results {
+ if result.Err != nil {
+ return timedSpec{}, "", result.Err
+ }
+ discovery.Paths[gvName] = OpenAPIV3DiscoveryGroupVersion{
+ ServerRelativeURL: constructServerRelativeURL(gvName, result.Etag),
+ }
}
- discovery.Paths[gvString] = OpenAPIV3DiscoveryGroupVersion{
- ServerRelativeURL: constructServerRelativeURL(gvString, string(etagBytes)),
+ j, err := json.Marshal(discovery)
+ if err != nil {
+ return timedSpec{}, "", err
}
- }
- j, err := json.Marshal(discovery)
- if err != nil {
- return nil, err
- }
- return j, nil
+ return timedSpec{spec: j, lastModified: time.Now()}, computeETag(j), nil
+ }, caches)
}
func (o *OpenAPIService) getSingleGroupBytes(getType string, group string) ([]byte, string, time.Time, error) {
- o.rwMutex.RLock()
- defer o.rwMutex.RUnlock()
+ o.mutex.Lock()
+ defer o.mutex.Unlock()
v, ok := o.v3Schema[group]
if !ok {
return nil, "", time.Now(), fmt.Errorf("Cannot find CRD group %s", group)
}
- if getType == subTypeJSON {
- specBytes, err := v.jsonCache.Get()
- if err != nil {
- return nil, "", v.lastModified, err
- }
- etagBytes, err := v.etagCache.Get()
- return specBytes, string(etagBytes), v.lastModified, err
- } else if getType == subTypeProtobuf {
- specPb, err := v.pbCache.Get()
- if err != nil {
- return nil, "", v.lastModified, err
- }
- etagBytes, err := v.etagCache.Get()
- return specPb, string(etagBytes), v.lastModified, err
+ switch getType {
+ case subTypeJSON:
+ ts, etag, err := v.jsonCache.Get()
+ return ts.spec, etag, ts.lastModified, err
+ case subTypeProtobuf, subTypeProtobufDeprecated:
+ ts, etag, err := v.pbCache.Get()
+ return ts.spec, etag, ts.lastModified, err
+ default:
+ return nil, "", time.Now(), fmt.Errorf("Invalid accept clause %s", getType)
}
- return nil, "", time.Now(), fmt.Errorf("Invalid accept clause %s", getType)
}
-func (o *OpenAPIService) UpdateGroupVersion(group string, openapi *spec3.OpenAPI) (err error) {
- o.rwMutex.Lock()
- defer o.rwMutex.Unlock()
-
+// UpdateGroupVersionLazy adds or updates an existing group with the new cached.
+func (o *OpenAPIService) UpdateGroupVersionLazy(group string, openapi cached.Value[*spec3.OpenAPI]) {
+ o.mutex.Lock()
+ defer o.mutex.Unlock()
if _, ok := o.v3Schema[group]; !ok {
- o.v3Schema[group] = &OpenAPIV3Group{}
+ o.v3Schema[group] = newOpenAPIV3Group()
+ // Since there is a new item, we need to re-build the cache map.
+ o.discoveryCache.Store(o.buildDiscoveryCacheLocked())
}
- return o.v3Schema[group].UpdateSpec(openapi)
+ o.v3Schema[group].UpdateSpec(openapi)
+}
+
+func (o *OpenAPIService) UpdateGroupVersion(group string, openapi *spec3.OpenAPI) {
+ o.UpdateGroupVersionLazy(group, cached.Static(openapi, uuid.New().String()))
}
func (o *OpenAPIService) DeleteGroupVersion(group string) {
- o.rwMutex.Lock()
- defer o.rwMutex.Unlock()
+ o.mutex.Lock()
+ defer o.mutex.Unlock()
delete(o.v3Schema, group)
+ // Rebuild the merge cache map since the items have changed.
+ o.discoveryCache.Store(o.buildDiscoveryCacheLocked())
}
-func ToV3ProtoBinary(json []byte) ([]byte, error) {
- document, err := openapi_v3.ParseDocument(json)
+func (o *OpenAPIService) HandleDiscovery(w http.ResponseWriter, r *http.Request) {
+ ts, etag, err := o.discoveryCache.Get()
if err != nil {
- return nil, err
+ klog.Errorf("Error serving discovery: %s", err)
+ w.WriteHeader(http.StatusInternalServerError)
+ return
}
- return proto.Marshal(document)
-}
-
-func (o *OpenAPIService) HandleDiscovery(w http.ResponseWriter, r *http.Request) {
- data, _ := o.getGroupBytes()
- http.ServeContent(w, r, "/openapi/v3", time.Now(), bytes.NewReader(data))
+ w.Header().Set("Etag", strconv.Quote(etag))
+ w.Header().Set("Content-Type", "application/json")
+ http.ServeContent(w, r, "/openapi/v3", ts.lastModified, bytes.NewReader(ts.spec))
}
func (o *OpenAPIService) HandleGroupVersion(w http.ResponseWriter, r *http.Request) {
@@ -210,11 +236,13 @@ func (o *OpenAPIService) HandleGroupVersion(w http.ResponseWriter, r *http.Reque
}
accepted := []struct {
- Type string
- SubType string
+ Type string
+ SubType string
+ ReturnedContentType string
}{
- {"application", subTypeJSON},
- {"application", subTypeProtobuf},
+ {"application", subTypeJSON, "application/" + subTypeJSON},
+ {"application", subTypeProtobuf, "application/" + subTypeProtobuf},
+ {"application", subTypeProtobufDeprecated, "application/" + subTypeProtobuf},
}
for _, clause := range clauses {
@@ -229,6 +257,9 @@ func (o *OpenAPIService) HandleGroupVersion(w http.ResponseWriter, r *http.Reque
if err != nil {
return
}
+ // Set Content-Type header in the reponse
+ w.Header().Set("Content-Type", accepts.ReturnedContentType)
+
// ETag must be enclosed in double quotes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
w.Header().Set("Etag", strconv.Quote(etag))
@@ -262,30 +293,3 @@ func (o *OpenAPIService) RegisterOpenAPIV3VersionedService(servePath string, han
handler.HandlePrefix(servePath+"/", http.HandlerFunc(o.HandleGroupVersion))
return nil
}
-
-func (o *OpenAPIV3Group) UpdateSpec(openapi *spec3.OpenAPI) (err error) {
- o.rwMutex.Lock()
- defer o.rwMutex.Unlock()
-
- o.jsonCache = o.jsonCache.New(func() ([]byte, error) {
- return json.Marshal(openapi)
- })
- o.pbCache = o.pbCache.New(func() ([]byte, error) {
- json, err := o.jsonCache.Get()
- if err != nil {
- return nil, err
- }
- return ToV3ProtoBinary(json)
- })
- // TODO: This forces a json marshal of corresponding group-versions.
- // We should look to replace this with a faster hashing mechanism.
- o.etagCache = o.etagCache.New(func() ([]byte, error) {
- json, err := o.jsonCache.Get()
- if err != nil {
- return nil, err
- }
- return []byte(computeETag(json)), nil
- })
- o.lastModified = time.Now()
- return nil
-}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/flags.go b/vendor/k8s.io/kube-openapi/pkg/internal/flags.go
index 3ff3c8d89..da5485f6a 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/flags.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/flags.go
@@ -18,3 +18,8 @@ package internal
// Used by tests to selectively disable experimental JSON unmarshaler
var UseOptimizedJSONUnmarshaling bool = true
+var UseOptimizedJSONUnmarshalingV3 bool = true
+
+// Used by tests to selectively disable experimental JSON marshaler
+var UseOptimizedJSONMarshaling bool = true
+var UseOptimizedJSONMarshalingV3 bool = true
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/handler/handler_cache.go b/vendor/k8s.io/kube-openapi/pkg/internal/handler/handler_cache.go
deleted file mode 100644
index e128c26eb..000000000
--- a/vendor/k8s.io/kube-openapi/pkg/internal/handler/handler_cache.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-Copyright 2021 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package handler
-
-import (
- "sync"
-)
-
-// HandlerCache represents a lazy cache for generating a byte array
-// It is used to lazily marshal OpenAPI v2/v3 and lazily generate the ETag
-type HandlerCache struct {
- BuildCache func() ([]byte, error)
- once sync.Once
- bytes []byte
- err error
-}
-
-// Get either returns the cached value or calls BuildCache() once before caching and returning
-// its results. If BuildCache returns an error, the last valid value for the cache (from prior
-// calls to New()) is used instead if possible.
-func (c *HandlerCache) Get() ([]byte, error) {
- c.once.Do(func() {
- bytes, err := c.BuildCache()
- // if there is an error updating the cache, there can be situations where
- // c.bytes contains a valid value (carried over from the previous update)
- // but c.err is also not nil; the cache user is expected to check for this
- c.err = err
- if c.err == nil {
- // don't override previous spec if we had an error
- c.bytes = bytes
- }
- })
- return c.bytes, c.err
-}
-
-// New creates a new HandlerCache for situations where a cache refresh is needed.
-// This function is not thread-safe and should not be called at the same time as Get().
-func (c *HandlerCache) New(cacheBuilder func() ([]byte, error)) HandlerCache {
- return HandlerCache{
- bytes: c.bytes,
- BuildCache: cacheBuilder,
- }
-}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/serialization.go b/vendor/k8s.io/kube-openapi/pkg/internal/serialization.go
new file mode 100644
index 000000000..7393bacf7
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/serialization.go
@@ -0,0 +1,65 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package internal
+
+import (
+ "github.com/go-openapi/jsonreference"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+)
+
+// DeterministicMarshal calls the jsonv2 library with the deterministic
+// flag in order to have stable marshaling.
+func DeterministicMarshal(in any) ([]byte, error) {
+ return jsonv2.MarshalOptions{Deterministic: true}.Marshal(jsonv2.EncodeOptions{}, in)
+}
+
+// JSONRefFromMap populates a json reference object if the map v contains a $ref key.
+func JSONRefFromMap(jsonRef *jsonreference.Ref, v map[string]interface{}) error {
+ if v == nil {
+ return nil
+ }
+ if vv, ok := v["$ref"]; ok {
+ if str, ok := vv.(string); ok {
+ ref, err := jsonreference.New(str)
+ if err != nil {
+ return err
+ }
+ *jsonRef = ref
+ }
+ }
+ return nil
+}
+
+// SanitizeExtensions sanitizes the input map such that non extension
+// keys (non x-*, X-*) keys are dropped from the map. Returns the new
+// modified map, or nil if the map is now empty.
+func SanitizeExtensions(e map[string]interface{}) map[string]interface{} {
+ for k := range e {
+ if !IsExtensionKey(k) {
+ delete(e, k)
+ }
+ }
+ if len(e) == 0 {
+ e = nil
+ }
+ return e
+}
+
+// IsExtensionKey returns true if the input string is of format x-* or X-*
+func IsExtensionKey(k string) bool {
+ return len(k) > 1 && (k[0] == 'x' || k[0] == 'X') && k[1] == '-'
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal.go
index febde20f9..e6c6216ff 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal.go
@@ -34,6 +34,13 @@ type MarshalOptions struct {
// unknown JSON object members.
DiscardUnknownMembers bool
+ // Deterministic specifies that the same input value will be serialized
+ // as the exact same output bytes. Different processes of
+ // the same program will serialize equal values to the same bytes,
+ // but different versions of the same program are not guaranteed
+ // to produce the exact same sequence of bytes.
+ Deterministic bool
+
// formatDepth is the depth at which we respect the format flag.
formatDepth int
// format is custom formatting for the value at the specified depth.
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_any.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_any.go
index 204d0648d..c62b1f320 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_any.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_any.go
@@ -62,7 +62,7 @@ func unmarshalValueAny(uo UnmarshalOptions, dec *Decoder) (any, error) {
}
return dec.stringCache.make(val), nil
case '0':
- fv, _ := parseFloat(val, 64) // ignore error since readValue gaurantees val is valid
+ fv, _ := parseFloat(val, 64) // ignore error since readValue guarantees val is valid
return fv, nil
default:
panic("BUG: invalid kind: " + k.String())
@@ -99,13 +99,32 @@ func marshalObjectAny(mo MarshalOptions, enc *Encoder, obj map[string]any) error
if !enc.options.AllowInvalidUTF8 {
enc.tokens.last.disableNamespace()
}
- for name, val := range obj {
- if err := enc.WriteToken(String(name)); err != nil {
- return err
+ if !mo.Deterministic || len(obj) <= 1 {
+ for name, val := range obj {
+ if err := enc.WriteToken(String(name)); err != nil {
+ return err
+ }
+ if err := marshalValueAny(mo, enc, val); err != nil {
+ return err
+ }
}
- if err := marshalValueAny(mo, enc, val); err != nil {
- return err
+ } else {
+ names := getStrings(len(obj))
+ var i int
+ for name := range obj {
+ (*names)[i] = name
+ i++
+ }
+ names.Sort()
+ for _, name := range *names {
+ if err := enc.WriteToken(String(name)); err != nil {
+ return err
+ }
+ if err := marshalValueAny(mo, enc, obj[name]); err != nil {
+ return err
+ }
}
+ putStrings(names)
}
if err := enc.WriteToken(ObjectEnd); err != nil {
return err
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_default.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_default.go
index fcf3d5000..fd26eba35 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_default.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_default.go
@@ -5,6 +5,7 @@
package json
import (
+ "bytes"
"encoding/base32"
"encoding/base64"
"encoding/hex"
@@ -12,6 +13,7 @@ import (
"fmt"
"math"
"reflect"
+ "sort"
"strconv"
"sync"
)
@@ -228,13 +230,7 @@ func makeBytesArshaler(t reflect.Type, fncs *arshaler) *arshaler {
}
}
val := enc.UnusedBuffer()
- var b []byte
- if va.Kind() == reflect.Array {
- // TODO(https://go.dev/issue/47066): Avoid reflect.Value.Slice.
- b = va.Slice(0, va.Len()).Bytes()
- } else {
- b = va.Bytes()
- }
+ b := va.Bytes()
n := len(`"`) + encodedLen(len(b)) + len(`"`)
if cap(val) < n {
val = make([]byte, n)
@@ -248,19 +244,19 @@ func makeBytesArshaler(t reflect.Type, fncs *arshaler) *arshaler {
}
unmarshalDefault := fncs.unmarshal
fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
- decode, decodedLen := decodeBase64, decodedLenBase64
+ decode, decodedLen, encodedLen := decodeBase64, decodedLenBase64, encodedLenBase64
if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
switch uo.format {
case "base64":
- decode, decodedLen = decodeBase64, decodedLenBase64
+ decode, decodedLen, encodedLen = decodeBase64, decodedLenBase64, encodedLenBase64
case "base64url":
- decode, decodedLen = decodeBase64URL, decodedLenBase64URL
+ decode, decodedLen, encodedLen = decodeBase64URL, decodedLenBase64URL, encodedLenBase64URL
case "base32":
- decode, decodedLen = decodeBase32, decodedLenBase32
+ decode, decodedLen, encodedLen = decodeBase32, decodedLenBase32, encodedLenBase32
case "base32hex":
- decode, decodedLen = decodeBase32Hex, decodedLenBase32Hex
+ decode, decodedLen, encodedLen = decodeBase32Hex, decodedLenBase32Hex, encodedLenBase32Hex
case "base16", "hex":
- decode, decodedLen = decodeBase16, decodedLenBase16
+ decode, decodedLen, encodedLen = decodeBase16, decodedLenBase16, encodedLenBase16
case "array":
uo.format = ""
return unmarshalDefault(uo, dec, va)
@@ -290,23 +286,28 @@ func makeBytesArshaler(t reflect.Type, fncs *arshaler) *arshaler {
n--
}
n = decodedLen(n)
- var b []byte
+ b := va.Bytes()
if va.Kind() == reflect.Array {
- // TODO(https://go.dev/issue/47066): Avoid reflect.Value.Slice.
- b = va.Slice(0, va.Len()).Bytes()
if n != len(b) {
err := fmt.Errorf("decoded base64 length of %d mismatches array length of %d", n, len(b))
return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
}
} else {
- b = va.Bytes()
if b == nil || cap(b) < n {
b = make([]byte, n)
} else {
b = b[:n]
}
}
- if _, err := decode(b, val); err != nil {
+ n2, err := decode(b, val)
+ if err == nil && len(val) != encodedLen(n2) {
+ // TODO(https://go.dev/issue/53845): RFC 4648, section 3.3,
+ // specifies that non-alphabet characters must be rejected.
+ // Unfortunately, the "base32" and "base64" packages allow
+ // '\r' and '\n' characters by default.
+ err = errors.New("illegal data at input byte " + strconv.Itoa(bytes.IndexAny(val, "\r\n")))
+ }
+ if err != nil {
return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
}
if va.Kind() == reflect.Slice {
@@ -412,7 +413,7 @@ func makeUintArshaler(t reflect.Type) *arshaler {
return nil
}
- x := math.Float64frombits(uint64(va.Uint()))
+ x := math.Float64frombits(va.Uint())
return enc.writeNumber(x, rawUintNumber, mo.StringifyNumbers)
}
fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
@@ -450,7 +451,7 @@ func makeUintArshaler(t reflect.Type) *arshaler {
err := fmt.Errorf("cannot parse %q as unsigned integer: %w", val, strconv.ErrRange)
return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
}
- va.SetUint(uint64(n))
+ va.SetUint(n)
return nil
}
return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t}
@@ -549,23 +550,9 @@ func makeFloatArshaler(t reflect.Type) *arshaler {
return &fncs
}
-var mapIterPool = sync.Pool{
- New: func() any { return new(reflect.MapIter) },
-}
-
-func getMapIter(mv reflect.Value) *reflect.MapIter {
- iter := mapIterPool.Get().(*reflect.MapIter)
- iter.Reset(mv)
- return iter
-}
-func putMapIter(iter *reflect.MapIter) {
- iter.Reset(reflect.Value{}) // allow underlying map to be garbage collected
- mapIterPool.Put(iter)
-}
-
func makeMapArshaler(t reflect.Type) *arshaler {
// NOTE: The logic below disables namespaces for tracking duplicate names
- // when handling map keys with a unique represention.
+ // when handling map keys with a unique representation.
// NOTE: Values retrieved from a map are not addressable,
// so we shallow copy the values to make them addressable and
@@ -641,24 +628,76 @@ func makeMapArshaler(t reflect.Type) *arshaler {
enc.tokens.last.disableNamespace()
}
- // NOTE: Map entries are serialized in a non-deterministic order.
- // Users that need stable output should call RawValue.Canonicalize.
- // TODO(go1.19): Remove use of a sync.Pool with reflect.MapIter.
- // Calling reflect.Value.MapRange no longer allocates.
- // See https://go.dev/cl/400675.
- iter := getMapIter(va.Value)
- defer putMapIter(iter)
- for iter.Next() {
- k.SetIterKey(iter)
- if err := marshalKey(mko, enc, k); err != nil {
- // TODO: If err is errMissingName, then wrap it as a
- // SemanticError since this key type cannot be serialized
- // as a JSON string.
- return err
+ switch {
+ case !mo.Deterministic || n <= 1:
+ for iter := va.Value.MapRange(); iter.Next(); {
+ k.SetIterKey(iter)
+ if err := marshalKey(mko, enc, k); err != nil {
+ // TODO: If err is errMissingName, then wrap it as a
+ // SemanticError since this key type cannot be serialized
+ // as a JSON string.
+ return err
+ }
+ v.SetIterValue(iter)
+ if err := marshalVal(mo, enc, v); err != nil {
+ return err
+ }
}
- v.SetIterValue(iter)
- if err := marshalVal(mo, enc, v); err != nil {
- return err
+ case !nonDefaultKey && t.Key().Kind() == reflect.String:
+ names := getStrings(n)
+ for i, iter := 0, va.Value.MapRange(); i < n && iter.Next(); i++ {
+ k.SetIterKey(iter)
+ (*names)[i] = k.String()
+ }
+ names.Sort()
+ for _, name := range *names {
+ if err := enc.WriteToken(String(name)); err != nil {
+ return err
+ }
+ // TODO(https://go.dev/issue/57061): Use v.SetMapIndexOf.
+ k.SetString(name)
+ v.Set(va.MapIndex(k.Value))
+ if err := marshalVal(mo, enc, v); err != nil {
+ return err
+ }
+ }
+ putStrings(names)
+ default:
+ type member struct {
+ name string // unquoted name
+ key addressableValue
+ }
+ members := make([]member, n)
+ keys := reflect.MakeSlice(reflect.SliceOf(t.Key()), n, n)
+ for i, iter := 0, va.Value.MapRange(); i < n && iter.Next(); i++ {
+ // Marshal the member name.
+ k := addressableValue{keys.Index(i)} // indexed slice element is always addressable
+ k.SetIterKey(iter)
+ if err := marshalKey(mko, enc, k); err != nil {
+ // TODO: If err is errMissingName, then wrap it as a
+ // SemanticError since this key type cannot be serialized
+ // as a JSON string.
+ return err
+ }
+ name := enc.unwriteOnlyObjectMemberName()
+ members[i] = member{name, k}
+ }
+ // TODO: If AllowDuplicateNames is enabled, then sort according
+ // to reflect.Value as well if the names are equal.
+ // See internal/fmtsort.
+ // TODO(https://go.dev/issue/47619): Use slices.SortFunc instead.
+ sort.Slice(members, func(i, j int) bool {
+ return lessUTF16(members[i].name, members[j].name)
+ })
+ for _, member := range members {
+ if err := enc.WriteToken(String(member.name)); err != nil {
+ return err
+ }
+ // TODO(https://go.dev/issue/57061): Use v.SetMapIndexOf.
+ v.Set(va.MapIndex(member.key.Value))
+ if err := marshalVal(mo, enc, v); err != nil {
+ return err
+ }
}
}
}
@@ -856,7 +895,7 @@ func makeStructArshaler(t reflect.Type) *arshaler {
// 2. The object namespace is guaranteed to be disabled.
// 3. The object name is guaranteed to be valid and pre-escaped.
// 4. There is no need to flush the buffer (for unwrite purposes).
- // 5. There is no possibility of an error occuring.
+ // 5. There is no possibility of an error occurring.
if optimizeCommon {
// Append any delimiters or optional whitespace.
if enc.tokens.last.length() > 0 {
@@ -996,7 +1035,7 @@ func makeStructArshaler(t reflect.Type) *arshaler {
if fields.inlinedFallback == nil {
// Skip unknown value since we have no place to store it.
- if err := dec.skipValue(); err != nil {
+ if err := dec.SkipValue(); err != nil {
return err
}
} else {
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_inlined.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_inlined.go
index 7476eda30..258a98247 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_inlined.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_inlined.go
@@ -5,6 +5,7 @@
package json
import (
+ "bytes"
"errors"
"reflect"
)
@@ -89,35 +90,61 @@ func marshalInlinedFallbackAll(mo MarshalOptions, enc *Encoder, va addressableVa
}
return nil
} else {
- if v.Len() == 0 {
+ m := v // must be a map[string]V
+ n := m.Len()
+ if n == 0 {
return nil
}
- m := v
+ mk := newAddressableValue(stringType)
mv := newAddressableValue(m.Type().Elem())
- for iter := m.MapRange(); iter.Next(); {
- b, err := appendString(enc.UnusedBuffer(), iter.Key().String(), !enc.options.AllowInvalidUTF8, nil)
+ marshalKey := func(mk addressableValue) error {
+ b, err := appendString(enc.UnusedBuffer(), mk.String(), !enc.options.AllowInvalidUTF8, nil)
if err != nil {
return err
}
if insertUnquotedName != nil {
- isVerbatim := consumeSimpleString(b) == len(b)
+ isVerbatim := bytes.IndexByte(b, '\\') < 0
name := unescapeStringMayCopy(b, isVerbatim)
if !insertUnquotedName(name) {
return &SyntacticError{str: "duplicate name " + string(b) + " in object"}
}
}
- if err := enc.WriteValue(b); err != nil {
- return err
+ return enc.WriteValue(b)
+ }
+ marshalVal := f.fncs.marshal
+ if mo.Marshalers != nil {
+ marshalVal, _ = mo.Marshalers.lookup(marshalVal, mv.Type())
+ }
+ if !mo.Deterministic || n <= 1 {
+ for iter := m.MapRange(); iter.Next(); {
+ mk.SetIterKey(iter)
+ if err := marshalKey(mk); err != nil {
+ return err
+ }
+ mv.Set(iter.Value())
+ if err := marshalVal(mo, enc, mv); err != nil {
+ return err
+ }
}
-
- mv.Set(iter.Value())
- marshal := f.fncs.marshal
- if mo.Marshalers != nil {
- marshal, _ = mo.Marshalers.lookup(marshal, mv.Type())
+ } else {
+ names := getStrings(n)
+ for i, iter := 0, m.Value.MapRange(); i < n && iter.Next(); i++ {
+ mk.SetIterKey(iter)
+ (*names)[i] = mk.String()
}
- if err := marshal(mo, enc, mv); err != nil {
- return err
+ names.Sort()
+ for _, name := range *names {
+ mk.SetString(name)
+ if err := marshalKey(mk); err != nil {
+ return err
+ }
+ // TODO(https://go.dev/issue/57061): Use mv.SetMapIndexOf.
+ mv.Set(m.MapIndex(mk.Value))
+ if err := marshalVal(mo, enc, mv); err != nil {
+ return err
+ }
}
+ putStrings(names)
}
return nil
}
@@ -162,7 +189,7 @@ func unmarshalInlinedFallbackNext(uo UnmarshalOptions, dec *Decoder, va addressa
} else {
name := string(unquotedName) // TODO: Intern this?
- m := v
+ m := v // must be a map[string]V
if m.IsNil() {
m.Set(reflect.MakeMap(m.Type()))
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_methods.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_methods.go
index ef4e1f5e3..20899c868 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_methods.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_methods.go
@@ -21,8 +21,8 @@ var (
)
// MarshalerV1 is implemented by types that can marshal themselves.
-// It is recommended that types implement MarshalerV2 unless
-// the implementation is trying to avoid a hard dependency on this package.
+// It is recommended that types implement MarshalerV2 unless the implementation
+// is trying to avoid a hard dependency on the "jsontext" package.
//
// It is recommended that implementations return a buffer that is safe
// for the caller to retain and potentially mutate.
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_time.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_time.go
index 22e802221..fc8d5b007 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_time.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_time.go
@@ -5,6 +5,7 @@
package json
import (
+ "errors"
"fmt"
"reflect"
"strings"
@@ -85,25 +86,39 @@ func makeTimeArshaler(fncs *arshaler, t reflect.Type) *arshaler {
fncs.nonDefault = true
fncs.marshal = func(mo MarshalOptions, enc *Encoder, va addressableValue) error {
format := time.RFC3339Nano
+ isRFC3339 := true
if mo.format != "" && mo.formatDepth == enc.tokens.depth() {
var err error
- format, err = checkTimeFormat(mo.format)
+ format, isRFC3339, err = checkTimeFormat(mo.format)
if err != nil {
return &SemanticError{action: "marshal", GoType: t, Err: err}
}
}
tt := va.Interface().(time.Time)
- if y := tt.Year(); y < 0 || y >= 10000 {
- // RFC 3339 is clear that years are 4 digits exactly.
- // See https://go.dev/issue/4556#c15 for more discussion.
- err := fmt.Errorf("year %d outside of range [0,9999]", y)
- return &SemanticError{action: "marshal", GoType: t, Err: err}
- }
b := enc.UnusedBuffer()
b = append(b, '"')
b = tt.AppendFormat(b, format)
b = append(b, '"')
+ if isRFC3339 {
+ // Not all Go timestamps can be represented as valid RFC 3339.
+ // Explicitly check for these edge cases.
+ // See https://go.dev/issue/4556 and https://go.dev/issue/54580.
+ var err error
+ switch b := b[len(`"`) : len(b)-len(`"`)]; {
+ case b[len("9999")] != '-': // year must be exactly 4 digits wide
+ err = errors.New("year outside of range [0,9999]")
+ case b[len(b)-1] != 'Z':
+ c := b[len(b)-len("Z07:00")]
+ if ('0' <= c && c <= '9') || parseDec2(b[len(b)-len("07:00"):]) >= 24 {
+ err = errors.New("timezone hour outside of range [0,23]")
+ }
+ }
+ if err != nil {
+ return &SemanticError{action: "marshal", GoType: t, Err: err}
+ }
+ return enc.WriteValue(b) // RFC 3339 never needs JSON escaping
+ }
// The format may contain special characters that need escaping.
// Verify that the result is a valid JSON string (common case),
// otherwise escape the string correctly (slower case).
@@ -113,10 +128,11 @@ func makeTimeArshaler(fncs *arshaler, t reflect.Type) *arshaler {
return enc.WriteValue(b)
}
fncs.unmarshal = func(uo UnmarshalOptions, dec *Decoder, va addressableValue) error {
- format := time.RFC3339Nano
+ format := time.RFC3339
+ isRFC3339 := true
if uo.format != "" && uo.formatDepth == dec.tokens.depth() {
var err error
- format, err = checkTimeFormat(uo.format)
+ format, isRFC3339, err = checkTimeFormat(uo.format)
if err != nil {
return &SemanticError{action: "unmarshal", GoType: t, Err: err}
}
@@ -136,6 +152,29 @@ func makeTimeArshaler(fncs *arshaler, t reflect.Type) *arshaler {
case '"':
val = unescapeStringMayCopy(val, flags.isVerbatim())
tt2, err := time.Parse(format, string(val))
+ if isRFC3339 && err == nil {
+ // TODO(https://go.dev/issue/54580): RFC 3339 specifies
+ // the exact grammar of a valid timestamp. However,
+ // the parsing functionality in "time" is too loose and
+ // incorrectly accepts invalid timestamps as valid.
+ // Remove these manual checks when "time" checks it for us.
+ newParseError := func(layout, value, layoutElem, valueElem, message string) error {
+ return &time.ParseError{Layout: layout, Value: value, LayoutElem: layoutElem, ValueElem: valueElem, Message: message}
+ }
+ switch {
+ case val[len("2006-01-02T")+1] == ':': // hour must be two digits
+ err = newParseError(format, string(val), "15", string(val[len("2006-01-02T"):][:1]), "")
+ case val[len("2006-01-02T15:04:05")] == ',': // sub-second separator must be a period
+ err = newParseError(format, string(val), ".", ",", "")
+ case val[len(val)-1] != 'Z':
+ switch {
+ case parseDec2(val[len(val)-len("07:00"):]) >= 24: // timezone hour must be in range
+ err = newParseError(format, string(val), "Z07:00", string(val[len(val)-len("Z07:00"):]), ": timezone hour out of range")
+ case parseDec2(val[len(val)-len("00"):]) >= 60: // timezone minute must be in range
+ err = newParseError(format, string(val), "Z07:00", string(val[len(val)-len("Z07:00"):]), ": timezone minute out of range")
+ }
+ }
+ }
if err != nil {
return &SemanticError{action: "unmarshal", JSONKind: k, GoType: t, Err: err}
}
@@ -149,48 +188,54 @@ func makeTimeArshaler(fncs *arshaler, t reflect.Type) *arshaler {
return fncs
}
-func checkTimeFormat(format string) (string, error) {
+func checkTimeFormat(format string) (string, bool, error) {
// We assume that an exported constant in the time package will
// always start with an uppercase ASCII letter.
if len(format) > 0 && 'A' <= format[0] && format[0] <= 'Z' {
switch format {
case "ANSIC":
- return time.ANSIC, nil
+ return time.ANSIC, false, nil
case "UnixDate":
- return time.UnixDate, nil
+ return time.UnixDate, false, nil
case "RubyDate":
- return time.RubyDate, nil
+ return time.RubyDate, false, nil
case "RFC822":
- return time.RFC822, nil
+ return time.RFC822, false, nil
case "RFC822Z":
- return time.RFC822Z, nil
+ return time.RFC822Z, false, nil
case "RFC850":
- return time.RFC850, nil
+ return time.RFC850, false, nil
case "RFC1123":
- return time.RFC1123, nil
+ return time.RFC1123, false, nil
case "RFC1123Z":
- return time.RFC1123Z, nil
+ return time.RFC1123Z, false, nil
case "RFC3339":
- return time.RFC3339, nil
+ return time.RFC3339, true, nil
case "RFC3339Nano":
- return time.RFC3339Nano, nil
+ return time.RFC3339Nano, true, nil
case "Kitchen":
- return time.Kitchen, nil
+ return time.Kitchen, false, nil
case "Stamp":
- return time.Stamp, nil
+ return time.Stamp, false, nil
case "StampMilli":
- return time.StampMilli, nil
+ return time.StampMilli, false, nil
case "StampMicro":
- return time.StampMicro, nil
+ return time.StampMicro, false, nil
case "StampNano":
- return time.StampNano, nil
+ return time.StampNano, false, nil
default:
// Reject any format that is an exported Go identifier in case
// new format constants are added to the time package.
if strings.TrimFunc(format, isLetterOrDigit) == "" {
- return "", fmt.Errorf("undefined format layout: %v", format)
+ return "", false, fmt.Errorf("undefined format layout: %v", format)
}
}
}
- return format, nil
+ return format, false, nil
+}
+
+// parseDec2 parses b as an unsigned, base-10, 2-digit number.
+// It panics if len(b) < 2. The result is undefined if digits are not base-10.
+func parseDec2(b []byte) byte {
+ return 10*(b[0]-'0') + (b[1] - '0')
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/decode.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/decode.go
index 998ad68fc..0d68b3233 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/decode.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/decode.go
@@ -347,9 +347,9 @@ func (d *Decoder) PeekKind() Kind {
return next
}
-// skipValue is semantically equivalent to calling ReadValue and discarding
+// SkipValue is semantically equivalent to calling ReadValue and discarding
// the result except that memory is not wasted trying to hold the entire result.
-func (d *Decoder) skipValue() error {
+func (d *Decoder) SkipValue() error {
switch d.PeekKind() {
case '{', '[':
// For JSON objects and arrays, keep skipping all tokens
@@ -374,7 +374,7 @@ func (d *Decoder) skipValue() error {
}
// ReadToken reads the next Token, advancing the read offset.
-// The returned token is only valid until the next Peek or Read call.
+// The returned token is only valid until the next Peek, Read, or Skip call.
// It returns io.EOF if there are no more tokens.
func (d *Decoder) ReadToken() (Token, error) {
// Determine the next kind.
@@ -585,7 +585,7 @@ func (f valueFlags) isCanonical() bool { return f&stringNonCanonical == 0 }
// ReadValue returns the next raw JSON value, advancing the read offset.
// The value is stripped of any leading or trailing whitespace.
-// The returned value is only valid until the next Peek or Read call and
+// The returned value is only valid until the next Peek, Read, or Skip call and
// may not be mutated while the Decoder remains in use.
// If the decoder is currently at the end token for an object or array,
// then it reports a SyntacticError and the internal state remains unchanged.
@@ -1013,7 +1013,7 @@ func (d *Decoder) InputOffset() int64 {
// UnreadBuffer returns the data remaining in the unread buffer,
// which may contain zero or more bytes.
// The returned buffer must not be mutated while Decoder continues to be used.
-// The buffer contents are valid until the next Peek or Read call.
+// The buffer contents are valid until the next Peek, Read, or Skip call.
func (d *Decoder) UnreadBuffer() []byte {
return d.unreadBuffer()
}
@@ -1213,7 +1213,7 @@ func consumeStringResumable(flags *valueFlags, b []byte, resumeOffset int, valid
return n, &SyntacticError{str: "invalid escape sequence " + strconv.Quote(string(b[n:n+6])) + " within string"}
}
// Only certain control characters can use the \uFFFF notation
- // for canonical formating (per RFC 8785, section 3.2.2.2.).
+ // for canonical formatting (per RFC 8785, section 3.2.2.2.).
switch v1 {
// \uFFFF notation not permitted for these characters.
case '\b', '\f', '\n', '\r', '\t':
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/doc.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/doc.go
index ba4af4b7b..e4eefa3de 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/doc.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/doc.go
@@ -8,8 +8,7 @@
// primitive data types such as booleans, strings, and numbers,
// in addition to structured data types such as objects and arrays.
//
-//
-// Terminology
+// # Terminology
//
// This package uses the terms "encode" and "decode" for syntactic functionality
// that is concerned with processing JSON based on its grammar, and
@@ -32,8 +31,7 @@
//
// See RFC 8259 for more information.
//
-//
-// Specifications
+// # Specifications
//
// Relevant specifications include RFC 4627, RFC 7159, RFC 7493, RFC 8259,
// and RFC 8785. Each RFC is generally a stricter subset of another RFC.
@@ -60,8 +58,7 @@
// In particular, it makes specific choices about behavior that RFC 8259
// leaves as undefined in order to ensure greater interoperability.
//
-//
-// JSON Representation of Go structs
+// # JSON Representation of Go structs
//
// A Go struct is naturally represented as a JSON object,
// where each Go struct field corresponds with a JSON object member.
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/encode.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/encode.go
index 5f98a8409..5b81ca15a 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/encode.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/encode.go
@@ -347,6 +347,30 @@ func (e *Encoder) unwriteEmptyObjectMember(prevName *string) bool {
return true
}
+// unwriteOnlyObjectMemberName unwrites the only object member name
+// and returns the unquoted name.
+func (e *Encoder) unwriteOnlyObjectMemberName() string {
+ if last := e.tokens.last; !last.isObject() || last.length() != 1 {
+ panic("BUG: must be called on an object after writing first name")
+ }
+
+ // Unwrite the name and whitespace.
+ b := trimSuffixString(e.buf)
+ isVerbatim := bytes.IndexByte(e.buf[len(b):], '\\') < 0
+ name := string(unescapeStringMayCopy(e.buf[len(b):], isVerbatim))
+ e.buf = trimSuffixWhitespace(b)
+
+ // Undo state changes.
+ e.tokens.last.decrement()
+ if !e.options.AllowDuplicateNames {
+ if e.tokens.last.isActiveNamespace() {
+ e.namespaces.last().removeLast()
+ }
+ e.names.clearLast()
+ }
+ return name
+}
+
func trimSuffixWhitespace(b []byte) []byte {
// NOTE: The arguments and logic are kept simple to keep this inlineable.
n := len(b) - 1
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/pools.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/pools.go
index f72282211..60e93270f 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/pools.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/pools.go
@@ -8,6 +8,7 @@ import (
"bytes"
"io"
"math/bits"
+ "sort"
"sync"
)
@@ -148,3 +149,34 @@ func putStreamingDecoder(d *Decoder) {
streamingDecoderPool.Put(d)
}
}
+
+var stringsPools = &sync.Pool{New: func() any { return new(stringSlice) }}
+
+type stringSlice []string
+
+// getStrings returns a non-nil pointer to a slice with length n.
+func getStrings(n int) *stringSlice {
+ s := stringsPools.Get().(*stringSlice)
+ if cap(*s) < n {
+ *s = make([]string, n)
+ }
+ *s = (*s)[:n]
+ return s
+}
+
+func putStrings(s *stringSlice) {
+ if cap(*s) > 1<<10 {
+ *s = nil // avoid pinning arbitrarily large amounts of memory
+ }
+ stringsPools.Put(s)
+}
+
+// Sort sorts the string slice according to RFC 8785, section 3.2.3.
+func (ss *stringSlice) Sort() {
+ // TODO(https://go.dev/issue/47619): Use slices.SortFunc instead.
+ sort.Sort(ss)
+}
+
+func (ss *stringSlice) Len() int { return len(*ss) }
+func (ss *stringSlice) Less(i, j int) bool { return lessUTF16((*ss)[i], (*ss)[j]) }
+func (ss *stringSlice) Swap(i, j int) { (*ss)[i], (*ss)[j] = (*ss)[j], (*ss)[i] }
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/state.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/state.go
index d9c33f2b4..ee14c753f 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/state.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/state.go
@@ -721,7 +721,7 @@ func (s *uintSet) has(i uint) bool {
return s.lo.has(i)
} else {
i -= 64
- iHi, iLo := int(i/64), uint(i%64)
+ iHi, iLo := int(i/64), i%64
return iHi < len(s.hi) && s.hi[iHi].has(iLo)
}
}
@@ -735,7 +735,7 @@ func (s *uintSet) insert(i uint) bool {
return !has
} else {
i -= 64
- iHi, iLo := int(i/64), uint(i%64)
+ iHi, iLo := int(i/64), i%64
if iHi >= len(s.hi) {
s.hi = append(s.hi, make([]uintSet64, iHi+1-len(s.hi))...)
s.hi = s.hi[:cap(s.hi)]
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/token.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/token.go
index 08509c296..9acba7dad 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/token.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/token.go
@@ -112,7 +112,7 @@ func Bool(b bool) Token {
return False
}
-// String construct a Token representing a JSON string.
+// String constructs a Token representing a JSON string.
// The provided string should contain valid UTF-8, otherwise invalid characters
// may be mangled as the Unicode replacement character.
func String(s string) Token {
@@ -225,7 +225,7 @@ func (t Token) appendString(dst []byte, validateUTF8, preserveRaw bool, escapeRu
}
// String returns the unescaped string value for a JSON string.
-// For other JSON kinds, this returns the raw JSON represention.
+// For other JSON kinds, this returns the raw JSON representation.
func (t Token) String() string {
// This is inlinable to take advantage of "function outlining".
// This avoids an allocation for the string(b) conversion
@@ -373,10 +373,10 @@ func (t Token) Int() int64 {
case 'i':
return int64(t.num)
case 'u':
- if uint64(t.num) > maxInt64 {
+ if t.num > maxInt64 {
return maxInt64
}
- return int64(uint64(t.num))
+ return int64(t.num)
}
}
@@ -425,7 +425,7 @@ func (t Token) Uint() uint64 {
// Handle exact integer value.
switch t.str[0] {
case 'u':
- return uint64(t.num)
+ return t.num
case 'i':
if int64(t.num) < minUint64 {
return minUint64
diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/value.go b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/value.go
index fe88e4fb5..e0bd1b31d 100644
--- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/value.go
+++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/value.go
@@ -263,7 +263,7 @@ func reorderObjects(d *Decoder, scratch *[]byte) {
afterValue := d.InputOffset()
if isSorted && len(*members) > 0 {
- isSorted = lessUTF16(prevName, name)
+ isSorted = lessUTF16(prevName, []byte(name))
}
*members = append(*members, memberName{name, beforeName, afterValue})
prevName = name
@@ -317,7 +317,7 @@ func reorderObjects(d *Decoder, scratch *[]byte) {
// to the UTF-16 codepoints of the UTF-8 encoded input strings.
// This implements the ordering specified in RFC 8785, section 3.2.3.
// The inputs must be valid UTF-8, otherwise this may panic.
-func lessUTF16(x, y []byte) bool {
+func lessUTF16[Bytes []byte | string](x, y Bytes) bool {
// NOTE: This is an optimized, allocation-free implementation
// of lessUTF16Simple in fuzz_test.go. FuzzLessUTF16 verifies that the
// two implementations agree on the result of comparing any two strings.
@@ -326,8 +326,13 @@ func lessUTF16(x, y []byte) bool {
return ('\u0000' <= r && r <= '\uD7FF') || ('\uE000' <= r && r <= '\uFFFF')
}
+ var invalidUTF8 bool
+ x0, y0 := x, y
for {
if len(x) == 0 || len(y) == 0 {
+ if len(x) == len(y) && invalidUTF8 {
+ return string(x0) < string(y0)
+ }
return len(x) < len(y)
}
@@ -341,35 +346,36 @@ func lessUTF16(x, y []byte) bool {
}
// Decode next pair of runes as UTF-8.
- rx, nx := utf8.DecodeRune(x)
- ry, ny := utf8.DecodeRune(y)
- switch {
-
- // Both runes encode as either a single or surrogate pair
- // of UTF-16 codepoints.
- case isUTF16Self(rx) == isUTF16Self(ry):
- if rx != ry {
- return rx < ry
- }
+ // TODO(https://go.dev/issue/56948): Use a generic implementation
+ // of utf8.DecodeRune, or rely on a compiler optimization to statically
+ // hide the cost of a type switch (https://go.dev/issue/57072).
+ var rx, ry rune
+ var nx, ny int
+ switch any(x).(type) {
+ case string:
+ rx, nx = utf8.DecodeRuneInString(string(x))
+ ry, ny = utf8.DecodeRuneInString(string(y))
+ case []byte:
+ rx, nx = utf8.DecodeRune([]byte(x))
+ ry, ny = utf8.DecodeRune([]byte(y))
+ }
+ selfx := isUTF16Self(rx)
+ selfy := isUTF16Self(ry)
+ switch {
// The x rune is a single UTF-16 codepoint, while
// the y rune is a surrogate pair of UTF-16 codepoints.
- case isUTF16Self(rx):
- ry, _ := utf16.EncodeRune(ry)
- if rx != ry {
- return rx < ry
- }
- panic("BUG: invalid UTF-8") // implies rx is an unpaired surrogate half
-
+ case selfx && !selfy:
+ ry, _ = utf16.EncodeRune(ry)
// The y rune is a single UTF-16 codepoint, while
// the x rune is a surrogate pair of UTF-16 codepoints.
- case isUTF16Self(ry):
- rx, _ := utf16.EncodeRune(rx)
- if rx != ry {
- return rx < ry
- }
- panic("BUG: invalid UTF-8") // implies ry is an unpaired surrogate half
+ case selfy && !selfx:
+ rx, _ = utf16.EncodeRune(rx)
+ }
+ if rx != ry {
+ return rx < ry
}
+ invalidUTF8 = invalidUTF8 || (rx == utf8.RuneError && nx == 1) || (ry == utf8.RuneError && ny == 1)
x, y = x[nx:], y[ny:]
}
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/openapiconv/convert.go b/vendor/k8s.io/kube-openapi/pkg/openapiconv/convert.go
deleted file mode 100644
index e993fe23d..000000000
--- a/vendor/k8s.io/kube-openapi/pkg/openapiconv/convert.go
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
-Copyright 2022 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package openapiconv
-
-import (
- "strings"
-
- klog "k8s.io/klog/v2"
- builderutil "k8s.io/kube-openapi/pkg/builder3/util"
- "k8s.io/kube-openapi/pkg/spec3"
- "k8s.io/kube-openapi/pkg/validation/spec"
-)
-
-var OpenAPIV2DefPrefix = "#/definitions/"
-var OpenAPIV3DefPrefix = "#/components/schemas/"
-
-// ConvertV2ToV3 converts an OpenAPI V2 object into V3.
-// Certain references may be shared between the V2 and V3 objects in the conversion.
-func ConvertV2ToV3(v2Spec *spec.Swagger) *spec3.OpenAPI {
- v3Spec := &spec3.OpenAPI{
- Version: "3.0.0",
- Info: v2Spec.Info,
- ExternalDocs: ConvertExternalDocumentation(v2Spec.ExternalDocs),
- Paths: ConvertPaths(v2Spec.Paths),
- Components: ConvertComponents(v2Spec.SecurityDefinitions, v2Spec.Definitions, v2Spec.Responses, v2Spec.Produces),
- }
-
- return v3Spec
-}
-
-func ConvertExternalDocumentation(v2ED *spec.ExternalDocumentation) *spec3.ExternalDocumentation {
- if v2ED == nil {
- return nil
- }
- return &spec3.ExternalDocumentation{
- ExternalDocumentationProps: spec3.ExternalDocumentationProps{
- Description: v2ED.Description,
- URL: v2ED.URL,
- },
- }
-}
-
-func ConvertComponents(v2SecurityDefinitions spec.SecurityDefinitions, v2Definitions spec.Definitions, v2Responses map[string]spec.Response, produces []string) *spec3.Components {
- components := &spec3.Components{}
-
- if v2Definitions != nil {
- components.Schemas = make(map[string]*spec.Schema)
- }
- for s, schema := range v2Definitions {
- components.Schemas[s] = ConvertSchema(&schema)
- }
- if v2SecurityDefinitions != nil {
- components.SecuritySchemes = make(spec3.SecuritySchemes)
- }
- for s, securityScheme := range v2SecurityDefinitions {
- components.SecuritySchemes[s] = ConvertSecurityScheme(securityScheme)
- }
- if v2Responses != nil {
- components.Responses = make(map[string]*spec3.Response)
- }
- for r, response := range v2Responses {
- components.Responses[r] = ConvertResponse(&response, produces)
- }
-
- return components
-}
-
-func ConvertSchema(v2Schema *spec.Schema) *spec.Schema {
- if v2Schema == nil {
- return nil
- }
- v3Schema := spec.Schema{
- VendorExtensible: v2Schema.VendorExtensible,
- SchemaProps: v2Schema.SchemaProps,
- SwaggerSchemaProps: v2Schema.SwaggerSchemaProps,
- ExtraProps: v2Schema.ExtraProps,
- }
-
- if refString := v2Schema.Ref.String(); refString != "" {
- if idx := strings.Index(refString, OpenAPIV2DefPrefix); idx != -1 {
- v3Schema.Ref = spec.MustCreateRef(OpenAPIV3DefPrefix + refString[idx+len(OpenAPIV2DefPrefix):])
- } else {
- klog.Errorf("Error: Swagger V2 Ref %s does not contain #/definitions\n", refString)
- }
- }
-
- if v2Schema.Properties != nil {
- v3Schema.Properties = make(map[string]spec.Schema)
- for key, property := range v2Schema.Properties {
- v3Schema.Properties[key] = *ConvertSchema(&property)
- }
- }
- if v2Schema.Items != nil {
- v3Schema.Items = &spec.SchemaOrArray{
- Schema: ConvertSchema(v2Schema.Items.Schema),
- Schemas: ConvertSchemaList(v2Schema.Items.Schemas),
- }
- }
-
- if v2Schema.AdditionalProperties != nil {
- v3Schema.AdditionalProperties = &spec.SchemaOrBool{
- Schema: ConvertSchema(v2Schema.AdditionalProperties.Schema),
- Allows: v2Schema.AdditionalProperties.Allows,
- }
- }
- if v2Schema.AdditionalItems != nil {
- v3Schema.AdditionalItems = &spec.SchemaOrBool{
- Schema: ConvertSchema(v2Schema.AdditionalItems.Schema),
- Allows: v2Schema.AdditionalItems.Allows,
- }
- }
-
- return builderutil.WrapRefs(&v3Schema)
-}
-
-func ConvertSchemaList(v2SchemaList []spec.Schema) []spec.Schema {
- if v2SchemaList == nil {
- return nil
- }
- v3SchemaList := []spec.Schema{}
- for _, s := range v2SchemaList {
- v3SchemaList = append(v3SchemaList, *ConvertSchema(&s))
- }
- return v3SchemaList
-}
-
-func ConvertSecurityScheme(v2securityScheme *spec.SecurityScheme) *spec3.SecurityScheme {
- if v2securityScheme == nil {
- return nil
- }
- securityScheme := &spec3.SecurityScheme{
- VendorExtensible: v2securityScheme.VendorExtensible,
- SecuritySchemeProps: spec3.SecuritySchemeProps{
- Description: v2securityScheme.Description,
- Type: v2securityScheme.Type,
- Name: v2securityScheme.Name,
- In: v2securityScheme.In,
- },
- }
-
- if v2securityScheme.Flow != "" {
- securityScheme.Flows = make(map[string]*spec3.OAuthFlow)
- securityScheme.Flows[v2securityScheme.Flow] = &spec3.OAuthFlow{
- OAuthFlowProps: spec3.OAuthFlowProps{
- AuthorizationUrl: v2securityScheme.AuthorizationURL,
- TokenUrl: v2securityScheme.TokenURL,
- Scopes: v2securityScheme.Scopes,
- },
- }
- }
- return securityScheme
-}
-
-func ConvertPaths(v2Paths *spec.Paths) *spec3.Paths {
- if v2Paths == nil {
- return nil
- }
- paths := &spec3.Paths{
- VendorExtensible: v2Paths.VendorExtensible,
- }
-
- if v2Paths.Paths != nil {
- paths.Paths = make(map[string]*spec3.Path)
- }
- for k, v := range v2Paths.Paths {
- paths.Paths[k] = ConvertPathItem(v)
- }
- return paths
-}
-
-func ConvertPathItem(v2pathItem spec.PathItem) *spec3.Path {
- path := &spec3.Path{
- Refable: v2pathItem.Refable,
- PathProps: spec3.PathProps{
- Get: ConvertOperation(v2pathItem.Get),
- Put: ConvertOperation(v2pathItem.Put),
- Post: ConvertOperation(v2pathItem.Post),
- Delete: ConvertOperation(v2pathItem.Delete),
- Options: ConvertOperation(v2pathItem.Options),
- Head: ConvertOperation(v2pathItem.Head),
- Patch: ConvertOperation(v2pathItem.Patch),
- },
- VendorExtensible: v2pathItem.VendorExtensible,
- }
- for _, param := range v2pathItem.Parameters {
- path.Parameters = append(path.Parameters, ConvertParameter(param))
- }
- return path
-}
-
-func ConvertOperation(v2Operation *spec.Operation) *spec3.Operation {
- if v2Operation == nil {
- return nil
- }
- operation := &spec3.Operation{
- VendorExtensible: v2Operation.VendorExtensible,
- OperationProps: spec3.OperationProps{
- Description: v2Operation.Description,
- ExternalDocs: ConvertExternalDocumentation(v2Operation.OperationProps.ExternalDocs),
- Tags: v2Operation.Tags,
- Summary: v2Operation.Summary,
- Deprecated: v2Operation.Deprecated,
- OperationId: v2Operation.ID,
- },
- }
-
- for _, param := range v2Operation.Parameters {
- if param.ParamProps.Name == "body" && param.ParamProps.Schema != nil {
- operation.OperationProps.RequestBody = &spec3.RequestBody{
- RequestBodyProps: spec3.RequestBodyProps{},
- }
- if v2Operation.Consumes != nil {
- operation.RequestBody.Content = make(map[string]*spec3.MediaType)
- }
- for _, consumer := range v2Operation.Consumes {
- operation.RequestBody.Content[consumer] = &spec3.MediaType{
- MediaTypeProps: spec3.MediaTypeProps{
- Schema: ConvertSchema(param.ParamProps.Schema),
- },
- }
- }
- } else {
- operation.Parameters = append(operation.Parameters, ConvertParameter(param))
- }
- }
-
- operation.Responses = &spec3.Responses{ResponsesProps: spec3.ResponsesProps{
- Default: ConvertResponse(v2Operation.Responses.Default, v2Operation.Produces),
- },
- VendorExtensible: v2Operation.Responses.VendorExtensible,
- }
-
- if v2Operation.Responses.StatusCodeResponses != nil {
- operation.Responses.StatusCodeResponses = make(map[int]*spec3.Response)
- }
- for k, v := range v2Operation.Responses.StatusCodeResponses {
- operation.Responses.StatusCodeResponses[k] = ConvertResponse(&v, v2Operation.Produces)
- }
- return operation
-}
-
-func ConvertResponse(v2Response *spec.Response, produces []string) *spec3.Response {
- if v2Response == nil {
- return nil
- }
- response := &spec3.Response{
- Refable: ConvertRefableResponse(v2Response.Refable),
- VendorExtensible: v2Response.VendorExtensible,
- ResponseProps: spec3.ResponseProps{
- Description: v2Response.Description,
- },
- }
-
- if v2Response.Schema != nil {
- if produces != nil {
- response.Content = make(map[string]*spec3.MediaType)
- }
- for _, producer := range produces {
- response.ResponseProps.Content[producer] = &spec3.MediaType{
- MediaTypeProps: spec3.MediaTypeProps{
- Schema: ConvertSchema(v2Response.Schema),
- },
- }
- }
- }
- return response
-}
-
-func ConvertParameter(v2Param spec.Parameter) *spec3.Parameter {
- param := &spec3.Parameter{
- Refable: ConvertRefableParameter(v2Param.Refable),
- VendorExtensible: v2Param.VendorExtensible,
- ParameterProps: spec3.ParameterProps{
- Name: v2Param.Name,
- Description: v2Param.Description,
- In: v2Param.In,
- Required: v2Param.Required,
- Schema: ConvertSchema(v2Param.Schema),
- AllowEmptyValue: v2Param.AllowEmptyValue,
- },
- }
- // Convert SimpleSchema into Schema
- if param.Schema == nil {
- param.Schema = &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Type: []string{v2Param.Type},
- Format: v2Param.Format,
- UniqueItems: v2Param.UniqueItems,
- },
- }
- }
-
- return param
-}
-
-func ConvertRefableParameter(refable spec.Refable) spec.Refable {
- if refable.Ref.String() != "" {
- return spec.Refable{Ref: spec.MustCreateRef(strings.Replace(refable.Ref.String(), "#/parameters/", "#/components/parameters/", 1))}
- }
- return refable
-}
-
-func ConvertRefableResponse(refable spec.Refable) spec.Refable {
- if refable.Ref.String() != "" {
- return spec.Refable{Ref: spec.MustCreateRef(strings.Replace(refable.Ref.String(), "#/responses/", "#/components/responses/", 1))}
- }
- return refable
-}
diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/openapi.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/openapi.go
new file mode 100644
index 000000000..61141a500
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/schemaconv/openapi.go
@@ -0,0 +1,260 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package schemaconv
+
+import (
+ "errors"
+ "path"
+ "strings"
+
+ "k8s.io/kube-openapi/pkg/validation/spec"
+ "sigs.k8s.io/structured-merge-diff/v4/schema"
+)
+
+// ToSchemaFromOpenAPI converts a directory of OpenAPI schemas to an smd Schema.
+// - models: a map from definition name to OpenAPI V3 structural schema for each definition.
+// Key in map is used to resolve references in the schema.
+// - preserveUnknownFields: flag indicating whether unknown fields in all schemas should be preserved.
+// - returns: nil and an error if there is a parse error, or if schema does not satisfy a
+// required structural schema invariant for conversion. If no error, returns
+// a new smd schema.
+//
+// Schema should be validated as structural before using with this function, or
+// there may be information lost.
+func ToSchemaFromOpenAPI(models map[string]*spec.Schema, preserveUnknownFields bool) (*schema.Schema, error) {
+ c := convert{
+ preserveUnknownFields: preserveUnknownFields,
+ output: &schema.Schema{},
+ }
+
+ for name, spec := range models {
+ // Skip/Ignore top-level references
+ if len(spec.Ref.String()) > 0 {
+ continue
+ }
+
+ var a schema.Atom
+
+ // Hard-coded schemas for now as proto_models implementation functions.
+ // https://github.com/kubernetes/kube-openapi/issues/364
+ if name == quantityResource {
+ a = schema.Atom{
+ Scalar: untypedDef.Atom.Scalar,
+ }
+ } else if name == rawExtensionResource {
+ a = untypedDef.Atom
+ } else {
+ c2 := c.push(name, &a)
+ c2.visitSpec(spec)
+ c.pop(c2)
+ }
+
+ c.insertTypeDef(name, a)
+ }
+
+ if len(c.errorMessages) > 0 {
+ return nil, errors.New(strings.Join(c.errorMessages, "\n"))
+ }
+
+ c.addCommonTypes()
+ return c.output, nil
+}
+
+func (c *convert) visitSpec(m *spec.Schema) {
+ // Check if this schema opts its descendants into preserve-unknown-fields
+ if p, ok := m.Extensions["x-kubernetes-preserve-unknown-fields"]; ok && p == true {
+ c.preserveUnknownFields = true
+ }
+ a := c.top()
+ *a = c.parseSchema(m)
+}
+
+func (c *convert) parseSchema(m *spec.Schema) schema.Atom {
+ // k8s-generated OpenAPI specs have historically used only one value for
+ // type and starting with OpenAPIV3 it is only allowed to be
+ // a single string.
+ typ := ""
+ if len(m.Type) > 0 {
+ typ = m.Type[0]
+ }
+
+ // Structural Schemas produced by kubernetes follow very specific rules which
+ // we can use to infer the SMD type:
+ switch typ {
+ case "":
+ // According to Swagger docs:
+ // https://swagger.io/docs/specification/data-models/data-types/#any
+ //
+ // If no type is specified, it is equivalent to accepting any type.
+ return schema.Atom{
+ Scalar: ptr(schema.Scalar("untyped")),
+ List: c.parseList(m),
+ Map: c.parseObject(m),
+ }
+
+ case "object":
+ return schema.Atom{
+ Map: c.parseObject(m),
+ }
+ case "array":
+ return schema.Atom{
+ List: c.parseList(m),
+ }
+ case "integer", "boolean", "number", "string":
+ return convertPrimitive(typ, m.Format)
+ default:
+ c.reportError("unrecognized type: '%v'", typ)
+ return schema.Atom{
+ Scalar: ptr(schema.Scalar("untyped")),
+ }
+ }
+}
+
+func (c *convert) makeOpenAPIRef(specSchema *spec.Schema) schema.TypeRef {
+ refString := specSchema.Ref.String()
+
+ // Special-case handling for $ref stored inside a single-element allOf
+ if len(refString) == 0 && len(specSchema.AllOf) == 1 && len(specSchema.AllOf[0].Ref.String()) > 0 {
+ refString = specSchema.AllOf[0].Ref.String()
+ }
+
+ if _, n := path.Split(refString); len(n) > 0 {
+ //!TODO: Refactor the field ElementRelationship override
+ // we can generate the types with overrides ahead of time rather than
+ // requiring the hacky runtime support
+ // (could just create a normalized key struct containing all customizations
+ // to deduplicate)
+ mapRelationship, err := getMapElementRelationship(specSchema.Extensions)
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ if len(mapRelationship) > 0 {
+ return schema.TypeRef{
+ NamedType: &n,
+ ElementRelationship: &mapRelationship,
+ }
+ }
+
+ return schema.TypeRef{
+ NamedType: &n,
+ }
+
+ }
+ var inlined schema.Atom
+
+ // compute the type inline
+ c2 := c.push("inlined in "+c.currentName, &inlined)
+ c2.preserveUnknownFields = c.preserveUnknownFields
+ c2.visitSpec(specSchema)
+ c.pop(c2)
+
+ return schema.TypeRef{
+ Inlined: inlined,
+ }
+}
+
+func (c *convert) parseObject(s *spec.Schema) *schema.Map {
+ var fields []schema.StructField
+ for name, member := range s.Properties {
+ fields = append(fields, schema.StructField{
+ Name: name,
+ Type: c.makeOpenAPIRef(&member),
+ Default: member.Default,
+ })
+ }
+
+ // AdditionalProperties informs the schema of any "unknown" keys
+ // Unknown keys are enforced by the ElementType field.
+ elementType := func() schema.TypeRef {
+ if s.AdditionalProperties == nil {
+ // According to openAPI spec, an object without properties and without
+ // additionalProperties is assumed to be a free-form object.
+ if c.preserveUnknownFields || len(s.Properties) == 0 {
+ return schema.TypeRef{
+ NamedType: &deducedName,
+ }
+ }
+
+ // If properties are specified, do not implicitly allow unknown
+ // fields
+ return schema.TypeRef{}
+ } else if s.AdditionalProperties.Schema != nil {
+ // Unknown fields use the referred schema
+ return c.makeOpenAPIRef(s.AdditionalProperties.Schema)
+
+ } else if s.AdditionalProperties.Allows {
+ // A boolean instead of a schema was provided. Deduce the
+ // type from the value provided at runtime.
+ return schema.TypeRef{
+ NamedType: &deducedName,
+ }
+ } else {
+ // Additional Properties are explicitly disallowed by the user.
+ // Ensure element type is empty.
+ return schema.TypeRef{}
+ }
+ }()
+
+ relationship, err := getMapElementRelationship(s.Extensions)
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ return &schema.Map{
+ Fields: fields,
+ ElementRelationship: relationship,
+ ElementType: elementType,
+ }
+}
+
+func (c *convert) parseList(s *spec.Schema) *schema.List {
+ relationship, mapKeys, err := getListElementRelationship(s.Extensions)
+ if err != nil {
+ c.reportError(err.Error())
+ }
+ elementType := func() schema.TypeRef {
+ if s.Items != nil {
+ if s.Items.Schema == nil || s.Items.Len() != 1 {
+ c.reportError("structural schema arrays must have exactly one member subtype")
+ return schema.TypeRef{
+ NamedType: &deducedName,
+ }
+ }
+
+ subSchema := s.Items.Schema
+ if subSchema == nil {
+ subSchema = &s.Items.Schemas[0]
+ }
+ return c.makeOpenAPIRef(subSchema)
+ } else if len(s.Type) > 0 && len(s.Type[0]) > 0 {
+ c.reportError("`items` must be specified on arrays")
+ }
+
+ // A list with no items specified is treated as "untyped".
+ return schema.TypeRef{
+ NamedType: &untypedName,
+ }
+
+ }()
+
+ return &schema.List{
+ ElementRelationship: relationship,
+ Keys: mapKeys,
+ ElementType: elementType,
+ }
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/proto_models.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/proto_models.go
new file mode 100644
index 000000000..2c6fd76a9
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/schemaconv/proto_models.go
@@ -0,0 +1,178 @@
+/*
+Copyright 2022 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package schemaconv
+
+import (
+ "errors"
+ "path"
+ "strings"
+
+ "k8s.io/kube-openapi/pkg/util/proto"
+ "sigs.k8s.io/structured-merge-diff/v4/schema"
+)
+
+// ToSchema converts openapi definitions into a schema suitable for structured
+// merge (i.e. kubectl apply v2).
+func ToSchema(models proto.Models) (*schema.Schema, error) {
+ return ToSchemaWithPreserveUnknownFields(models, false)
+}
+
+// ToSchemaWithPreserveUnknownFields converts openapi definitions into a schema suitable for structured
+// merge (i.e. kubectl apply v2), it will preserve unknown fields if specified.
+func ToSchemaWithPreserveUnknownFields(models proto.Models, preserveUnknownFields bool) (*schema.Schema, error) {
+ c := convert{
+ preserveUnknownFields: preserveUnknownFields,
+ output: &schema.Schema{},
+ }
+ for _, name := range models.ListModels() {
+ model := models.LookupModel(name)
+
+ var a schema.Atom
+ c2 := c.push(name, &a)
+ model.Accept(c2)
+ c.pop(c2)
+
+ c.insertTypeDef(name, a)
+ }
+
+ if len(c.errorMessages) > 0 {
+ return nil, errors.New(strings.Join(c.errorMessages, "\n"))
+ }
+
+ c.addCommonTypes()
+ return c.output, nil
+}
+
+func (c *convert) makeRef(model proto.Schema, preserveUnknownFields bool) schema.TypeRef {
+ var tr schema.TypeRef
+ if r, ok := model.(*proto.Ref); ok {
+ if r.Reference() == "io.k8s.apimachinery.pkg.runtime.RawExtension" {
+ return schema.TypeRef{
+ NamedType: &untypedName,
+ }
+ }
+ // reference a named type
+ _, n := path.Split(r.Reference())
+ tr.NamedType = &n
+
+ mapRelationship, err := getMapElementRelationship(model.GetExtensions())
+
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ // empty string means unset.
+ if len(mapRelationship) > 0 {
+ tr.ElementRelationship = &mapRelationship
+ }
+ } else {
+ // compute the type inline
+ c2 := c.push("inlined in "+c.currentName, &tr.Inlined)
+ c2.preserveUnknownFields = preserveUnknownFields
+ model.Accept(c2)
+ c.pop(c2)
+
+ if tr == (schema.TypeRef{}) {
+ // emit warning?
+ tr.NamedType = &untypedName
+ }
+ }
+ return tr
+}
+
+func (c *convert) VisitKind(k *proto.Kind) {
+ preserveUnknownFields := c.preserveUnknownFields
+ if p, ok := k.GetExtensions()["x-kubernetes-preserve-unknown-fields"]; ok && p == true {
+ preserveUnknownFields = true
+ }
+
+ a := c.top()
+ a.Map = &schema.Map{}
+ for _, name := range k.FieldOrder {
+ member := k.Fields[name]
+ tr := c.makeRef(member, preserveUnknownFields)
+ a.Map.Fields = append(a.Map.Fields, schema.StructField{
+ Name: name,
+ Type: tr,
+ Default: member.GetDefault(),
+ })
+ }
+
+ unions, err := makeUnions(k.GetExtensions())
+ if err != nil {
+ c.reportError(err.Error())
+ return
+ }
+ // TODO: We should check that the fields and discriminator
+ // specified in the union are actual fields in the struct.
+ a.Map.Unions = unions
+
+ if preserveUnknownFields {
+ a.Map.ElementType = schema.TypeRef{
+ NamedType: &deducedName,
+ }
+ }
+
+ a.Map.ElementRelationship, err = getMapElementRelationship(k.GetExtensions())
+ if err != nil {
+ c.reportError(err.Error())
+ }
+}
+
+func (c *convert) VisitArray(a *proto.Array) {
+ relationship, mapKeys, err := getListElementRelationship(a.GetExtensions())
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ atom := c.top()
+ atom.List = &schema.List{
+ ElementType: c.makeRef(a.SubType, c.preserveUnknownFields),
+ ElementRelationship: relationship,
+ Keys: mapKeys,
+ }
+}
+
+func (c *convert) VisitMap(m *proto.Map) {
+ relationship, err := getMapElementRelationship(m.GetExtensions())
+ if err != nil {
+ c.reportError(err.Error())
+ }
+
+ a := c.top()
+ a.Map = &schema.Map{
+ ElementType: c.makeRef(m.SubType, c.preserveUnknownFields),
+ ElementRelationship: relationship,
+ }
+}
+
+func (c *convert) VisitPrimitive(p *proto.Primitive) {
+ a := c.top()
+ if c.currentName == quantityResource {
+ a.Scalar = ptr(schema.Scalar("untyped"))
+ } else {
+ *a = convertPrimitive(p.Type, p.Format)
+ }
+}
+
+func (c *convert) VisitArbitrary(a *proto.Arbitrary) {
+ *c.top() = deducedDef.Atom
+}
+
+func (c *convert) VisitReference(proto.Reference) {
+ // Do nothing, we handle references specially
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go
index bec0e7809..9887d185b 100644
--- a/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go
+++ b/vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go
@@ -17,43 +17,18 @@ limitations under the License.
package schemaconv
import (
- "errors"
"fmt"
- "path"
"sort"
- "strings"
- "k8s.io/kube-openapi/pkg/util/proto"
"sigs.k8s.io/structured-merge-diff/v4/schema"
)
const (
- quantityResource = "io.k8s.apimachinery.pkg.api.resource.Quantity"
+ quantityResource = "io.k8s.apimachinery.pkg.api.resource.Quantity"
+ rawExtensionResource = "io.k8s.apimachinery.pkg.runtime.RawExtension"
)
-// ToSchema converts openapi definitions into a schema suitable for structured
-// merge (i.e. kubectl apply v2).
-func ToSchema(models proto.Models) (*schema.Schema, error) {
- return ToSchemaWithPreserveUnknownFields(models, false)
-}
-
-// ToSchemaWithPreserveUnknownFields converts openapi definitions into a schema suitable for structured
-// merge (i.e. kubectl apply v2), it will preserve unknown fields if specified.
-func ToSchemaWithPreserveUnknownFields(models proto.Models, preserveUnknownFields bool) (*schema.Schema, error) {
- c := convert{
- input: models,
- preserveUnknownFields: preserveUnknownFields,
- output: &schema.Schema{},
- }
- if err := c.convertAll(); err != nil {
- return nil, err
- }
- c.addCommonTypes()
- return c.output, nil
-}
-
type convert struct {
- input proto.Models
preserveUnknownFields bool
output *schema.Schema
@@ -64,7 +39,6 @@ type convert struct {
func (c *convert) push(name string, a *schema.Atom) *convert {
return &convert{
- input: c.input,
preserveUnknownFields: c.preserveUnknownFields,
output: c.output,
currentName: name,
@@ -78,30 +52,17 @@ func (c *convert) pop(c2 *convert) {
c.errorMessages = append(c.errorMessages, c2.errorMessages...)
}
-func (c *convert) convertAll() error {
- for _, name := range c.input.ListModels() {
- model := c.input.LookupModel(name)
- c.insertTypeDef(name, model)
- }
- if len(c.errorMessages) > 0 {
- return errors.New(strings.Join(c.errorMessages, "\n"))
- }
- return nil
-}
-
func (c *convert) reportError(format string, args ...interface{}) {
c.errorMessages = append(c.errorMessages,
c.currentName+": "+fmt.Sprintf(format, args...),
)
}
-func (c *convert) insertTypeDef(name string, model proto.Schema) {
+func (c *convert) insertTypeDef(name string, atom schema.Atom) {
def := schema.TypeDef{
Name: name,
+ Atom: atom,
}
- c2 := c.push(name, &def.Atom)
- model.Accept(c2)
- c.pop(c2)
if def.Atom == (schema.Atom{}) {
// This could happen if there were a top-level reference.
return
@@ -156,46 +117,6 @@ var deducedDef schema.TypeDef = schema.TypeDef{
},
}
-func (c *convert) makeRef(model proto.Schema, preserveUnknownFields bool) schema.TypeRef {
- var tr schema.TypeRef
- if r, ok := model.(*proto.Ref); ok {
- if r.Reference() == "io.k8s.apimachinery.pkg.runtime.RawExtension" {
- return schema.TypeRef{
- NamedType: &untypedName,
- }
- }
- // reference a named type
- _, n := path.Split(r.Reference())
- tr.NamedType = &n
-
- ext := model.GetExtensions()
- if val, ok := ext["x-kubernetes-map-type"]; ok {
- switch val {
- case "atomic":
- relationship := schema.Atomic
- tr.ElementRelationship = &relationship
- case "granular":
- relationship := schema.Separable
- tr.ElementRelationship = &relationship
- default:
- c.reportError("unknown map type %v", val)
- }
- }
- } else {
- // compute the type inline
- c2 := c.push("inlined in "+c.currentName, &tr.Inlined)
- c2.preserveUnknownFields = preserveUnknownFields
- model.Accept(c2)
- c.pop(c2)
-
- if tr == (schema.TypeRef{}) {
- // emit warning?
- tr.NamedType = &untypedName
- }
- }
- return tr
-}
-
func makeUnions(extensions map[string]interface{}) ([]schema.Union, error) {
schemaUnions := []schema.Union{}
if iunions, ok := extensions["x-kubernetes-unions"]; ok {
@@ -293,58 +214,9 @@ func makeUnion(extensions map[string]interface{}) (schema.Union, error) {
}
}
- if union.Discriminator != nil && len(union.Fields) == 0 {
- return schema.Union{}, fmt.Errorf("discriminator set to %v, but no fields in union", *union.Discriminator)
- }
return union, nil
}
-func (c *convert) VisitKind(k *proto.Kind) {
- preserveUnknownFields := c.preserveUnknownFields
- if p, ok := k.GetExtensions()["x-kubernetes-preserve-unknown-fields"]; ok && p == true {
- preserveUnknownFields = true
- }
-
- a := c.top()
- a.Map = &schema.Map{}
- for _, name := range k.FieldOrder {
- member := k.Fields[name]
- tr := c.makeRef(member, preserveUnknownFields)
- a.Map.Fields = append(a.Map.Fields, schema.StructField{
- Name: name,
- Type: tr,
- Default: member.GetDefault(),
- })
- }
-
- unions, err := makeUnions(k.GetExtensions())
- if err != nil {
- c.reportError(err.Error())
- return
- }
- // TODO: We should check that the fields and discriminator
- // specified in the union are actual fields in the struct.
- a.Map.Unions = unions
-
- if preserveUnknownFields {
- a.Map.ElementType = schema.TypeRef{
- NamedType: &deducedName,
- }
- }
-
- ext := k.GetExtensions()
- if val, ok := ext["x-kubernetes-map-type"]; ok {
- switch val {
- case "atomic":
- a.Map.ElementRelationship = schema.Atomic
- case "granular":
- a.Map.ElementRelationship = schema.Separable
- default:
- c.reportError("unknown map type %v", val)
- }
- }
-}
-
func toStringSlice(o interface{}) (out []string, ok bool) {
switch t := o.(type) {
case []interface{}:
@@ -355,117 +227,108 @@ func toStringSlice(o interface{}) (out []string, ok bool) {
}
}
return out, true
+ case []string:
+ return t, true
}
return nil, false
}
-func (c *convert) VisitArray(a *proto.Array) {
- atom := c.top()
- atom.List = &schema.List{
- ElementRelationship: schema.Atomic,
- }
- l := atom.List
- l.ElementType = c.makeRef(a.SubType, c.preserveUnknownFields)
-
- ext := a.GetExtensions()
+func ptr(s schema.Scalar) *schema.Scalar { return &s }
- if val, ok := ext["x-kubernetes-list-type"]; ok {
- if val == "atomic" {
- l.ElementRelationship = schema.Atomic
- } else if val == "set" {
- l.ElementRelationship = schema.Associative
- } else if val == "map" {
- l.ElementRelationship = schema.Associative
- if keys, ok := ext["x-kubernetes-list-map-keys"]; ok {
- if keyNames, ok := toStringSlice(keys); ok {
- l.Keys = keyNames
- } else {
- c.reportError("uninterpreted map keys: %#v", keys)
- }
- } else {
- c.reportError("missing map keys")
- }
- } else {
- c.reportError("unknown list type %v", val)
- l.ElementRelationship = schema.Atomic
- }
- } else if val, ok := ext["x-kubernetes-patch-strategy"]; ok {
- if val == "merge" || val == "merge,retainKeys" {
- l.ElementRelationship = schema.Associative
- if key, ok := ext["x-kubernetes-patch-merge-key"]; ok {
- if keyName, ok := key.(string); ok {
- l.Keys = []string{keyName}
- } else {
- c.reportError("uninterpreted merge key: %#v", key)
- }
- } else {
- // It's not an error for this to be absent, it
- // means it's a set.
- }
- } else if val == "retainKeys" {
- } else {
- c.reportError("unknown patch strategy %v", val)
- l.ElementRelationship = schema.Atomic
+// Basic conversion functions to convert OpenAPI schema definitions to
+// SMD Schema atoms
+func convertPrimitive(typ string, format string) (a schema.Atom) {
+ switch typ {
+ case "integer":
+ a.Scalar = ptr(schema.Numeric)
+ case "number":
+ a.Scalar = ptr(schema.Numeric)
+ case "string":
+ switch format {
+ case "":
+ a.Scalar = ptr(schema.String)
+ case "byte":
+ // byte really means []byte and is encoded as a string.
+ a.Scalar = ptr(schema.String)
+ case "int-or-string":
+ a.Scalar = ptr(schema.Scalar("untyped"))
+ case "date-time":
+ a.Scalar = ptr(schema.Scalar("untyped"))
+ default:
+ a.Scalar = ptr(schema.Scalar("untyped"))
}
+ case "boolean":
+ a.Scalar = ptr(schema.Boolean)
+ default:
+ a.Scalar = ptr(schema.Scalar("untyped"))
}
-}
-func (c *convert) VisitMap(m *proto.Map) {
- a := c.top()
- a.Map = &schema.Map{}
- a.Map.ElementType = c.makeRef(m.SubType, c.preserveUnknownFields)
+ return a
+}
- ext := m.GetExtensions()
- if val, ok := ext["x-kubernetes-map-type"]; ok {
+func getListElementRelationship(ext map[string]any) (schema.ElementRelationship, []string, error) {
+ if val, ok := ext["x-kubernetes-list-type"]; ok {
switch val {
case "atomic":
- a.Map.ElementRelationship = schema.Atomic
- case "granular":
- a.Map.ElementRelationship = schema.Separable
+ return schema.Atomic, nil, nil
+ case "set":
+ return schema.Associative, nil, nil
+ case "map":
+ keys, ok := ext["x-kubernetes-list-map-keys"]
+
+ if !ok {
+ return schema.Associative, nil, fmt.Errorf("missing map keys")
+ }
+
+ keyNames, ok := toStringSlice(keys)
+ if !ok {
+ return schema.Associative, nil, fmt.Errorf("uninterpreted map keys: %#v", keys)
+ }
+
+ return schema.Associative, keyNames, nil
default:
- c.reportError("unknown map type %v", val)
+ return schema.Atomic, nil, fmt.Errorf("unknown list type %v", val)
}
- }
-}
+ } else if val, ok := ext["x-kubernetes-patch-strategy"]; ok {
+ switch val {
+ case "merge", "merge,retainKeys":
+ if key, ok := ext["x-kubernetes-patch-merge-key"]; ok {
+ keyName, ok := key.(string)
-func ptr(s schema.Scalar) *schema.Scalar { return &s }
+ if !ok {
+ return schema.Associative, nil, fmt.Errorf("uninterpreted merge key: %#v", key)
+ }
-func (c *convert) VisitPrimitive(p *proto.Primitive) {
- a := c.top()
- if c.currentName == quantityResource {
- a.Scalar = ptr(schema.Scalar("untyped"))
- } else {
- switch p.Type {
- case proto.Integer:
- a.Scalar = ptr(schema.Numeric)
- case proto.Number:
- a.Scalar = ptr(schema.Numeric)
- case proto.String:
- switch p.Format {
- case "":
- a.Scalar = ptr(schema.String)
- case "byte":
- // byte really means []byte and is encoded as a string.
- a.Scalar = ptr(schema.String)
- case "int-or-string":
- a.Scalar = ptr(schema.Scalar("untyped"))
- case "date-time":
- a.Scalar = ptr(schema.Scalar("untyped"))
- default:
- a.Scalar = ptr(schema.Scalar("untyped"))
+ return schema.Associative, []string{keyName}, nil
}
- case proto.Boolean:
- a.Scalar = ptr(schema.Boolean)
+ // It's not an error for x-kubernetes-patch-merge-key to be absent,
+ // it means it's a set
+ return schema.Associative, nil, nil
+ case "retainKeys":
+ return schema.Atomic, nil, nil
default:
- a.Scalar = ptr(schema.Scalar("untyped"))
+ return schema.Atomic, nil, fmt.Errorf("unknown patch strategy %v", val)
}
}
-}
-func (c *convert) VisitArbitrary(a *proto.Arbitrary) {
- *c.top() = deducedDef.Atom
+ // Treat as atomic by default
+ return schema.Atomic, nil, nil
}
-func (c *convert) VisitReference(proto.Reference) {
- // Do nothing, we handle references specially
+// Returns map element relationship if specified, or empty string if unspecified
+func getMapElementRelationship(ext map[string]any) (schema.ElementRelationship, error) {
+ val, ok := ext["x-kubernetes-map-type"]
+ if !ok {
+ // unset Map element relationship
+ return "", nil
+ }
+
+ switch val {
+ case "atomic":
+ return schema.Atomic, nil
+ case "granular":
+ return schema.Separable, nil
+ default:
+ return "", fmt.Errorf("unknown map type %v", val)
+ }
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/encoding.go b/vendor/k8s.io/kube-openapi/pkg/spec3/encoding.go
index 51dac4bdf..1f62c6e77 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/encoding.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/encoding.go
@@ -18,7 +18,10 @@ package spec3
import (
"encoding/json"
+
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
"k8s.io/kube-openapi/pkg/validation/spec"
)
@@ -29,6 +32,9 @@ type Encoding struct {
// MarshalJSON is a custom marshal function that knows how to encode Encoding as JSON
func (e *Encoding) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(e)
+ }
b1, err := json.Marshal(e.EncodingProps)
if err != nil {
return nil, err
@@ -40,7 +46,20 @@ func (e *Encoding) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (e *Encoding) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ EncodingProps encodingPropsOmitZero `json:",inline"`
+ spec.Extensions
+ }
+ x.Extensions = internal.SanitizeExtensions(e.Extensions)
+ x.EncodingProps = encodingPropsOmitZero(e.EncodingProps)
+ return opts.MarshalNext(enc, x)
+}
+
func (e *Encoding) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, e)
+ }
if err := json.Unmarshal(data, &e.EncodingProps); err != nil {
return err
}
@@ -50,6 +69,20 @@ func (e *Encoding) UnmarshalJSON(data []byte) error {
return nil
}
+func (e *Encoding) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ EncodingProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+
+ e.Extensions = internal.SanitizeExtensions(x.Extensions)
+ e.EncodingProps = x.EncodingProps
+ return nil
+}
+
type EncodingProps struct {
// Content Type for encoding a specific property
ContentType string `json:"contentType,omitempty"`
@@ -58,7 +91,15 @@ type EncodingProps struct {
// Describes how a specific property value will be serialized depending on its type
Style string `json:"style,omitempty"`
// When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect
- Explode string `json:"explode,omitempty"`
+ Explode bool `json:"explode,omitempty"`
// AllowReserved determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986
AllowReserved bool `json:"allowReserved,omitempty"`
}
+
+type encodingPropsOmitZero struct {
+ ContentType string `json:"contentType,omitempty"`
+ Headers map[string]*Header `json:"headers,omitempty"`
+ Style string `json:"style,omitempty"`
+ Explode bool `json:"explode,omitzero"`
+ AllowReserved bool `json:"allowReserved,omitzero"`
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/example.go b/vendor/k8s.io/kube-openapi/pkg/spec3/example.go
index 0f5ab983c..8834a92e6 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/example.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/example.go
@@ -19,8 +19,11 @@ package spec3
import (
"encoding/json"
- "k8s.io/kube-openapi/pkg/validation/spec"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
// Example https://swagger.io/specification/#example-object
@@ -33,6 +36,9 @@ type Example struct {
// MarshalJSON is a custom marshal function that knows how to encode RequestBody as JSON
func (e *Example) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(e)
+ }
b1, err := json.Marshal(e.Refable)
if err != nil {
return nil, err
@@ -47,8 +53,22 @@ func (e *Example) MarshalJSON() ([]byte, error) {
}
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (e *Example) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ ExampleProps `json:",inline"`
+ spec.Extensions
+ }
+ x.Ref = e.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(e.Extensions)
+ x.ExampleProps = e.ExampleProps
+ return opts.MarshalNext(enc, x)
+}
func (e *Example) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, e)
+ }
if err := json.Unmarshal(data, &e.Refable); err != nil {
return err
}
@@ -61,6 +81,23 @@ func (e *Example) UnmarshalJSON(data []byte) error {
return nil
}
+func (e *Example) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ ExampleProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := internal.JSONRefFromMap(&e.Ref.Ref, x.Extensions); err != nil {
+ return err
+ }
+ e.Extensions = internal.SanitizeExtensions(x.Extensions)
+ e.ExampleProps = x.ExampleProps
+
+ return nil
+}
+
type ExampleProps struct {
// Summary holds a short description of the example
Summary string `json:"summary,omitempty"`
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/external_documentation.go b/vendor/k8s.io/kube-openapi/pkg/spec3/external_documentation.go
index 117113e7a..f0515496e 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/external_documentation.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/external_documentation.go
@@ -18,8 +18,11 @@ package spec3
import (
"encoding/json"
- "k8s.io/kube-openapi/pkg/validation/spec"
+
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
type ExternalDocumentation struct {
@@ -36,6 +39,9 @@ type ExternalDocumentationProps struct {
// MarshalJSON is a custom marshal function that knows how to encode Responses as JSON
func (e *ExternalDocumentation) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(e)
+ }
b1, err := json.Marshal(e.ExternalDocumentationProps)
if err != nil {
return nil, err
@@ -47,7 +53,20 @@ func (e *ExternalDocumentation) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (e *ExternalDocumentation) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ ExternalDocumentationProps `json:",inline"`
+ spec.Extensions
+ }
+ x.Extensions = internal.SanitizeExtensions(e.Extensions)
+ x.ExternalDocumentationProps = e.ExternalDocumentationProps
+ return opts.MarshalNext(enc, x)
+}
+
func (e *ExternalDocumentation) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, e)
+ }
if err := json.Unmarshal(data, &e.ExternalDocumentationProps); err != nil {
return err
}
@@ -56,3 +75,16 @@ func (e *ExternalDocumentation) UnmarshalJSON(data []byte) error {
}
return nil
}
+
+func (e *ExternalDocumentation) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ ExternalDocumentationProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ e.Extensions = internal.SanitizeExtensions(x.Extensions)
+ e.ExternalDocumentationProps = x.ExternalDocumentationProps
+ return nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/fuzz.go b/vendor/k8s.io/kube-openapi/pkg/spec3/fuzz.go
new file mode 100644
index 000000000..08b6246ce
--- /dev/null
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/fuzz.go
@@ -0,0 +1,281 @@
+package spec3
+
+import (
+ "math/rand"
+ "strings"
+
+ fuzz "github.com/google/gofuzz"
+
+ "k8s.io/kube-openapi/pkg/validation/spec"
+)
+
+// refChance is the chance that a particular component will use a $ref
+// instead of fuzzed. Expressed as a fraction 1/n, currently there is
+// a 1/3 chance that a ref will be used.
+const refChance = 3
+
+const alphaNumChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+func randAlphanumString() string {
+ arr := make([]string, rand.Intn(10)+5)
+ for i := 0; i < len(arr); i++ {
+ arr[i] = string(alphaNumChars[rand.Intn(len(alphaNumChars))])
+ }
+ return strings.Join(arr, "")
+}
+
+var OpenAPIV3FuzzFuncs []interface{} = []interface{}{
+ func(s *string, c fuzz.Continue) {
+ // All OpenAPI V3 map keys must follow the corresponding
+ // regex. Note that this restricts the range for all other
+ // string values as well.
+ str := randAlphanumString()
+ *s = str
+ },
+ func(o *OpenAPI, c fuzz.Continue) {
+ c.FuzzNoCustom(o)
+ o.Version = "3.0.0"
+ for i, val := range o.SecurityRequirement {
+ if val == nil {
+ o.SecurityRequirement[i] = make(map[string][]string)
+ }
+
+ for k, v := range val {
+ if v == nil {
+ val[k] = make([]string, 0)
+ }
+ }
+ }
+
+ },
+ func(r *interface{}, c fuzz.Continue) {
+ switch c.Intn(3) {
+ case 0:
+ *r = nil
+ case 1:
+ n := c.RandString() + "x"
+ *r = n
+ case 2:
+ n := c.Float64()
+ *r = n
+ }
+ },
+ func(v **spec.Info, c fuzz.Continue) {
+ // Info is never nil
+ *v = &spec.Info{}
+ c.FuzzNoCustom(*v)
+ (*v).Title = c.RandString() + "x"
+ },
+ func(v *Paths, c fuzz.Continue) {
+ c.Fuzz(&v.VendorExtensible)
+ num := c.Intn(5)
+ if num > 0 {
+ v.Paths = make(map[string]*Path)
+ }
+ for i := 0; i < num; i++ {
+ val := Path{}
+ c.Fuzz(&val)
+ v.Paths["/"+c.RandString()] = &val
+ }
+ },
+ func(v *SecurityScheme, c fuzz.Continue) {
+ if c.Intn(refChance) == 0 {
+ c.Fuzz(&v.Refable)
+ return
+ }
+ switch c.Intn(4) {
+ case 0:
+ v.Type = "apiKey"
+ v.Name = c.RandString() + "x"
+ switch c.Intn(3) {
+ case 0:
+ v.In = "query"
+ case 1:
+ v.In = "header"
+ case 2:
+ v.In = "cookie"
+ }
+ case 1:
+ v.Type = "http"
+ case 2:
+ v.Type = "oauth2"
+ v.Flows = make(map[string]*OAuthFlow)
+ flow := OAuthFlow{}
+ flow.AuthorizationUrl = c.RandString() + "x"
+ v.Flows["implicit"] = &flow
+ flow.Scopes = make(map[string]string)
+ flow.Scopes["foo"] = "bar"
+ case 3:
+ v.Type = "openIdConnect"
+ v.OpenIdConnectUrl = "https://" + c.RandString()
+ }
+ v.Scheme = "basic"
+ },
+ func(v *spec.Ref, c fuzz.Continue) {
+ switch c.Intn(7) {
+ case 0:
+ *v = spec.MustCreateRef("#/components/schemas/" + randAlphanumString())
+ case 1:
+ *v = spec.MustCreateRef("#/components/responses/" + randAlphanumString())
+ case 2:
+ *v = spec.MustCreateRef("#/components/headers/" + randAlphanumString())
+ case 3:
+ *v = spec.MustCreateRef("#/components/securitySchemes/" + randAlphanumString())
+ case 5:
+ *v = spec.MustCreateRef("#/components/parameters/" + randAlphanumString())
+ case 6:
+ *v = spec.MustCreateRef("#/components/requestBodies/" + randAlphanumString())
+ }
+ },
+ func(v *Parameter, c fuzz.Continue) {
+ if c.Intn(refChance) == 0 {
+ c.Fuzz(&v.Refable)
+ return
+ }
+ c.Fuzz(&v.ParameterProps)
+ c.Fuzz(&v.VendorExtensible)
+
+ switch c.Intn(3) {
+ case 0:
+ // Header param
+ v.In = "query"
+ case 1:
+ v.In = "header"
+ case 2:
+ v.In = "cookie"
+ }
+ },
+ func(v *RequestBody, c fuzz.Continue) {
+ if c.Intn(refChance) == 0 {
+ c.Fuzz(&v.Refable)
+ return
+ }
+ c.Fuzz(&v.RequestBodyProps)
+ c.Fuzz(&v.VendorExtensible)
+ },
+ func(v *Header, c fuzz.Continue) {
+ if c.Intn(refChance) == 0 {
+ c.Fuzz(&v.Refable)
+ return
+ }
+ c.Fuzz(&v.HeaderProps)
+ c.Fuzz(&v.VendorExtensible)
+ },
+ func(v *ResponsesProps, c fuzz.Continue) {
+ c.Fuzz(&v.Default)
+ n := c.Intn(5)
+ for i := 0; i < n; i++ {
+ r2 := Response{}
+ c.Fuzz(&r2)
+ // HTTP Status code in 100-599 Range
+ code := c.Intn(500) + 100
+ v.StatusCodeResponses = make(map[int]*Response)
+ v.StatusCodeResponses[code] = &r2
+ }
+ },
+ func(v *Response, c fuzz.Continue) {
+ if c.Intn(refChance) == 0 {
+ c.Fuzz(&v.Refable)
+ return
+ }
+ c.Fuzz(&v.ResponseProps)
+ c.Fuzz(&v.VendorExtensible)
+ },
+ func(v *Operation, c fuzz.Continue) {
+ c.FuzzNoCustom(v)
+ // Do not fuzz null values into the array.
+ for i, val := range v.SecurityRequirement {
+ if val == nil {
+ v.SecurityRequirement[i] = make(map[string][]string)
+ }
+
+ for k, v := range val {
+ if v == nil {
+ val[k] = make([]string, 0)
+ }
+ }
+ }
+ },
+ func(v *spec.Extensions, c fuzz.Continue) {
+ numChildren := c.Intn(5)
+ for i := 0; i < numChildren; i++ {
+ if *v == nil {
+ *v = spec.Extensions{}
+ }
+ (*v)["x-"+c.RandString()] = c.RandString()
+ }
+ },
+ func(v *spec.ExternalDocumentation, c fuzz.Continue) {
+ c.Fuzz(&v.Description)
+ v.URL = "https://" + randAlphanumString()
+ },
+ func(v *spec.SchemaURL, c fuzz.Continue) {
+ *v = spec.SchemaURL("https://" + randAlphanumString())
+ },
+ func(v *spec.SchemaOrBool, c fuzz.Continue) {
+ *v = spec.SchemaOrBool{}
+
+ if c.RandBool() {
+ v.Allows = c.RandBool()
+ } else {
+ v.Schema = &spec.Schema{}
+ v.Allows = true
+ c.Fuzz(&v.Schema)
+ }
+ },
+ func(v *spec.SchemaOrArray, c fuzz.Continue) {
+ *v = spec.SchemaOrArray{}
+ if c.RandBool() {
+ schema := spec.Schema{}
+ c.Fuzz(&schema)
+ v.Schema = &schema
+ } else {
+ v.Schemas = []spec.Schema{}
+ numChildren := c.Intn(5)
+ for i := 0; i < numChildren; i++ {
+ schema := spec.Schema{}
+ c.Fuzz(&schema)
+ v.Schemas = append(v.Schemas, schema)
+ }
+
+ }
+
+ },
+ func(v *spec.SchemaOrStringArray, c fuzz.Continue) {
+ if c.RandBool() {
+ *v = spec.SchemaOrStringArray{}
+ if c.RandBool() {
+ c.Fuzz(&v.Property)
+ } else {
+ c.Fuzz(&v.Schema)
+ }
+ }
+ },
+ func(v *spec.Schema, c fuzz.Continue) {
+ if c.Intn(refChance) == 0 {
+ c.Fuzz(&v.Ref)
+ return
+ }
+ if c.RandBool() {
+ // file schema
+ c.Fuzz(&v.Default)
+ c.Fuzz(&v.Description)
+ c.Fuzz(&v.Example)
+ c.Fuzz(&v.ExternalDocs)
+
+ c.Fuzz(&v.Format)
+ c.Fuzz(&v.ReadOnly)
+ c.Fuzz(&v.Required)
+ c.Fuzz(&v.Title)
+ v.Type = spec.StringOrArray{"file"}
+
+ } else {
+ // normal schema
+ c.Fuzz(&v.SchemaProps)
+ c.Fuzz(&v.SwaggerSchemaProps)
+ c.Fuzz(&v.VendorExtensible)
+ c.Fuzz(&v.ExtraProps)
+ }
+
+ },
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/header.go b/vendor/k8s.io/kube-openapi/pkg/spec3/header.go
index cead4b15d..9ea30628c 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/header.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/header.go
@@ -20,6 +20,8 @@ import (
"encoding/json"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
"k8s.io/kube-openapi/pkg/validation/spec"
)
@@ -34,6 +36,9 @@ type Header struct {
// MarshalJSON is a custom marshal function that knows how to encode Header as JSON
func (h *Header) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(h)
+ }
b1, err := json.Marshal(h.Refable)
if err != nil {
return nil, err
@@ -49,7 +54,22 @@ func (h *Header) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (h *Header) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ HeaderProps headerPropsOmitZero `json:",inline"`
+ spec.Extensions
+ }
+ x.Ref = h.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(h.Extensions)
+ x.HeaderProps = headerPropsOmitZero(h.HeaderProps)
+ return opts.MarshalNext(enc, x)
+}
+
func (h *Header) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, h)
+ }
if err := json.Unmarshal(data, &h.Refable); err != nil {
return err
}
@@ -63,6 +83,22 @@ func (h *Header) UnmarshalJSON(data []byte) error {
return nil
}
+func (h *Header) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ HeaderProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := internal.JSONRefFromMap(&h.Ref.Ref, x.Extensions); err != nil {
+ return err
+ }
+ h.Extensions = internal.SanitizeExtensions(x.Extensions)
+ h.HeaderProps = x.HeaderProps
+ return nil
+}
+
// HeaderProps a struct that describes a header object
type HeaderProps struct {
// Description holds a brief description of the parameter
@@ -88,3 +124,19 @@ type HeaderProps struct {
// Examples of the header
Examples map[string]*Example `json:"examples,omitempty"`
}
+
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type headerPropsOmitZero struct {
+ Description string `json:"description,omitempty"`
+ Required bool `json:"required,omitzero"`
+ Deprecated bool `json:"deprecated,omitzero"`
+ AllowEmptyValue bool `json:"allowEmptyValue,omitzero"`
+ Style string `json:"style,omitempty"`
+ Explode bool `json:"explode,omitzero"`
+ AllowReserved bool `json:"allowReserved,omitzero"`
+ Schema *spec.Schema `json:"schema,omitzero"`
+ Content map[string]*MediaType `json:"content,omitempty"`
+ Example interface{} `json:"example,omitempty"`
+ Examples map[string]*Example `json:"examples,omitempty"`
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/media_type.go b/vendor/k8s.io/kube-openapi/pkg/spec3/media_type.go
index 828fd8dc5..47eef1edb 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/media_type.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/media_type.go
@@ -18,7 +18,10 @@ package spec3
import (
"encoding/json"
+
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
"k8s.io/kube-openapi/pkg/validation/spec"
)
@@ -32,6 +35,9 @@ type MediaType struct {
// MarshalJSON is a custom marshal function that knows how to encode MediaType as JSON
func (m *MediaType) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(m)
+ }
b1, err := json.Marshal(m.MediaTypeProps)
if err != nil {
return nil, err
@@ -43,7 +49,20 @@ func (m *MediaType) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (e *MediaType) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ MediaTypeProps mediaTypePropsOmitZero `json:",inline"`
+ spec.Extensions
+ }
+ x.Extensions = internal.SanitizeExtensions(e.Extensions)
+ x.MediaTypeProps = mediaTypePropsOmitZero(e.MediaTypeProps)
+ return opts.MarshalNext(enc, x)
+}
+
func (m *MediaType) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, m)
+ }
if err := json.Unmarshal(data, &m.MediaTypeProps); err != nil {
return err
}
@@ -53,10 +72,24 @@ func (m *MediaType) UnmarshalJSON(data []byte) error {
return nil
}
+func (m *MediaType) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ MediaTypeProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ m.Extensions = internal.SanitizeExtensions(x.Extensions)
+ m.MediaTypeProps = x.MediaTypeProps
+
+ return nil
+}
+
// MediaTypeProps a struct that allows you to specify content format, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#mediaTypeObject
type MediaTypeProps struct {
// Schema holds the schema defining the type used for the media type
- Schema *spec.Schema `json:"schema,omitempty"`
+ Schema *spec.Schema `json:"schema,omitempty"`
// Example of the media type
Example interface{} `json:"example,omitempty"`
// Examples of the media type. Each example object should match the media type and specific schema if present
@@ -64,3 +97,10 @@ type MediaTypeProps struct {
// A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded
Encoding map[string]*Encoding `json:"encoding,omitempty"`
}
+
+type mediaTypePropsOmitZero struct {
+ Schema *spec.Schema `json:"schema,omitzero"`
+ Example interface{} `json:"example,omitempty"`
+ Examples map[string]*Example `json:"examples,omitempty"`
+ Encoding map[string]*Encoding `json:"encoding,omitempty"`
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/operation.go b/vendor/k8s.io/kube-openapi/pkg/spec3/operation.go
index de8aa4602..f1e102547 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/operation.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/operation.go
@@ -19,8 +19,10 @@ package spec3
import (
"encoding/json"
- "k8s.io/kube-openapi/pkg/validation/spec"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
// Operation describes a single API operation on a path, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#operationObject
@@ -33,6 +35,9 @@ type Operation struct {
// MarshalJSON is a custom marshal function that knows how to encode Operation as JSON
func (o *Operation) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(o)
+ }
b1, err := json.Marshal(o.OperationProps)
if err != nil {
return nil, err
@@ -44,14 +49,40 @@ func (o *Operation) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (o *Operation) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ spec.Extensions
+ OperationProps operationPropsOmitZero `json:",inline"`
+ }
+ x.Extensions = internal.SanitizeExtensions(o.Extensions)
+ x.OperationProps = operationPropsOmitZero(o.OperationProps)
+ return opts.MarshalNext(enc, x)
+}
+
// UnmarshalJSON hydrates this items instance with the data from JSON
func (o *Operation) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, o)
+ }
if err := json.Unmarshal(data, &o.OperationProps); err != nil {
return err
}
return json.Unmarshal(data, &o.VendorExtensible)
}
+func (o *Operation) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ OperationProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ o.Extensions = internal.SanitizeExtensions(x.Extensions)
+ o.OperationProps = x.OperationProps
+ return nil
+}
+
// OperationProps describes a single API operation on a path, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#operationObject
type OperationProps struct {
// Tags holds a list of tags for API documentation control
@@ -73,7 +104,21 @@ type OperationProps struct {
// Deprecated declares this operation to be deprecated
Deprecated bool `json:"deprecated,omitempty"`
// SecurityRequirement holds a declaration of which security mechanisms can be used for this operation
- SecurityRequirement []*SecurityRequirement `json:"security,omitempty"`
+ SecurityRequirement []map[string][]string `json:"security,omitempty"`
// Servers contains an alternative server array to service this operation
Servers []*Server `json:"servers,omitempty"`
}
+
+type operationPropsOmitZero struct {
+ Tags []string `json:"tags,omitempty"`
+ Summary string `json:"summary,omitempty"`
+ Description string `json:"description,omitempty"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitzero"`
+ OperationId string `json:"operationId,omitempty"`
+ Parameters []*Parameter `json:"parameters,omitempty"`
+ RequestBody *RequestBody `json:"requestBody,omitzero"`
+ Responses *Responses `json:"responses,omitzero"`
+ Deprecated bool `json:"deprecated,omitzero"`
+ SecurityRequirement []map[string][]string `json:"security,omitempty"`
+ Servers []*Server `json:"servers,omitempty"`
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/parameter.go b/vendor/k8s.io/kube-openapi/pkg/spec3/parameter.go
index 0d7180e50..ada7edb63 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/parameter.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/parameter.go
@@ -20,6 +20,8 @@ import (
"encoding/json"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
"k8s.io/kube-openapi/pkg/validation/spec"
)
@@ -34,6 +36,9 @@ type Parameter struct {
// MarshalJSON is a custom marshal function that knows how to encode Parameter as JSON
func (p *Parameter) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(p)
+ }
b1, err := json.Marshal(p.Refable)
if err != nil {
return nil, err
@@ -49,7 +54,23 @@ func (p *Parameter) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (p *Parameter) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ ParameterProps parameterPropsOmitZero `json:",inline"`
+ spec.Extensions
+ }
+ x.Ref = p.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(p.Extensions)
+ x.ParameterProps = parameterPropsOmitZero(p.ParameterProps)
+ return opts.MarshalNext(enc, x)
+}
+
func (p *Parameter) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, p)
+ }
+
if err := json.Unmarshal(data, &p.Refable); err != nil {
return err
}
@@ -63,6 +84,22 @@ func (p *Parameter) UnmarshalJSON(data []byte) error {
return nil
}
+func (p *Parameter) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ ParameterProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := internal.JSONRefFromMap(&p.Ref.Ref, x.Extensions); err != nil {
+ return err
+ }
+ p.Extensions = internal.SanitizeExtensions(x.Extensions)
+ p.ParameterProps = x.ParameterProps
+ return nil
+}
+
// ParameterProps a struct that describes a single operation parameter, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject
type ParameterProps struct {
// Name holds the name of the parameter
@@ -92,3 +129,19 @@ type ParameterProps struct {
// Examples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding
Examples map[string]*Example `json:"examples,omitempty"`
}
+
+type parameterPropsOmitZero struct {
+ Name string `json:"name,omitempty"`
+ In string `json:"in,omitempty"`
+ Description string `json:"description,omitempty"`
+ Required bool `json:"required,omitzero"`
+ Deprecated bool `json:"deprecated,omitzero"`
+ AllowEmptyValue bool `json:"allowEmptyValue,omitzero"`
+ Style string `json:"style,omitempty"`
+ Explode bool `json:"explode,omitzero"`
+ AllowReserved bool `json:"allowReserved,omitzero"`
+ Schema *spec.Schema `json:"schema,omitzero"`
+ Content map[string]*MediaType `json:"content,omitempty"`
+ Example interface{} `json:"example,omitempty"`
+ Examples map[string]*Example `json:"examples,omitempty"`
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/path.go b/vendor/k8s.io/kube-openapi/pkg/spec3/path.go
index bc48c504d..16fbbb4dd 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/path.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/path.go
@@ -18,10 +18,13 @@ package spec3
import (
"encoding/json"
+ "fmt"
"strings"
- "k8s.io/kube-openapi/pkg/validation/spec"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
// Paths describes the available paths and operations for the API, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathsObject
@@ -32,19 +35,48 @@ type Paths struct {
// MarshalJSON is a custom marshal function that knows how to encode Paths as JSON
func (p *Paths) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(p.Paths)
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(p)
+ }
+ b1, err := json.Marshal(p.VendorExtensible)
if err != nil {
return nil, err
}
- b2, err := json.Marshal(p.VendorExtensible)
+
+ pths := make(map[string]*Path)
+ for k, v := range p.Paths {
+ if strings.HasPrefix(k, "/") {
+ pths[k] = v
+ }
+ }
+ b2, err := json.Marshal(pths)
if err != nil {
return nil, err
}
- return swag.ConcatJSON(b1, b2), nil
+ concated := swag.ConcatJSON(b1, b2)
+ return concated, nil
+}
+
+func (p *Paths) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ m := make(map[string]any, len(p.Extensions)+len(p.Paths))
+ for k, v := range p.Extensions {
+ if internal.IsExtensionKey(k) {
+ m[k] = v
+ }
+ }
+ for k, v := range p.Paths {
+ if strings.HasPrefix(k, "/") {
+ m[k] = v
+ }
+ }
+ return opts.MarshalNext(enc, m)
}
// UnmarshalJSON hydrates this items instance with the data from JSON
func (p *Paths) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, p)
+ }
var res map[string]json.RawMessage
if err := json.Unmarshal(data, &res); err != nil {
return err
@@ -74,6 +106,59 @@ func (p *Paths) UnmarshalJSON(data []byte) error {
return nil
}
+func (p *Paths) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ switch k := tok.Kind(); k {
+ case 'n':
+ *p = Paths{}
+ return nil
+ case '{':
+ for {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+
+ if tok.Kind() == '}' {
+ return nil
+ }
+
+ switch k := tok.String(); {
+ case internal.IsExtensionKey(k):
+ var ext any
+ if err := opts.UnmarshalNext(dec, &ext); err != nil {
+ return err
+ }
+
+ if p.Extensions == nil {
+ p.Extensions = make(map[string]any)
+ }
+ p.Extensions[k] = ext
+ case len(k) > 0 && k[0] == '/':
+ pi := Path{}
+ if err := opts.UnmarshalNext(dec, &pi); err != nil {
+ return err
+ }
+
+ if p.Paths == nil {
+ p.Paths = make(map[string]*Path)
+ }
+ p.Paths[k] = &pi
+ default:
+ _, err := dec.ReadValue() // skip value
+ if err != nil {
+ return err
+ }
+ }
+ }
+ default:
+ return fmt.Errorf("unknown JSON kind: %v", k)
+ }
+}
+
// Path describes the operations available on a single path, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathItemObject
//
// Note that this struct is actually a thin wrapper around PathProps to make it referable and extensible
@@ -85,6 +170,9 @@ type Path struct {
// MarshalJSON is a custom marshal function that knows how to encode Path as JSON
func (p *Path) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(p)
+ }
b1, err := json.Marshal(p.Refable)
if err != nil {
return nil, err
@@ -100,7 +188,22 @@ func (p *Path) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (p *Path) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ spec.Extensions
+ PathProps
+ }
+ x.Ref = p.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(p.Extensions)
+ x.PathProps = p.PathProps
+ return opts.MarshalNext(enc, x)
+}
+
func (p *Path) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, p)
+ }
if err := json.Unmarshal(data, &p.Refable); err != nil {
return err
}
@@ -113,6 +216,24 @@ func (p *Path) UnmarshalJSON(data []byte) error {
return nil
}
+func (p *Path) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ PathProps
+ }
+
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := internal.JSONRefFromMap(&p.Ref.Ref, x.Extensions); err != nil {
+ return err
+ }
+ p.Extensions = internal.SanitizeExtensions(x.Extensions)
+ p.PathProps = x.PathProps
+
+ return nil
+}
+
// PathProps describes the operations available on a single path, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathItemObject
type PathProps struct {
// Summary holds a summary for all operations in this path
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/request_body.go b/vendor/k8s.io/kube-openapi/pkg/spec3/request_body.go
index 0adc62826..6f8607e40 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/request_body.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/request_body.go
@@ -19,8 +19,10 @@ package spec3
import (
"encoding/json"
- "k8s.io/kube-openapi/pkg/validation/spec"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
// RequestBody describes a single request body, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#requestBodyObject
@@ -34,6 +36,9 @@ type RequestBody struct {
// MarshalJSON is a custom marshal function that knows how to encode RequestBody as JSON
func (r *RequestBody) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(r)
+ }
b1, err := json.Marshal(r.Refable)
if err != nil {
return nil, err
@@ -49,7 +54,22 @@ func (r *RequestBody) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (r *RequestBody) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ RequestBodyProps requestBodyPropsOmitZero `json:",inline"`
+ spec.Extensions
+ }
+ x.Ref = r.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(r.Extensions)
+ x.RequestBodyProps = requestBodyPropsOmitZero(r.RequestBodyProps)
+ return opts.MarshalNext(enc, x)
+}
+
func (r *RequestBody) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, r)
+ }
if err := json.Unmarshal(data, &r.Refable); err != nil {
return err
}
@@ -71,3 +91,25 @@ type RequestBodyProps struct {
// Required determines if the request body is required in the request
Required bool `json:"required,omitempty"`
}
+
+type requestBodyPropsOmitZero struct {
+ Description string `json:"description,omitempty"`
+ Content map[string]*MediaType `json:"content,omitempty"`
+ Required bool `json:"required,omitzero"`
+}
+
+func (r *RequestBody) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ RequestBodyProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := internal.JSONRefFromMap(&r.Ref.Ref, x.Extensions); err != nil {
+ return err
+ }
+ r.Extensions = internal.SanitizeExtensions(x.Extensions)
+ r.RequestBodyProps = x.RequestBodyProps
+ return nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/response.go b/vendor/k8s.io/kube-openapi/pkg/spec3/response.go
index ccd73369f..73e241fdc 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/response.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/response.go
@@ -18,10 +18,13 @@ package spec3
import (
"encoding/json"
+ "fmt"
"strconv"
- "k8s.io/kube-openapi/pkg/validation/spec"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
// Responses holds the list of possible responses as they are returned from executing this operation
@@ -34,6 +37,9 @@ type Responses struct {
// MarshalJSON is a custom marshal function that knows how to encode Responses as JSON
func (r *Responses) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(r)
+ }
b1, err := json.Marshal(r.ResponsesProps)
if err != nil {
return nil, err
@@ -45,14 +51,35 @@ func (r *Responses) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (r Responses) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ type ArbitraryKeys map[string]interface{}
+ var x struct {
+ ArbitraryKeys
+ Default *Response `json:"default,omitzero"`
+ }
+ x.ArbitraryKeys = make(map[string]any, len(r.Extensions)+len(r.StatusCodeResponses))
+ for k, v := range r.Extensions {
+ if internal.IsExtensionKey(k) {
+ x.ArbitraryKeys[k] = v
+ }
+ }
+ for k, v := range r.StatusCodeResponses {
+ x.ArbitraryKeys[strconv.Itoa(k)] = v
+ }
+ x.Default = r.Default
+ return opts.MarshalNext(enc, x)
+}
+
func (r *Responses) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, r)
+ }
if err := json.Unmarshal(data, &r.ResponsesProps); err != nil {
return err
}
if err := json.Unmarshal(data, &r.VendorExtensible); err != nil {
return err
}
-
return nil
}
@@ -78,25 +105,91 @@ func (r ResponsesProps) MarshalJSON() ([]byte, error) {
// UnmarshalJSON unmarshals responses from JSON
func (r *ResponsesProps) UnmarshalJSON(data []byte) error {
- var res map[string]*Response
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, r)
+ }
+ var res map[string]json.RawMessage
if err := json.Unmarshal(data, &res); err != nil {
- return nil
+ return err
}
if v, ok := res["default"]; ok {
- r.Default = v
+ value := Response{}
+ if err := json.Unmarshal(v, &value); err != nil {
+ return err
+ }
+ r.Default = &value
delete(res, "default")
}
for k, v := range res {
+ // Take all integral keys
if nk, err := strconv.Atoi(k); err == nil {
if r.StatusCodeResponses == nil {
r.StatusCodeResponses = map[int]*Response{}
}
- r.StatusCodeResponses[nk] = v
+ value := Response{}
+ if err := json.Unmarshal(v, &value); err != nil {
+ return err
+ }
+ r.StatusCodeResponses[nk] = &value
}
}
return nil
}
+func (r *Responses) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) (err error) {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ switch k := tok.Kind(); k {
+ case 'n':
+ *r = Responses{}
+ return nil
+ case '{':
+ for {
+ tok, err := dec.ReadToken()
+ if err != nil {
+ return err
+ }
+ if tok.Kind() == '}' {
+ return nil
+ }
+ switch k := tok.String(); {
+ case internal.IsExtensionKey(k):
+ var ext any
+ if err := opts.UnmarshalNext(dec, &ext); err != nil {
+ return err
+ }
+
+ if r.Extensions == nil {
+ r.Extensions = make(map[string]any)
+ }
+ r.Extensions[k] = ext
+ case k == "default":
+ resp := Response{}
+ if err := opts.UnmarshalNext(dec, &resp); err != nil {
+ return err
+ }
+ r.ResponsesProps.Default = &resp
+ default:
+ if nk, err := strconv.Atoi(k); err == nil {
+ resp := Response{}
+ if err := opts.UnmarshalNext(dec, &resp); err != nil {
+ return err
+ }
+
+ if r.StatusCodeResponses == nil {
+ r.StatusCodeResponses = map[int]*Response{}
+ }
+ r.StatusCodeResponses[nk] = &resp
+ }
+ }
+ }
+ default:
+ return fmt.Errorf("unknown JSON kind: %v", k)
+ }
+}
+
// Response describes a single response from an API Operation, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject
//
// Note that this struct is actually a thin wrapper around ResponseProps to make it referable and extensible
@@ -108,6 +201,9 @@ type Response struct {
// MarshalJSON is a custom marshal function that knows how to encode Response as JSON
func (r *Response) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(r)
+ }
b1, err := json.Marshal(r.Refable)
if err != nil {
return nil, err
@@ -123,7 +219,22 @@ func (r *Response) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (r Response) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ spec.Extensions
+ ResponseProps `json:",inline"`
+ }
+ x.Ref = r.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(r.Extensions)
+ x.ResponseProps = r.ResponseProps
+ return opts.MarshalNext(enc, x)
+}
+
func (r *Response) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, r)
+ }
if err := json.Unmarshal(data, &r.Refable); err != nil {
return err
}
@@ -133,7 +244,22 @@ func (r *Response) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &r.VendorExtensible); err != nil {
return err
}
+ return nil
+}
+func (r *Response) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ ResponseProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := internal.JSONRefFromMap(&r.Ref.Ref, x.Extensions); err != nil {
+ return err
+ }
+ r.Extensions = internal.SanitizeExtensions(x.Extensions)
+ r.ResponseProps = x.ResponseProps
return nil
}
@@ -149,7 +275,6 @@ type ResponseProps struct {
Links map[string]*Link `json:"links,omitempty"`
}
-
// Link represents a possible design-time link for a response, more at https://swagger.io/specification/#link-object
type Link struct {
spec.Refable
@@ -159,6 +284,9 @@ type Link struct {
// MarshalJSON is a custom marshal function that knows how to encode Link as JSON
func (r *Link) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(r)
+ }
b1, err := json.Marshal(r.Refable)
if err != nil {
return nil, err
@@ -174,7 +302,22 @@ func (r *Link) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (r *Link) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ spec.Extensions
+ LinkProps `json:",inline"`
+ }
+ x.Ref = r.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(r.Extensions)
+ x.LinkProps = r.LinkProps
+ return opts.MarshalNext(enc, x)
+}
+
func (r *Link) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, r)
+ }
if err := json.Unmarshal(data, &r.Refable); err != nil {
return err
}
@@ -188,6 +331,22 @@ func (r *Link) UnmarshalJSON(data []byte) error {
return nil
}
+func (l *Link) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ LinkProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ if err := internal.JSONRefFromMap(&l.Ref.Ref, x.Extensions); err != nil {
+ return err
+ }
+ l.Extensions = internal.SanitizeExtensions(x.Extensions)
+ l.LinkProps = x.LinkProps
+ return nil
+}
+
// LinkProps describes a single response from an API Operation, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject
type LinkProps struct {
// OperationId is the name of an existing, resolvable OAS operation
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/security_requirement.go b/vendor/k8s.io/kube-openapi/pkg/spec3/security_requirement.go
deleted file mode 100644
index 0ce8924ef..000000000
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/security_requirement.go
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright 2021 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package spec3
-
-import (
- "encoding/json"
-
- "k8s.io/kube-openapi/pkg/validation/spec"
- "github.com/go-openapi/swag"
-)
-
-// SecurityRequirementProps describes the required security schemes to execute an operation, more at https://swagger.io/specification/#security-requirement-object
-//
-// Note that this struct is actually a thin wrapper around SecurityRequirementProps to make it referable and extensible
-type SecurityRequirement struct {
- SecurityRequirementProps
- spec.VendorExtensible
-}
-
-// MarshalJSON is a custom marshal function that knows how to encode SecurityRequirement as JSON
-func (s *SecurityRequirement) MarshalJSON() ([]byte, error) {
- b1, err := json.Marshal(s.SecurityRequirementProps)
- if err != nil {
- return nil, err
- }
- b2, err := json.Marshal(s.VendorExtensible)
- if err != nil {
- return nil, err
- }
- return swag.ConcatJSON(b1, b2), nil
-}
-
-// UnmarshalJSON hydrates this items instance with the data from JSON
-func (s *SecurityRequirement) UnmarshalJSON(data []byte) error {
- if err := json.Unmarshal(data, &s.SecurityRequirementProps); err != nil {
- return err
- }
- return json.Unmarshal(data, &s.VendorExtensible)
-}
-
-// SecurityRequirementProps describes the required security schemes to execute an operation, more at https://swagger.io/specification/#security-requirement-object
-type SecurityRequirementProps map[string][]string
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/security_scheme.go b/vendor/k8s.io/kube-openapi/pkg/spec3/security_scheme.go
index 9b1352f4e..dd1e98ed8 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/security_scheme.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/security_scheme.go
@@ -19,8 +19,10 @@ package spec3
import (
"encoding/json"
- "k8s.io/kube-openapi/pkg/validation/spec"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
// SecurityScheme defines reusable Security Scheme Object, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#securitySchemeObject
@@ -32,6 +34,9 @@ type SecurityScheme struct {
// MarshalJSON is a custom marshal function that knows how to encode SecurityScheme as JSON
func (s *SecurityScheme) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(s)
+ }
b1, err := json.Marshal(s.SecuritySchemeProps)
if err != nil {
return nil, err
@@ -47,6 +52,18 @@ func (s *SecurityScheme) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (s *SecurityScheme) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ SecuritySchemeProps `json:",inline"`
+ spec.Extensions
+ }
+ x.Ref = s.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(s.Extensions)
+ x.SecuritySchemeProps = s.SecuritySchemeProps
+ return opts.MarshalNext(enc, x)
+}
+
// UnmarshalJSON hydrates this items instance with the data from JSON
func (s *SecurityScheme) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &s.SecuritySchemeProps); err != nil {
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/server.go b/vendor/k8s.io/kube-openapi/pkg/spec3/server.go
index a505fb221..654a42c06 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/server.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/server.go
@@ -18,9 +18,11 @@ package spec3
import (
"encoding/json"
- "k8s.io/kube-openapi/pkg/validation/spec"
- "github.com/go-openapi/swag"
+ "github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
+ "k8s.io/kube-openapi/pkg/validation/spec"
)
type Server struct {
@@ -39,6 +41,9 @@ type ServerProps struct {
// MarshalJSON is a custom marshal function that knows how to encode Responses as JSON
func (s *Server) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(s)
+ }
b1, err := json.Marshal(s.ServerProps)
if err != nil {
return nil, err
@@ -50,7 +55,21 @@ func (s *Server) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (s *Server) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ ServerProps `json:",inline"`
+ spec.Extensions
+ }
+ x.Extensions = internal.SanitizeExtensions(s.Extensions)
+ x.ServerProps = s.ServerProps
+ return opts.MarshalNext(enc, x)
+}
+
func (s *Server) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, s)
+ }
+
if err := json.Unmarshal(data, &s.ServerProps); err != nil {
return err
}
@@ -60,6 +79,20 @@ func (s *Server) UnmarshalJSON(data []byte) error {
return nil
}
+func (s *Server) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ ServerProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ s.Extensions = internal.SanitizeExtensions(x.Extensions)
+ s.ServerProps = x.ServerProps
+
+ return nil
+}
+
type ServerVariable struct {
ServerVariableProps
spec.VendorExtensible
@@ -76,6 +109,9 @@ type ServerVariableProps struct {
// MarshalJSON is a custom marshal function that knows how to encode Responses as JSON
func (s *ServerVariable) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(s)
+ }
b1, err := json.Marshal(s.ServerVariableProps)
if err != nil {
return nil, err
@@ -87,7 +123,20 @@ func (s *ServerVariable) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (s *ServerVariable) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ ServerVariableProps `json:",inline"`
+ spec.Extensions
+ }
+ x.Extensions = internal.SanitizeExtensions(s.Extensions)
+ x.ServerVariableProps = s.ServerVariableProps
+ return opts.MarshalNext(enc, x)
+}
+
func (s *ServerVariable) UnmarshalJSON(data []byte) error {
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, s)
+ }
if err := json.Unmarshal(data, &s.ServerVariableProps); err != nil {
return err
}
@@ -96,3 +145,17 @@ func (s *ServerVariable) UnmarshalJSON(data []byte) error {
}
return nil
}
+
+func (s *ServerVariable) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error {
+ var x struct {
+ spec.Extensions
+ ServerVariableProps
+ }
+ if err := opts.UnmarshalNext(dec, &x); err != nil {
+ return err
+ }
+ s.Extensions = internal.SanitizeExtensions(x.Extensions)
+ s.ServerVariableProps = x.ServerVariableProps
+
+ return nil
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/spec3/spec.go b/vendor/k8s.io/kube-openapi/pkg/spec3/spec.go
index 3ff48a3c3..5db819c7f 100644
--- a/vendor/k8s.io/kube-openapi/pkg/spec3/spec.go
+++ b/vendor/k8s.io/kube-openapi/pkg/spec3/spec.go
@@ -17,6 +17,10 @@ limitations under the License.
package spec3
import (
+ "encoding/json"
+
+ "k8s.io/kube-openapi/pkg/internal"
+ jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
"k8s.io/kube-openapi/pkg/validation/spec"
)
@@ -32,6 +36,40 @@ type OpenAPI struct {
Servers []*Server `json:"servers,omitempty"`
// Components hold various schemas for the specification
Components *Components `json:"components,omitempty"`
+ // SecurityRequirement holds a declaration of which security mechanisms can be used across the API
+ SecurityRequirement []map[string][]string `json:"security,omitempty"`
// ExternalDocs holds additional external documentation
ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
}
+
+func (o *OpenAPI) UnmarshalJSON(data []byte) error {
+ type OpenAPIWithNoFunctions OpenAPI
+ p := (*OpenAPIWithNoFunctions)(o)
+ if internal.UseOptimizedJSONUnmarshalingV3 {
+ return jsonv2.Unmarshal(data, &p)
+ }
+ return json.Unmarshal(data, &p)
+}
+
+func (o *OpenAPI) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshalingV3 {
+ return internal.DeterministicMarshal(o)
+ }
+ type OpenAPIWithNoFunctions OpenAPI
+ p := (*OpenAPIWithNoFunctions)(o)
+ return json.Marshal(&p)
+}
+
+func (o *OpenAPI) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ type OpenAPIOmitZero struct {
+ Version string `json:"openapi"`
+ Info *spec.Info `json:"info"`
+ Paths *Paths `json:"paths,omitzero"`
+ Servers []*Server `json:"servers,omitempty"`
+ Components *Components `json:"components,omitzero"`
+ SecurityRequirement []map[string][]string `json:"security,omitempty"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitzero"`
+ }
+ x := (*OpenAPIOmitZero)(o)
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go
index 763923dff..5789e67ab 100644
--- a/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go
+++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/document.go
@@ -21,7 +21,7 @@ import (
"sort"
"strings"
- openapi_v2 "github.com/google/gnostic/openapiv2"
+ openapi_v2 "github.com/google/gnostic-models/openapiv2"
"gopkg.in/yaml.v2"
)
diff --git a/vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go b/vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go
index a3f476d5d..d9f2896e3 100644
--- a/vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go
+++ b/vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go
@@ -21,7 +21,7 @@ import (
"reflect"
"strings"
- openapi_v3 "github.com/google/gnostic/openapiv3"
+ openapi_v3 "github.com/google/gnostic-models/openapiv3"
"gopkg.in/yaml.v3"
)
@@ -120,7 +120,7 @@ func (d *Definitions) ParseSchemaV3(s *openapi_v3.Schema, path *Path) (Schema, e
switch s.GetType() {
case object:
for _, extension := range s.GetSpecificationExtension() {
- if extension.Name == "x-kuberentes-group-version-kind" {
+ if extension.Name == "x-kubernetes-group-version-kind" {
// Objects with x-kubernetes-group-version-kind are always top
// level types.
return d.parseV3Kind(s, path)
@@ -285,7 +285,7 @@ func parseV3Interface(def *yaml.Node) (interface{}, error) {
func (d *Definitions) parseV3BaseSchema(s *openapi_v3.Schema, path *Path) (*BaseSchema, error) {
if s == nil {
- return nil, fmt.Errorf("cannot initializae BaseSchema from nil")
+ return nil, fmt.Errorf("cannot initialize BaseSchema from nil")
}
def, err := parseV3Interface(s.GetDefault().ToRawInfo())
diff --git a/vendor/k8s.io/kube-openapi/pkg/util/util.go b/vendor/k8s.io/kube-openapi/pkg/util/util.go
index 0be06989e..6eee935b2 100644
--- a/vendor/k8s.io/kube-openapi/pkg/util/util.go
+++ b/vendor/k8s.io/kube-openapi/pkg/util/util.go
@@ -30,6 +30,7 @@ import (
// in GetCanonicalTypeName means Go type names with full package path.
//
// Examples of REST friendly OpenAPI name:
+//
// Input: k8s.io/api/core/v1.Pod
// Output: io.k8s.api.core.v1.Pod
//
@@ -45,6 +46,7 @@ func ToCanonicalName(name string) string {
// ToRESTFriendlyName converts Golang package/type canonical name into REST friendly OpenAPI name.
//
// Examples of REST friendly OpenAPI name:
+//
// Input: k8s.io/api/core/v1.Pod
// Output: io.k8s.api.core.v1.Pod
//
@@ -71,18 +73,21 @@ func ToRESTFriendlyName(name string) string {
// OpenAPI canonical names are Go type names with full package path, for uniquely indentifying
// a model / Go type. If a Go type is vendored from another package, only the path after "/vendor/"
// should be used. For custom resource definition (CRD), the canonical name is expected to be
-// group/version.kind
+//
+// group/version.kind
//
// Examples of canonical name:
-// Go type: k8s.io/kubernetes/pkg/apis/core.Pod
-// CRD: csi.storage.k8s.io/v1alpha1.CSINodeInfo
+//
+// Go type: k8s.io/kubernetes/pkg/apis/core.Pod
+// CRD: csi.storage.k8s.io/v1alpha1.CSINodeInfo
//
// Example for vendored Go type:
-// Original full path: k8s.io/kubernetes/vendor/k8s.io/api/core/v1.Pod
-// Canonical name: k8s.io/api/core/v1.Pod
//
-// Original full path: vendor/k8s.io/api/core/v1.Pod
-// Canonical name: k8s.io/api/core/v1.Pod
+// Original full path: k8s.io/kubernetes/vendor/k8s.io/api/core/v1.Pod
+// Canonical name: k8s.io/api/core/v1.Pod
+//
+// Original full path: vendor/k8s.io/api/core/v1.Pod
+// Canonical name: k8s.io/api/core/v1.Pod
type OpenAPICanonicalTypeNamer interface {
OpenAPICanonicalTypeName() string
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/fuzz.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/fuzz.go
deleted file mode 100644
index c66f998f5..000000000
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/fuzz.go
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
-Copyright 2022 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package spec
-
-import (
- "github.com/go-openapi/jsonreference"
- "github.com/google/go-cmp/cmp"
- fuzz "github.com/google/gofuzz"
-)
-
-var SwaggerFuzzFuncs []interface{} = []interface{}{
- func(v *Responses, c fuzz.Continue) {
- c.FuzzNoCustom(v)
- if v.Default != nil {
- // Check if we hit maxDepth and left an incomplete value
- if v.Default.Description == "" {
- v.Default = nil
- v.StatusCodeResponses = nil
- }
- }
-
- // conversion has no way to discern empty statusCodeResponses from
- // nil, since "default" is always included in the map.
- // So avoid empty responses list
- if len(v.StatusCodeResponses) == 0 {
- v.StatusCodeResponses = nil
- }
- },
- func(v *Operation, c fuzz.Continue) {
- c.FuzzNoCustom(v)
-
- if v != nil {
- // force non-nil
- v.Responses = &Responses{}
- c.Fuzz(v.Responses)
-
- v.Schemes = nil
- if c.RandBool() {
- v.Schemes = append(v.Schemes, "http")
- }
-
- if c.RandBool() {
- v.Schemes = append(v.Schemes, "https")
- }
-
- if c.RandBool() {
- v.Schemes = append(v.Schemes, "ws")
- }
-
- if c.RandBool() {
- v.Schemes = append(v.Schemes, "wss")
- }
-
- // Gnostic unconditionally makes security values non-null
- // So do not fuzz null values into the array.
- for i, val := range v.Security {
- if val == nil {
- v.Security[i] = make(map[string][]string)
- }
-
- for k, v := range val {
- if v == nil {
- val[k] = make([]string, 0)
- }
- }
- }
- }
- },
- func(v map[int]Response, c fuzz.Continue) {
- n := 0
- c.Fuzz(&n)
- if n == 0 {
- // Test that fuzzer is not at maxDepth so we do not
- // end up with empty elements
- return
- }
-
- // Prevent negative numbers
- num := c.Intn(4)
- for i := 0; i < num+2; i++ {
- val := Response{}
- c.Fuzz(&val)
-
- val.Description = c.RandString() + "x"
- v[100*(i+1)+c.Intn(100)] = val
- }
- },
- func(v map[string]PathItem, c fuzz.Continue) {
- n := 0
- c.Fuzz(&n)
- if n == 0 {
- // Test that fuzzer is not at maxDepth so we do not
- // end up with empty elements
- return
- }
-
- num := c.Intn(5)
- for i := 0; i < num+2; i++ {
- val := PathItem{}
- c.Fuzz(&val)
-
- // Ref params are only allowed in certain locations, so
- // possibly add a few to PathItems
- numRefsToAdd := c.Intn(5)
- for i := 0; i < numRefsToAdd; i++ {
- theRef := Parameter{}
- c.Fuzz(&theRef.Refable)
-
- val.Parameters = append(val.Parameters, theRef)
- }
-
- v["/"+c.RandString()] = val
- }
- },
- func(v *SchemaOrArray, c fuzz.Continue) {
- *v = SchemaOrArray{}
- // gnostic parser just doesn't support more
- // than one Schema here
- v.Schema = &Schema{}
- c.Fuzz(&v.Schema)
-
- },
- func(v *SchemaOrBool, c fuzz.Continue) {
- *v = SchemaOrBool{}
-
- if c.RandBool() {
- v.Allows = c.RandBool()
- } else {
- v.Schema = &Schema{}
- v.Allows = true
- c.Fuzz(&v.Schema)
- }
- },
- func(v map[string]Response, c fuzz.Continue) {
- n := 0
- c.Fuzz(&n)
- if n == 0 {
- // Test that fuzzer is not at maxDepth so we do not
- // end up with empty elements
- return
- }
-
- // Response definitions are not allowed to
- // be refs
- for i := 0; i < c.Intn(5)+1; i++ {
- resp := &Response{}
-
- c.Fuzz(resp)
- resp.Ref = Ref{}
- resp.Description = c.RandString() + "x"
-
- // Response refs are not vendor extensible by gnostic
- resp.VendorExtensible.Extensions = nil
- v[c.RandString()+"x"] = *resp
- }
- },
- func(v *Header, c fuzz.Continue) {
- if v != nil {
- c.FuzzNoCustom(v)
-
- // descendant Items of Header may not be refs
- cur := v.Items
- for cur != nil {
- cur.Ref = Ref{}
- cur = cur.Items
- }
- }
- },
- func(v *Ref, c fuzz.Continue) {
- *v = Ref{}
- v.Ref, _ = jsonreference.New("http://asd.com/" + c.RandString())
- },
- func(v *Response, c fuzz.Continue) {
- *v = Response{}
- if c.RandBool() {
- v.Ref = Ref{}
- v.Ref.Ref, _ = jsonreference.New("http://asd.com/" + c.RandString())
- } else {
- c.Fuzz(&v.VendorExtensible)
- c.Fuzz(&v.Schema)
- c.Fuzz(&v.ResponseProps)
-
- v.Headers = nil
- v.Ref = Ref{}
-
- n := 0
- c.Fuzz(&n)
- if n != 0 {
- // Test that fuzzer is not at maxDepth so we do not
- // end up with empty elements
- num := c.Intn(4)
- for i := 0; i < num; i++ {
- if v.Headers == nil {
- v.Headers = make(map[string]Header)
- }
- hdr := Header{}
- c.Fuzz(&hdr)
- if hdr.Type == "" {
- // hit maxDepth, just abort trying to make haders
- v.Headers = nil
- break
- }
- v.Headers[c.RandString()+"x"] = hdr
- }
- } else {
- v.Headers = nil
- }
- }
-
- v.Description = c.RandString() + "x"
-
- // Gnostic parses empty as nil, so to keep avoid putting empty
- if len(v.Headers) == 0 {
- v.Headers = nil
- }
- },
- func(v **Info, c fuzz.Continue) {
- // Info is never nil
- *v = &Info{}
- c.FuzzNoCustom(*v)
-
- (*v).Title = c.RandString() + "x"
- },
- func(v *Extensions, c fuzz.Continue) {
- // gnostic parser only picks up x- vendor extensions
- numChildren := c.Intn(5)
- for i := 0; i < numChildren; i++ {
- if *v == nil {
- *v = Extensions{}
- }
- (*v)["x-"+c.RandString()] = c.RandString()
- }
- },
- func(v *Swagger, c fuzz.Continue) {
- c.FuzzNoCustom(v)
-
- if v.Paths == nil {
- // Force paths non-nil since it does not have omitempty in json tag.
- // This means a perfect roundtrip (via json) is impossible,
- // since we can't tell the difference between empty/unspecified paths
- v.Paths = &Paths{}
- c.Fuzz(v.Paths)
- }
-
- v.Swagger = "2.0"
-
- // Gnostic support serializing ID at all
- // unavoidable data loss
- v.ID = ""
-
- v.Schemes = nil
- if c.RandUint64()%2 == 1 {
- v.Schemes = append(v.Schemes, "http")
- }
-
- if c.RandUint64()%2 == 1 {
- v.Schemes = append(v.Schemes, "https")
- }
-
- if c.RandUint64()%2 == 1 {
- v.Schemes = append(v.Schemes, "ws")
- }
-
- if c.RandUint64()%2 == 1 {
- v.Schemes = append(v.Schemes, "wss")
- }
-
- // Gnostic unconditionally makes security values non-null
- // So do not fuzz null values into the array.
- for i, val := range v.Security {
- if val == nil {
- v.Security[i] = make(map[string][]string)
- }
-
- for k, v := range val {
- if v == nil {
- val[k] = make([]string, 0)
- }
- }
- }
- },
- func(v *SecurityScheme, c fuzz.Continue) {
- v.Description = c.RandString() + "x"
- c.Fuzz(&v.VendorExtensible)
-
- switch c.Intn(3) {
- case 0:
- v.Type = "basic"
- case 1:
- v.Type = "apiKey"
- switch c.Intn(2) {
- case 0:
- v.In = "header"
- case 1:
- v.In = "query"
- default:
- panic("unreachable")
- }
- v.Name = "x" + c.RandString()
- case 2:
- v.Type = "oauth2"
-
- switch c.Intn(4) {
- case 0:
- v.Flow = "accessCode"
- v.TokenURL = "https://" + c.RandString()
- v.AuthorizationURL = "https://" + c.RandString()
- case 1:
- v.Flow = "application"
- v.TokenURL = "https://" + c.RandString()
- case 2:
- v.Flow = "implicit"
- v.AuthorizationURL = "https://" + c.RandString()
- case 3:
- v.Flow = "password"
- v.TokenURL = "https://" + c.RandString()
- default:
- panic("unreachable")
- }
- c.Fuzz(&v.Scopes)
- default:
- panic("unreachable")
- }
- },
- func(v *interface{}, c fuzz.Continue) {
- *v = c.RandString() + "x"
- },
- func(v *string, c fuzz.Continue) {
- *v = c.RandString() + "x"
- },
- func(v *ExternalDocumentation, c fuzz.Continue) {
- v.Description = c.RandString() + "x"
- v.URL = c.RandString() + "x"
- },
- func(v *SimpleSchema, c fuzz.Continue) {
- c.FuzzNoCustom(v)
-
- switch c.Intn(5) {
- case 0:
- v.Type = "string"
- case 1:
- v.Type = "number"
- case 2:
- v.Type = "boolean"
- case 3:
- v.Type = "integer"
- case 4:
- v.Type = "array"
- default:
- panic("unreachable")
- }
-
- switch c.Intn(5) {
- case 0:
- v.CollectionFormat = "csv"
- case 1:
- v.CollectionFormat = "ssv"
- case 2:
- v.CollectionFormat = "tsv"
- case 3:
- v.CollectionFormat = "pipes"
- case 4:
- v.CollectionFormat = ""
- default:
- panic("unreachable")
- }
-
- // None of the types which include SimpleSchema in our definitions
- // actually support "example" in the official spec
- v.Example = nil
-
- // unsupported by openapi
- v.Nullable = false
- },
- func(v *int64, c fuzz.Continue) {
- c.Fuzz(v)
-
- // Gnostic does not differentiate between 0 and non-specified
- // so avoid using 0 for fuzzer
- if *v == 0 {
- *v = 1
- }
- },
- func(v *float64, c fuzz.Continue) {
- c.Fuzz(v)
-
- // Gnostic does not differentiate between 0 and non-specified
- // so avoid using 0 for fuzzer
- if *v == 0.0 {
- *v = 1.0
- }
- },
- func(v *Parameter, c fuzz.Continue) {
- if v == nil {
- return
- }
- c.Fuzz(&v.VendorExtensible)
- if c.RandBool() {
- // body param
- v.Description = c.RandString() + "x"
- v.Name = c.RandString() + "x"
- v.In = "body"
- c.Fuzz(&v.Description)
- c.Fuzz(&v.Required)
-
- v.Schema = &Schema{}
- c.Fuzz(&v.Schema)
-
- } else {
- c.Fuzz(&v.SimpleSchema)
- c.Fuzz(&v.CommonValidations)
- v.AllowEmptyValue = false
- v.Description = c.RandString() + "x"
- v.Name = c.RandString() + "x"
-
- switch c.Intn(4) {
- case 0:
- // Header param
- v.In = "header"
- case 1:
- // Form data param
- v.In = "formData"
- v.AllowEmptyValue = c.RandBool()
- case 2:
- // Query param
- v.In = "query"
- v.AllowEmptyValue = c.RandBool()
- case 3:
- // Path param
- v.In = "path"
- v.Required = true
- default:
- panic("unreachable")
- }
-
- // descendant Items of Parameter may not be refs
- cur := v.Items
- for cur != nil {
- cur.Ref = Ref{}
- cur = cur.Items
- }
- }
- },
- func(v *Schema, c fuzz.Continue) {
- if c.RandBool() {
- // file schema
- c.Fuzz(&v.Default)
- c.Fuzz(&v.Description)
- c.Fuzz(&v.Example)
- c.Fuzz(&v.ExternalDocs)
-
- c.Fuzz(&v.Format)
- c.Fuzz(&v.ReadOnly)
- c.Fuzz(&v.Required)
- c.Fuzz(&v.Title)
- v.Type = StringOrArray{"file"}
-
- } else {
- // normal schema
- c.Fuzz(&v.SchemaProps)
- c.Fuzz(&v.SwaggerSchemaProps)
- c.Fuzz(&v.VendorExtensible)
- // c.Fuzz(&v.ExtraProps)
- // ExtraProps will not roundtrip - gnostic throws out
- // unrecognized keys
- }
-
- // Not supported by official openapi v2 spec
- // and stripped by k8s apiserver
- v.ID = ""
- v.AnyOf = nil
- v.OneOf = nil
- v.Not = nil
- v.Nullable = false
- v.AdditionalItems = nil
- v.Schema = ""
- v.PatternProperties = nil
- v.Definitions = nil
- v.Dependencies = nil
- },
-}
-
-var SwaggerDiffOptions = []cmp.Option{
- // cmp.Diff panics on Ref since jsonreference.Ref uses unexported fields
- cmp.Comparer(func(a Ref, b Ref) bool {
- return a.String() == b.String()
- }),
-}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go
index 406a09d9d..6a77f2ac8 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go
@@ -21,7 +21,7 @@ import (
"strconv"
"github.com/go-openapi/jsonreference"
- openapi_v2 "github.com/google/gnostic/openapiv2"
+ openapi_v2 "github.com/google/gnostic-models/openapiv2"
)
// Interfaces
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go
index 9a2556306..05310c46b 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go
@@ -43,6 +43,9 @@ type Header struct {
// MarshalJSON marshal this to JSON
func (h Header) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(h)
+ }
b1, err := json.Marshal(h.CommonValidations)
if err != nil {
return nil, err
@@ -62,6 +65,20 @@ func (h Header) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3, b4), nil
}
+func (h Header) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ CommonValidations commonValidationsOmitZero `json:",inline"`
+ SimpleSchema simpleSchemaOmitZero `json:",inline"`
+ Extensions
+ HeaderProps
+ }
+ x.CommonValidations = commonValidationsOmitZero(h.CommonValidations)
+ x.SimpleSchema = simpleSchemaOmitZero(h.SimpleSchema)
+ x.Extensions = internal.SanitizeExtensions(h.Extensions)
+ x.HeaderProps = h.HeaderProps
+ return opts.MarshalNext(enc, x)
+}
+
// UnmarshalJSON unmarshals this header from JSON
func (h *Header) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
@@ -94,12 +111,8 @@ func (h *Header) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Dec
h.CommonValidations = x.CommonValidations
h.SimpleSchema = x.SimpleSchema
- h.Extensions = x.Extensions
+ h.Extensions = internal.SanitizeExtensions(x.Extensions)
h.HeaderProps = x.HeaderProps
- h.Extensions.sanitize()
- if len(h.Extensions) == 0 {
- h.Extensions = nil
- }
return nil
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go
index 395ececae..d667b705b 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go
@@ -89,17 +89,9 @@ func (e Extensions) GetObject(key string, out interface{}) error {
return nil
}
-func (e Extensions) sanitize() {
- for k := range e {
- if !isExtensionKey(k) {
- delete(e, k)
- }
- }
-}
-
func (e Extensions) sanitizeWithExtra() (extra map[string]any) {
for k, v := range e {
- if !isExtensionKey(k) {
+ if !internal.IsExtensionKey(k) {
if extra == nil {
extra = make(map[string]any)
}
@@ -110,10 +102,6 @@ func (e Extensions) sanitizeWithExtra() (extra map[string]any) {
return extra
}
-func isExtensionKey(k string) bool {
- return len(k) > 1 && (k[0] == 'x' || k[0] == 'X') && k[1] == '-'
-}
-
// VendorExtensible composition block.
type VendorExtensible struct {
Extensions Extensions
@@ -181,6 +169,9 @@ type Info struct {
// MarshalJSON marshal this to JSON
func (i Info) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(i)
+ }
b1, err := json.Marshal(i.InfoProps)
if err != nil {
return nil, err
@@ -192,6 +183,16 @@ func (i Info) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (i Info) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ InfoProps
+ }
+ x.Extensions = i.Extensions
+ x.InfoProps = i.InfoProps
+ return opts.MarshalNext(enc, x)
+}
+
// UnmarshalJSON marshal this from JSON
func (i *Info) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
@@ -212,11 +213,7 @@ func (i *Info) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decod
if err := opts.UnmarshalNext(dec, &x); err != nil {
return err
}
- x.Extensions.sanitize()
- if len(x.Extensions) == 0 {
- x.Extensions = nil
- }
- i.VendorExtensible.Extensions = x.Extensions
+ i.Extensions = internal.SanitizeExtensions(x.Extensions)
i.InfoProps = x.InfoProps
return nil
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go
index 374f90d28..4132467d2 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go
@@ -37,6 +37,18 @@ type SimpleSchema struct {
Example interface{} `json:"example,omitempty"`
}
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type simpleSchemaOmitZero struct {
+ Type string `json:"type,omitempty"`
+ Nullable bool `json:"nullable,omitzero"`
+ Format string `json:"format,omitempty"`
+ Items *Items `json:"items,omitzero"`
+ CollectionFormat string `json:"collectionFormat,omitempty"`
+ Default interface{} `json:"default,omitempty"`
+ Example interface{} `json:"example,omitempty"`
+}
+
// CommonValidations describe common JSON-schema validations
type CommonValidations struct {
Maximum *float64 `json:"maximum,omitempty"`
@@ -53,6 +65,23 @@ type CommonValidations struct {
Enum []interface{} `json:"enum,omitempty"`
}
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type commonValidationsOmitZero struct {
+ Maximum *float64 `json:"maximum,omitempty"`
+ ExclusiveMaximum bool `json:"exclusiveMaximum,omitzero"`
+ Minimum *float64 `json:"minimum,omitempty"`
+ ExclusiveMinimum bool `json:"exclusiveMinimum,omitzero"`
+ MaxLength *int64 `json:"maxLength,omitempty"`
+ MinLength *int64 `json:"minLength,omitempty"`
+ Pattern string `json:"pattern,omitempty"`
+ MaxItems *int64 `json:"maxItems,omitempty"`
+ MinItems *int64 `json:"minItems,omitempty"`
+ UniqueItems bool `json:"uniqueItems,omitzero"`
+ MultipleOf *float64 `json:"multipleOf,omitempty"`
+ Enum []interface{} `json:"enum,omitempty"`
+}
+
// Items a limited subset of JSON-Schema's items object.
// It is used by parameter definitions that are not located in "body".
//
@@ -105,18 +134,18 @@ func (i *Items) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Deco
if err := i.Refable.Ref.fromMap(x.Extensions); err != nil {
return err
}
- x.Extensions.sanitize()
- if len(x.Extensions) == 0 {
- x.Extensions = nil
- }
+
i.CommonValidations = x.CommonValidations
i.SimpleSchema = x.SimpleSchema
- i.VendorExtensible.Extensions = x.Extensions
+ i.Extensions = internal.SanitizeExtensions(x.Extensions)
return nil
}
// MarshalJSON converts this items object to JSON
func (i Items) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(i)
+ }
b1, err := json.Marshal(i.CommonValidations)
if err != nil {
return nil, err
@@ -135,3 +164,17 @@ func (i Items) MarshalJSON() ([]byte, error) {
}
return swag.ConcatJSON(b4, b3, b1, b2), nil
}
+
+func (i Items) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ CommonValidations commonValidationsOmitZero `json:",inline"`
+ SimpleSchema simpleSchemaOmitZero `json:",inline"`
+ Ref string `json:"$ref,omitempty"`
+ Extensions
+ }
+ x.CommonValidations = commonValidationsOmitZero(i.CommonValidations)
+ x.SimpleSchema = simpleSchemaOmitZero(i.SimpleSchema)
+ x.Ref = i.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(i.Extensions)
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go
index 923769ae0..63eed3460 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go
@@ -42,6 +42,23 @@ type OperationProps struct {
Responses *Responses `json:"responses,omitempty"`
}
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type operationPropsOmitZero struct {
+ Description string `json:"description,omitempty"`
+ Consumes []string `json:"consumes,omitempty"`
+ Produces []string `json:"produces,omitempty"`
+ Schemes []string `json:"schemes,omitempty"`
+ Tags []string `json:"tags,omitempty"`
+ Summary string `json:"summary,omitempty"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitzero"`
+ ID string `json:"operationId,omitempty"`
+ Deprecated bool `json:"deprecated,omitempty,omitzero"`
+ Security []map[string][]string `json:"security,omitempty"`
+ Parameters []Parameter `json:"parameters,omitempty"`
+ Responses *Responses `json:"responses,omitzero"`
+}
+
// MarshalJSON takes care of serializing operation properties to JSON
//
// We use a custom marhaller here to handle a special cases related to
@@ -96,17 +113,16 @@ func (o *Operation) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.
if err := opts.UnmarshalNext(dec, &x); err != nil {
return err
}
- x.Extensions.sanitize()
- if len(x.Extensions) == 0 {
- x.Extensions = nil
- }
- o.VendorExtensible.Extensions = x.Extensions
+ o.Extensions = internal.SanitizeExtensions(x.Extensions)
o.OperationProps = OperationProps(x.OperationPropsNoMethods)
return nil
}
// MarshalJSON converts this items object to JSON
func (o Operation) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(o)
+ }
b1, err := json.Marshal(o.OperationProps)
if err != nil {
return nil, err
@@ -118,3 +134,13 @@ func (o Operation) MarshalJSON() ([]byte, error) {
concated := swag.ConcatJSON(b1, b2)
return concated, nil
}
+
+func (o Operation) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ OperationProps operationPropsOmitZero `json:",inline"`
+ }
+ x.Extensions = internal.SanitizeExtensions(o.Extensions)
+ x.OperationProps = operationPropsOmitZero(o.OperationProps)
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go
index 7cb229ac1..53d1e0aa9 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go
@@ -36,6 +36,17 @@ type ParamProps struct {
AllowEmptyValue bool `json:"allowEmptyValue,omitempty"`
}
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type paramPropsOmitZero struct {
+ Description string `json:"description,omitempty"`
+ Name string `json:"name,omitempty"`
+ In string `json:"in,omitempty"`
+ Required bool `json:"required,omitzero"`
+ Schema *Schema `json:"schema,omitzero"`
+ AllowEmptyValue bool `json:"allowEmptyValue,omitzero"`
+}
+
// Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
//
// There are five possible parameter types.
@@ -109,19 +120,18 @@ func (p *Parameter) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.
if err := p.Refable.Ref.fromMap(x.Extensions); err != nil {
return err
}
- x.Extensions.sanitize()
- if len(x.Extensions) == 0 {
- x.Extensions = nil
- }
p.CommonValidations = x.CommonValidations
p.SimpleSchema = x.SimpleSchema
- p.VendorExtensible.Extensions = x.Extensions
+ p.Extensions = internal.SanitizeExtensions(x.Extensions)
p.ParamProps = x.ParamProps
return nil
}
// MarshalJSON converts this items object to JSON
func (p Parameter) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(p)
+ }
b1, err := json.Marshal(p.CommonValidations)
if err != nil {
return nil, err
@@ -144,3 +154,19 @@ func (p Parameter) MarshalJSON() ([]byte, error) {
}
return swag.ConcatJSON(b3, b1, b2, b4, b5), nil
}
+
+func (p Parameter) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ CommonValidations commonValidationsOmitZero `json:",inline"`
+ SimpleSchema simpleSchemaOmitZero `json:",inline"`
+ ParamProps paramPropsOmitZero `json:",inline"`
+ Ref string `json:"$ref,omitempty"`
+ Extensions
+ }
+ x.CommonValidations = commonValidationsOmitZero(p.CommonValidations)
+ x.SimpleSchema = simpleSchemaOmitZero(p.SimpleSchema)
+ x.Extensions = internal.SanitizeExtensions(p.Extensions)
+ x.ParamProps = paramPropsOmitZero(p.ParamProps)
+ x.Ref = p.Refable.Ref.String()
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go
index 03741fcfb..1d1588cb9 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go
@@ -70,24 +70,20 @@ func (p *PathItem) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.D
if err := opts.UnmarshalNext(dec, &x); err != nil {
return err
}
-
- p.Extensions = x.Extensions
- p.PathItemProps = x.PathItemProps
-
- if err := p.Refable.Ref.fromMap(p.Extensions); err != nil {
+ if err := p.Refable.Ref.fromMap(x.Extensions); err != nil {
return err
}
-
- p.Extensions.sanitize()
- if len(p.Extensions) == 0 {
- p.Extensions = nil
- }
+ p.Extensions = internal.SanitizeExtensions(x.Extensions)
+ p.PathItemProps = x.PathItemProps
return nil
}
// MarshalJSON converts this items object to JSON
func (p PathItem) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(p)
+ }
b3, err := json.Marshal(p.Refable)
if err != nil {
return nil, err
@@ -103,3 +99,15 @@ func (p PathItem) MarshalJSON() ([]byte, error) {
concated := swag.ConcatJSON(b3, b4, b5)
return concated, nil
}
+
+func (p PathItem) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ Extensions
+ PathItemProps
+ }
+ x.Ref = p.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(p.Extensions)
+ x.PathItemProps = p.PathItemProps
+ return opts.MarshalNext(enc, x)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go
index 7c63d440a..18f6a9f42 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go
@@ -92,7 +92,7 @@ func (p *Paths) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Deco
}
switch k := tok.String(); {
- case isExtensionKey(k):
+ case internal.IsExtensionKey(k):
ext = nil
if err := opts.UnmarshalNext(dec, &ext); err != nil {
return err
@@ -114,7 +114,9 @@ func (p *Paths) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Deco
p.Paths[k] = pi
default:
_, err := dec.ReadValue() // skip value
- return err
+ if err != nil {
+ return err
+ }
}
}
default:
@@ -124,6 +126,9 @@ func (p *Paths) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Deco
// MarshalJSON converts this items object to JSON
func (p Paths) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(p)
+ }
b1, err := json.Marshal(p.VendorExtensible)
if err != nil {
return nil, err
@@ -142,3 +147,18 @@ func (p Paths) MarshalJSON() ([]byte, error) {
concated := swag.ConcatJSON(b1, b2)
return concated, nil
}
+
+func (p Paths) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ m := make(map[string]any, len(p.Extensions)+len(p.Paths))
+ for k, v := range p.Extensions {
+ if internal.IsExtensionKey(k) {
+ m[k] = v
+ }
+ }
+ for k, v := range p.Paths {
+ if strings.HasPrefix(k, "/") {
+ m[k] = v
+ }
+ }
+ return opts.MarshalNext(enc, m)
+}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go
index 1405bfd8e..775b3b0c3 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go
@@ -21,6 +21,8 @@ import (
"path/filepath"
"github.com/go-openapi/jsonreference"
+
+ "k8s.io/kube-openapi/pkg/internal"
)
// Refable is a struct for things that accept a $ref property
@@ -149,19 +151,5 @@ func (r *Ref) UnmarshalJSON(d []byte) error {
}
func (r *Ref) fromMap(v map[string]interface{}) error {
- if v == nil {
- return nil
- }
-
- if vv, ok := v["$ref"]; ok {
- if str, ok := vv.(string); ok {
- ref, err := jsonreference.New(str)
- if err != nil {
- return err
- }
- *r = Ref{Ref: ref}
- }
- }
-
- return nil
+ return internal.JSONRefFromMap(&r.Ref, v)
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go
index f01364b75..3ff1fe132 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go
@@ -30,6 +30,15 @@ type ResponseProps struct {
Examples map[string]interface{} `json:"examples,omitempty"`
}
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type responsePropsOmitZero struct {
+ Description string `json:"description,omitempty"`
+ Schema *Schema `json:"schema,omitzero"`
+ Headers map[string]Header `json:"headers,omitempty"`
+ Examples map[string]interface{} `json:"examples,omitempty"`
+}
+
// Response describes a single response from an API Operation.
//
// For more information: http://goo.gl/8us55a#responseObject
@@ -68,23 +77,20 @@ func (r *Response) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.D
return err
}
- r.Extensions = x.Extensions
- r.ResponseProps = x.ResponseProps
-
- if err := r.Refable.Ref.fromMap(r.Extensions); err != nil {
+ if err := r.Refable.Ref.fromMap(x.Extensions); err != nil {
return err
}
-
- r.Extensions.sanitize()
- if len(r.Extensions) == 0 {
- r.Extensions = nil
- }
+ r.Extensions = internal.SanitizeExtensions(x.Extensions)
+ r.ResponseProps = x.ResponseProps
return nil
}
// MarshalJSON converts this items object to JSON
func (r Response) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(r)
+ }
b1, err := json.Marshal(r.ResponseProps)
if err != nil {
return nil, err
@@ -100,6 +106,18 @@ func (r Response) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3), nil
}
+func (r Response) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Ref string `json:"$ref,omitempty"`
+ Extensions
+ ResponseProps responsePropsOmitZero `json:",inline"`
+ }
+ x.Ref = r.Refable.Ref.String()
+ x.Extensions = internal.SanitizeExtensions(r.Extensions)
+ x.ResponseProps = responsePropsOmitZero(r.ResponseProps)
+ return opts.MarshalNext(enc, x)
+}
+
// NewResponse creates a new response instance
func NewResponse() *Response {
return new(Response)
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go
index c3fa68191..d9ad760a4 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go
@@ -63,6 +63,9 @@ func (r *Responses) UnmarshalJSON(data []byte) error {
// MarshalJSON converts this items object to JSON
func (r Responses) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(r)
+ }
b1, err := json.Marshal(r.ResponsesProps)
if err != nil {
return nil, err
@@ -75,6 +78,25 @@ func (r Responses) MarshalJSON() ([]byte, error) {
return concated, nil
}
+func (r Responses) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ type ArbitraryKeys map[string]interface{}
+ var x struct {
+ ArbitraryKeys
+ Default *Response `json:"default,omitempty"`
+ }
+ x.ArbitraryKeys = make(map[string]any, len(r.Extensions)+len(r.StatusCodeResponses))
+ for k, v := range r.Extensions {
+ if internal.IsExtensionKey(k) {
+ x.ArbitraryKeys[k] = v
+ }
+ }
+ for k, v := range r.StatusCodeResponses {
+ x.ArbitraryKeys[strconv.Itoa(k)] = v
+ }
+ x.Default = r.Default
+ return opts.MarshalNext(enc, x)
+}
+
// ResponsesProps describes all responses for an operation.
// It tells what is the default response and maps all responses with a
// HTTP status code.
@@ -148,7 +170,7 @@ func (r *Responses) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.
return nil
}
switch k := tok.String(); {
- case isExtensionKey(k):
+ case internal.IsExtensionKey(k):
ext = nil
if err := opts.UnmarshalNext(dec, &ext); err != nil {
return err
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go
index 9add0c163..dfbb2e05c 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go
@@ -196,6 +196,46 @@ type SchemaProps struct {
Definitions Definitions `json:"definitions,omitempty"`
}
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type schemaPropsOmitZero struct {
+ ID string `json:"id,omitempty"`
+ Ref Ref `json:"-"`
+ Schema SchemaURL `json:"-"`
+ Description string `json:"description,omitempty"`
+ Type StringOrArray `json:"type,omitzero"`
+ Nullable bool `json:"nullable,omitzero"`
+ Format string `json:"format,omitempty"`
+ Title string `json:"title,omitempty"`
+ Default interface{} `json:"default,omitzero"`
+ Maximum *float64 `json:"maximum,omitempty"`
+ ExclusiveMaximum bool `json:"exclusiveMaximum,omitzero"`
+ Minimum *float64 `json:"minimum,omitempty"`
+ ExclusiveMinimum bool `json:"exclusiveMinimum,omitzero"`
+ MaxLength *int64 `json:"maxLength,omitempty"`
+ MinLength *int64 `json:"minLength,omitempty"`
+ Pattern string `json:"pattern,omitempty"`
+ MaxItems *int64 `json:"maxItems,omitempty"`
+ MinItems *int64 `json:"minItems,omitempty"`
+ UniqueItems bool `json:"uniqueItems,omitzero"`
+ MultipleOf *float64 `json:"multipleOf,omitempty"`
+ Enum []interface{} `json:"enum,omitempty"`
+ MaxProperties *int64 `json:"maxProperties,omitempty"`
+ MinProperties *int64 `json:"minProperties,omitempty"`
+ Required []string `json:"required,omitempty"`
+ Items *SchemaOrArray `json:"items,omitzero"`
+ AllOf []Schema `json:"allOf,omitempty"`
+ OneOf []Schema `json:"oneOf,omitempty"`
+ AnyOf []Schema `json:"anyOf,omitempty"`
+ Not *Schema `json:"not,omitzero"`
+ Properties map[string]Schema `json:"properties,omitempty"`
+ AdditionalProperties *SchemaOrBool `json:"additionalProperties,omitzero"`
+ PatternProperties map[string]Schema `json:"patternProperties,omitempty"`
+ Dependencies Dependencies `json:"dependencies,omitempty"`
+ AdditionalItems *SchemaOrBool `json:"additionalItems,omitzero"`
+ Definitions Definitions `json:"definitions,omitempty"`
+}
+
// SwaggerSchemaProps are additional properties supported by swagger schemas, but not JSON-schema (draft 4)
type SwaggerSchemaProps struct {
Discriminator string `json:"discriminator,omitempty"`
@@ -204,6 +244,15 @@ type SwaggerSchemaProps struct {
Example interface{} `json:"example,omitempty"`
}
+// Marshaling structure only, always edit along with corresponding
+// struct (or compilation will fail).
+type swaggerSchemaPropsOmitZero struct {
+ Discriminator string `json:"discriminator,omitempty"`
+ ReadOnly bool `json:"readOnly,omitzero"`
+ ExternalDocs *ExternalDocumentation `json:"externalDocs,omitzero"`
+ Example interface{} `json:"example,omitempty"`
+}
+
// Schema the schema object allows the definition of input and output data types.
// These types can be objects, but also primitives and arrays.
// This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/)
@@ -434,6 +483,9 @@ func (s *Schema) WithExternalDocs(description, url string) *Schema {
// MarshalJSON marshal this to JSON
func (s Schema) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
b1, err := json.Marshal(s.SchemaProps)
if err != nil {
return nil, fmt.Errorf("schema props %v", err)
@@ -465,6 +517,31 @@ func (s Schema) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2, b3, b4, b5, b6), nil
}
+func (s Schema) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ type ArbitraryKeys map[string]interface{}
+ var x struct {
+ ArbitraryKeys
+ SchemaProps schemaPropsOmitZero `json:",inline"`
+ SwaggerSchemaProps swaggerSchemaPropsOmitZero `json:",inline"`
+ Schema string `json:"$schema,omitempty"`
+ Ref string `json:"$ref,omitempty"`
+ }
+ x.ArbitraryKeys = make(map[string]any, len(s.Extensions)+len(s.ExtraProps))
+ for k, v := range s.Extensions {
+ if internal.IsExtensionKey(k) {
+ x.ArbitraryKeys[k] = v
+ }
+ }
+ for k, v := range s.ExtraProps {
+ x.ArbitraryKeys[k] = v
+ }
+ x.SchemaProps = schemaPropsOmitZero(s.SchemaProps)
+ x.SwaggerSchemaProps = swaggerSchemaPropsOmitZero(s.SwaggerSchemaProps)
+ x.Ref = s.Ref.String()
+ x.Schema = string(s.Schema)
+ return opts.MarshalNext(enc, x)
+}
+
// UnmarshalJSON marshal this from JSON
func (s *Schema) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
@@ -547,7 +624,7 @@ func (s *Schema) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Dec
}
s.ExtraProps = x.Extensions.sanitizeWithExtra()
- s.VendorExtensible.Extensions = x.Extensions
+ s.Extensions = internal.SanitizeExtensions(x.Extensions)
s.SchemaProps = x.SchemaProps
s.SwaggerSchemaProps = x.SwaggerSchemaProps
return nil
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go
index 34723fb71..e2b7da14c 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go
@@ -18,6 +18,7 @@ import (
"encoding/json"
"github.com/go-openapi/swag"
+ "k8s.io/kube-openapi/pkg/internal"
jsonv2 "k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json"
)
@@ -45,6 +46,9 @@ type SecurityScheme struct {
// MarshalJSON marshal this to JSON
func (s SecurityScheme) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
b1, err := json.Marshal(s.SecuritySchemeProps)
if err != nil {
return nil, err
@@ -56,6 +60,16 @@ func (s SecurityScheme) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (s SecurityScheme) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ SecuritySchemeProps
+ }
+ x.Extensions = internal.SanitizeExtensions(s.Extensions)
+ x.SecuritySchemeProps = s.SecuritySchemeProps
+ return opts.MarshalNext(enc, x)
+}
+
// UnmarshalJSON marshal this from JSON
func (s *SecurityScheme) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, &s.SecuritySchemeProps); err != nil {
@@ -72,11 +86,7 @@ func (s *SecurityScheme) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *js
if err := opts.UnmarshalNext(dec, &x); err != nil {
return err
}
- x.Extensions.sanitize()
- if len(x.Extensions) == 0 {
- x.Extensions = nil
- }
- s.VendorExtensible.Extensions = x.Extensions
+ s.Extensions = internal.SanitizeExtensions(x.Extensions)
s.SecuritySchemeProps = x.SecuritySchemeProps
return nil
}
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go
index f6cb7da3f..c8f3beaa3 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go
@@ -35,6 +35,9 @@ type Swagger struct {
// MarshalJSON marshals this swagger structure to json
func (s Swagger) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
b1, err := json.Marshal(s.SwaggerProps)
if err != nil {
return nil, err
@@ -46,12 +49,22 @@ func (s Swagger) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+// MarshalJSON marshals this swagger structure to json
+func (s Swagger) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ SwaggerProps
+ }
+ x.Extensions = internal.SanitizeExtensions(s.Extensions)
+ x.SwaggerProps = s.SwaggerProps
+ return opts.MarshalNext(enc, x)
+}
+
// UnmarshalJSON unmarshals a swagger spec from json
func (s *Swagger) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
return jsonv2.Unmarshal(data, s)
}
-
var sw Swagger
if err := json.Unmarshal(data, &sw.SwaggerProps); err != nil {
return err
@@ -75,15 +88,8 @@ func (s *Swagger) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.De
if err := opts.UnmarshalNext(dec, &x); err != nil {
return err
}
-
- s.Extensions = x.Extensions
+ s.Extensions = internal.SanitizeExtensions(x.Extensions)
s.SwaggerProps = x.SwaggerProps
-
- s.Extensions.sanitize()
- if len(s.Extensions) == 0 {
- s.Extensions = nil
- }
-
return nil
}
@@ -126,6 +132,9 @@ var jsFalse = []byte("false")
// MarshalJSON convert this object to JSON
func (s SchemaOrBool) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
if s.Schema != nil {
return json.Marshal(s.Schema)
}
@@ -136,6 +145,18 @@ func (s SchemaOrBool) MarshalJSON() ([]byte, error) {
return jsTrue, nil
}
+// MarshalJSON convert this object to JSON
+func (s SchemaOrBool) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ if s.Schema != nil {
+ return opts.MarshalNext(enc, s.Schema)
+ }
+
+ if s.Schema == nil && !s.Allows {
+ return enc.WriteToken(jsonv2.False)
+ }
+ return enc.WriteToken(jsonv2.True)
+}
+
// UnmarshalJSON converts this bool or schema object from a JSON structure
func (s *SchemaOrBool) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
@@ -143,15 +164,15 @@ func (s *SchemaOrBool) UnmarshalJSON(data []byte) error {
}
var nw SchemaOrBool
- if len(data) >= 4 {
- if data[0] == '{' {
- var sch Schema
- if err := json.Unmarshal(data, &sch); err != nil {
- return err
- }
- nw.Schema = &sch
+ if len(data) > 0 && data[0] == '{' {
+ var sch Schema
+ if err := json.Unmarshal(data, &sch); err != nil {
+ return err
}
- nw.Allows = !(data[0] == 'f' && data[1] == 'a' && data[2] == 'l' && data[3] == 's' && data[4] == 'e')
+ nw.Schema = &sch
+ nw.Allows = true
+ } else {
+ json.Unmarshal(data, &nw.Allows)
}
*s = nw
return nil
@@ -185,6 +206,9 @@ type SchemaOrStringArray struct {
// MarshalJSON converts this schema object or array into JSON structure
func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
if len(s.Property) > 0 {
return json.Marshal(s.Property)
}
@@ -194,6 +218,17 @@ func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) {
return []byte("null"), nil
}
+// MarshalJSON converts this schema object or array into JSON structure
+func (s SchemaOrStringArray) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ if len(s.Property) > 0 {
+ return opts.MarshalNext(enc, s.Property)
+ }
+ if s.Schema != nil {
+ return opts.MarshalNext(enc, s.Schema)
+ }
+ return enc.WriteToken(jsonv2.Null)
+}
+
// UnmarshalJSON converts this schema object or array from a JSON structure
func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
@@ -347,12 +382,23 @@ func (s *SchemaOrArray) ContainsType(name string) bool {
// MarshalJSON converts this schema object or array into JSON structure
func (s SchemaOrArray) MarshalJSON() ([]byte, error) {
- if len(s.Schemas) > 0 {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(s)
+ }
+ if s.Schemas != nil {
return json.Marshal(s.Schemas)
}
return json.Marshal(s.Schema)
}
+// MarshalJSON converts this schema object or array into JSON structure
+func (s SchemaOrArray) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ if s.Schemas != nil {
+ return opts.MarshalNext(enc, s.Schemas)
+ }
+ return opts.MarshalNext(enc, s.Schema)
+}
+
// UnmarshalJSON converts this schema object or array from a JSON structure
func (s *SchemaOrArray) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go
index 69e93b60b..d105d52ca 100644
--- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go
+++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go
@@ -41,6 +41,9 @@ type Tag struct {
// MarshalJSON marshal this to JSON
func (t Tag) MarshalJSON() ([]byte, error) {
+ if internal.UseOptimizedJSONMarshaling {
+ return internal.DeterministicMarshal(t)
+ }
b1, err := json.Marshal(t.TagProps)
if err != nil {
return nil, err
@@ -52,6 +55,16 @@ func (t Tag) MarshalJSON() ([]byte, error) {
return swag.ConcatJSON(b1, b2), nil
}
+func (t Tag) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error {
+ var x struct {
+ Extensions
+ TagProps
+ }
+ x.Extensions = internal.SanitizeExtensions(t.Extensions)
+ x.TagProps = t.TagProps
+ return opts.MarshalNext(enc, x)
+}
+
// UnmarshalJSON marshal this from JSON
func (t *Tag) UnmarshalJSON(data []byte) error {
if internal.UseOptimizedJSONUnmarshaling {
@@ -72,11 +85,7 @@ func (t *Tag) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decode
if err := opts.UnmarshalNext(dec, &x); err != nil {
return err
}
- x.Extensions.sanitize()
- if len(x.Extensions) == 0 {
- x.Extensions = nil
- }
- t.VendorExtensible.Extensions = x.Extensions
+ t.Extensions = internal.SanitizeExtensions(x.Extensions)
t.TagProps = x.TagProps
return nil
}
diff --git a/vendor/k8s.io/utils/integer/integer.go b/vendor/k8s.io/utils/integer/integer.go
index e4e740cad..e0811e834 100644
--- a/vendor/k8s.io/utils/integer/integer.go
+++ b/vendor/k8s.io/utils/integer/integer.go
@@ -16,6 +16,8 @@ limitations under the License.
package integer
+import "math"
+
// IntMax returns the maximum of the params
func IntMax(a, b int) int {
if b > a {
@@ -65,9 +67,7 @@ func Int64Min(a, b int64) int64 {
}
// RoundToInt32 rounds floats into integer numbers.
+// Deprecated: use math.Round() and a cast directly.
func RoundToInt32(a float64) int32 {
- if a < 0 {
- return int32(a - 0.5)
- }
- return int32(a + 0.5)
+ return int32(math.Round(a))
}
diff --git a/vendor/k8s.io/utils/lru/lru.go b/vendor/k8s.io/utils/lru/lru.go
index 5d0077abf..47f135281 100644
--- a/vendor/k8s.io/utils/lru/lru.go
+++ b/vendor/k8s.io/utils/lru/lru.go
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,6 +22,7 @@ import (
)
type Key = groupcache.Key
+type EvictionFunc = func(key Key, value interface{})
// Cache is a thread-safe fixed size LRU cache.
type Cache struct {
@@ -36,6 +37,13 @@ func New(size int) *Cache {
}
}
+// NewWithEvictionFunc creates an LRU of the given size with the given eviction func.
+func NewWithEvictionFunc(size int, f EvictionFunc) *Cache {
+ c := New(size)
+ c.cache.OnEvicted = f
+ return c
+}
+
// Add adds a value to the cache.
func (c *Cache) Add(key Key, value interface{}) {
c.lock.Lock()
diff --git a/vendor/k8s.io/utils/net/multi_listen.go b/vendor/k8s.io/utils/net/multi_listen.go
new file mode 100644
index 000000000..7cb7795be
--- /dev/null
+++ b/vendor/k8s.io/utils/net/multi_listen.go
@@ -0,0 +1,195 @@
+/*
+Copyright 2024 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package net
+
+import (
+ "context"
+ "fmt"
+ "net"
+ "sync"
+)
+
+// connErrPair pairs conn and error which is returned by accept on sub-listeners.
+type connErrPair struct {
+ conn net.Conn
+ err error
+}
+
+// multiListener implements net.Listener
+type multiListener struct {
+ listeners []net.Listener
+ wg sync.WaitGroup
+
+ // connCh passes accepted connections, from child listeners to parent.
+ connCh chan connErrPair
+ // stopCh communicates from parent to child listeners.
+ stopCh chan struct{}
+}
+
+// compile time check to ensure *multiListener implements net.Listener
+var _ net.Listener = &multiListener{}
+
+// MultiListen returns net.Listener which can listen on and accept connections for
+// the given network on multiple addresses. Internally it uses stdlib to create
+// sub-listener and multiplexes connection requests using go-routines.
+// The network must be "tcp", "tcp4" or "tcp6".
+// It follows the semantics of net.Listen that primarily means:
+// 1. If the host is an unspecified/zero IP address with "tcp" network, MultiListen
+// listens on all available unicast and anycast IP addresses of the local system.
+// 2. Use "tcp4" or "tcp6" to exclusively listen on IPv4 or IPv6 family, respectively.
+// 3. The host can accept names (e.g, localhost) and it will create a listener for at
+// most one of the host's IP.
+func MultiListen(ctx context.Context, network string, addrs ...string) (net.Listener, error) {
+ var lc net.ListenConfig
+ return multiListen(
+ ctx,
+ network,
+ addrs,
+ func(ctx context.Context, network, address string) (net.Listener, error) {
+ return lc.Listen(ctx, network, address)
+ })
+}
+
+// multiListen implements MultiListen by consuming stdlib functions as dependency allowing
+// mocking for unit-testing.
+func multiListen(
+ ctx context.Context,
+ network string,
+ addrs []string,
+ listenFunc func(ctx context.Context, network, address string) (net.Listener, error),
+) (net.Listener, error) {
+ if !(network == "tcp" || network == "tcp4" || network == "tcp6") {
+ return nil, fmt.Errorf("network %q not supported", network)
+ }
+ if len(addrs) == 0 {
+ return nil, fmt.Errorf("no address provided to listen on")
+ }
+
+ ml := &multiListener{
+ connCh: make(chan connErrPair),
+ stopCh: make(chan struct{}),
+ }
+ for _, addr := range addrs {
+ l, err := listenFunc(ctx, network, addr)
+ if err != nil {
+ // close all the sub-listeners and exit
+ _ = ml.Close()
+ return nil, err
+ }
+ ml.listeners = append(ml.listeners, l)
+ }
+
+ for _, l := range ml.listeners {
+ ml.wg.Add(1)
+ go func(l net.Listener) {
+ defer ml.wg.Done()
+ for {
+ // Accept() is blocking, unless ml.Close() is called, in which
+ // case it will return immediately with an error.
+ conn, err := l.Accept()
+ // This assumes that ANY error from Accept() will terminate the
+ // sub-listener. We could maybe be more precise, but it
+ // doesn't seem necessary.
+ terminate := err != nil
+
+ select {
+ case ml.connCh <- connErrPair{conn: conn, err: err}:
+ case <-ml.stopCh:
+ // In case we accepted a connection AND were stopped, and
+ // this select-case was chosen, just throw away the
+ // connection. This avoids potentially blocking on connCh
+ // or leaking a connection.
+ if conn != nil {
+ _ = conn.Close()
+ }
+ terminate = true
+ }
+ // Make sure we don't loop on Accept() returning an error and
+ // the select choosing the channel case.
+ if terminate {
+ return
+ }
+ }
+ }(l)
+ }
+ return ml, nil
+}
+
+// Accept implements net.Listener. It waits for and returns a connection from
+// any of the sub-listener.
+func (ml *multiListener) Accept() (net.Conn, error) {
+ // wait for any sub-listener to enqueue an accepted connection
+ connErr, ok := <-ml.connCh
+ if !ok {
+ // The channel will be closed only when Close() is called on the
+ // multiListener. Closing of this channel implies that all
+ // sub-listeners are also closed, which causes a "use of closed
+ // network connection" error on their Accept() calls. We return the
+ // same error for multiListener.Accept() if multiListener.Close()
+ // has already been called.
+ return nil, fmt.Errorf("use of closed network connection")
+ }
+ return connErr.conn, connErr.err
+}
+
+// Close implements net.Listener. It will close all sub-listeners and wait for
+// the go-routines to exit.
+func (ml *multiListener) Close() error {
+ // Make sure this can be called repeatedly without explosions.
+ select {
+ case <-ml.stopCh:
+ return fmt.Errorf("use of closed network connection")
+ default:
+ }
+
+ // Tell all sub-listeners to stop.
+ close(ml.stopCh)
+
+ // Closing the listeners causes Accept() to immediately return an error in
+ // the sub-listener go-routines.
+ for _, l := range ml.listeners {
+ _ = l.Close()
+ }
+
+ // Wait for all the sub-listener go-routines to exit.
+ ml.wg.Wait()
+ close(ml.connCh)
+
+ // Drain any already-queued connections.
+ for connErr := range ml.connCh {
+ if connErr.conn != nil {
+ _ = connErr.conn.Close()
+ }
+ }
+ return nil
+}
+
+// Addr is an implementation of the net.Listener interface. It always returns
+// the address of the first listener. Callers should use conn.LocalAddr() to
+// obtain the actual local address of the sub-listener.
+func (ml *multiListener) Addr() net.Addr {
+ return ml.listeners[0].Addr()
+}
+
+// Addrs is like Addr, but returns the address for all registered listeners.
+func (ml *multiListener) Addrs() []net.Addr {
+ var ret []net.Addr
+ for _, l := range ml.listeners {
+ ret = append(ret, l.Addr())
+ }
+ return ret
+}
diff --git a/vendor/k8s.io/utils/pointer/pointer.go b/vendor/k8s.io/utils/pointer/pointer.go
index b8103223a..b673a6425 100644
--- a/vendor/k8s.io/utils/pointer/pointer.go
+++ b/vendor/k8s.io/utils/pointer/pointer.go
@@ -14,12 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
+// Deprecated: Use functions in k8s.io/utils/ptr instead: ptr.To to obtain
+// a pointer, ptr.Deref to dereference a pointer, ptr.Equal to compare
+// dereferenced pointers.
package pointer
import (
- "fmt"
- "reflect"
"time"
+
+ "k8s.io/utils/ptr"
)
// AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when,
@@ -28,383 +31,219 @@ import (
//
// This function is only valid for structs and pointers to structs. Any other
// type will cause a panic. Passing a typed nil pointer will return true.
-func AllPtrFieldsNil(obj interface{}) bool {
- v := reflect.ValueOf(obj)
- if !v.IsValid() {
- panic(fmt.Sprintf("reflect.ValueOf() produced a non-valid Value for %#v", obj))
- }
- if v.Kind() == reflect.Ptr {
- if v.IsNil() {
- return true
- }
- v = v.Elem()
- }
- for i := 0; i < v.NumField(); i++ {
- if v.Field(i).Kind() == reflect.Ptr && !v.Field(i).IsNil() {
- return false
- }
- }
- return true
-}
-
-// Int returns a pointer to an int
-func Int(i int) *int {
- return &i
-}
+//
+// Deprecated: Use ptr.AllPtrFieldsNil instead.
+var AllPtrFieldsNil = ptr.AllPtrFieldsNil
+
+// Int returns a pointer to an int.
+var Int = ptr.To[int]
// IntPtr is a function variable referring to Int.
//
-// Deprecated: Use Int instead.
+// Deprecated: Use ptr.To instead.
var IntPtr = Int // for back-compat
// IntDeref dereferences the int ptr and returns it if not nil, or else
// returns def.
-func IntDeref(ptr *int, def int) int {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var IntDeref = ptr.Deref[int]
// IntPtrDerefOr is a function variable referring to IntDeref.
//
-// Deprecated: Use IntDeref instead.
+// Deprecated: Use ptr.Deref instead.
var IntPtrDerefOr = IntDeref // for back-compat
// Int32 returns a pointer to an int32.
-func Int32(i int32) *int32 {
- return &i
-}
+var Int32 = ptr.To[int32]
// Int32Ptr is a function variable referring to Int32.
//
-// Deprecated: Use Int32 instead.
+// Deprecated: Use ptr.To instead.
var Int32Ptr = Int32 // for back-compat
// Int32Deref dereferences the int32 ptr and returns it if not nil, or else
// returns def.
-func Int32Deref(ptr *int32, def int32) int32 {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var Int32Deref = ptr.Deref[int32]
// Int32PtrDerefOr is a function variable referring to Int32Deref.
//
-// Deprecated: Use Int32Deref instead.
+// Deprecated: Use ptr.Deref instead.
var Int32PtrDerefOr = Int32Deref // for back-compat
// Int32Equal returns true if both arguments are nil or both arguments
// dereference to the same value.
-func Int32Equal(a, b *int32) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var Int32Equal = ptr.Equal[int32]
// Uint returns a pointer to an uint
-func Uint(i uint) *uint {
- return &i
-}
+var Uint = ptr.To[uint]
// UintPtr is a function variable referring to Uint.
//
-// Deprecated: Use Uint instead.
+// Deprecated: Use ptr.To instead.
var UintPtr = Uint // for back-compat
// UintDeref dereferences the uint ptr and returns it if not nil, or else
// returns def.
-func UintDeref(ptr *uint, def uint) uint {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var UintDeref = ptr.Deref[uint]
// UintPtrDerefOr is a function variable referring to UintDeref.
//
-// Deprecated: Use UintDeref instead.
+// Deprecated: Use ptr.Deref instead.
var UintPtrDerefOr = UintDeref // for back-compat
// Uint32 returns a pointer to an uint32.
-func Uint32(i uint32) *uint32 {
- return &i
-}
+var Uint32 = ptr.To[uint32]
// Uint32Ptr is a function variable referring to Uint32.
//
-// Deprecated: Use Uint32 instead.
+// Deprecated: Use ptr.To instead.
var Uint32Ptr = Uint32 // for back-compat
// Uint32Deref dereferences the uint32 ptr and returns it if not nil, or else
// returns def.
-func Uint32Deref(ptr *uint32, def uint32) uint32 {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var Uint32Deref = ptr.Deref[uint32]
// Uint32PtrDerefOr is a function variable referring to Uint32Deref.
//
-// Deprecated: Use Uint32Deref instead.
+// Deprecated: Use ptr.Deref instead.
var Uint32PtrDerefOr = Uint32Deref // for back-compat
// Uint32Equal returns true if both arguments are nil or both arguments
// dereference to the same value.
-func Uint32Equal(a, b *uint32) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var Uint32Equal = ptr.Equal[uint32]
// Int64 returns a pointer to an int64.
-func Int64(i int64) *int64 {
- return &i
-}
+var Int64 = ptr.To[int64]
// Int64Ptr is a function variable referring to Int64.
//
-// Deprecated: Use Int64 instead.
+// Deprecated: Use ptr.To instead.
var Int64Ptr = Int64 // for back-compat
// Int64Deref dereferences the int64 ptr and returns it if not nil, or else
// returns def.
-func Int64Deref(ptr *int64, def int64) int64 {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var Int64Deref = ptr.Deref[int64]
// Int64PtrDerefOr is a function variable referring to Int64Deref.
//
-// Deprecated: Use Int64Deref instead.
+// Deprecated: Use ptr.Deref instead.
var Int64PtrDerefOr = Int64Deref // for back-compat
// Int64Equal returns true if both arguments are nil or both arguments
// dereference to the same value.
-func Int64Equal(a, b *int64) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var Int64Equal = ptr.Equal[int64]
// Uint64 returns a pointer to an uint64.
-func Uint64(i uint64) *uint64 {
- return &i
-}
+var Uint64 = ptr.To[uint64]
// Uint64Ptr is a function variable referring to Uint64.
//
-// Deprecated: Use Uint64 instead.
+// Deprecated: Use ptr.To instead.
var Uint64Ptr = Uint64 // for back-compat
// Uint64Deref dereferences the uint64 ptr and returns it if not nil, or else
// returns def.
-func Uint64Deref(ptr *uint64, def uint64) uint64 {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var Uint64Deref = ptr.Deref[uint64]
// Uint64PtrDerefOr is a function variable referring to Uint64Deref.
//
-// Deprecated: Use Uint64Deref instead.
+// Deprecated: Use ptr.Deref instead.
var Uint64PtrDerefOr = Uint64Deref // for back-compat
// Uint64Equal returns true if both arguments are nil or both arguments
// dereference to the same value.
-func Uint64Equal(a, b *uint64) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var Uint64Equal = ptr.Equal[uint64]
// Bool returns a pointer to a bool.
-func Bool(b bool) *bool {
- return &b
-}
+var Bool = ptr.To[bool]
// BoolPtr is a function variable referring to Bool.
//
-// Deprecated: Use Bool instead.
+// Deprecated: Use ptr.To instead.
var BoolPtr = Bool // for back-compat
// BoolDeref dereferences the bool ptr and returns it if not nil, or else
// returns def.
-func BoolDeref(ptr *bool, def bool) bool {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var BoolDeref = ptr.Deref[bool]
// BoolPtrDerefOr is a function variable referring to BoolDeref.
//
-// Deprecated: Use BoolDeref instead.
+// Deprecated: Use ptr.Deref instead.
var BoolPtrDerefOr = BoolDeref // for back-compat
// BoolEqual returns true if both arguments are nil or both arguments
// dereference to the same value.
-func BoolEqual(a, b *bool) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var BoolEqual = ptr.Equal[bool]
// String returns a pointer to a string.
-func String(s string) *string {
- return &s
-}
+var String = ptr.To[string]
// StringPtr is a function variable referring to String.
//
-// Deprecated: Use String instead.
+// Deprecated: Use ptr.To instead.
var StringPtr = String // for back-compat
// StringDeref dereferences the string ptr and returns it if not nil, or else
// returns def.
-func StringDeref(ptr *string, def string) string {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var StringDeref = ptr.Deref[string]
// StringPtrDerefOr is a function variable referring to StringDeref.
//
-// Deprecated: Use StringDeref instead.
+// Deprecated: Use ptr.Deref instead.
var StringPtrDerefOr = StringDeref // for back-compat
// StringEqual returns true if both arguments are nil or both arguments
// dereference to the same value.
-func StringEqual(a, b *string) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var StringEqual = ptr.Equal[string]
// Float32 returns a pointer to a float32.
-func Float32(i float32) *float32 {
- return &i
-}
+var Float32 = ptr.To[float32]
// Float32Ptr is a function variable referring to Float32.
//
-// Deprecated: Use Float32 instead.
+// Deprecated: Use ptr.To instead.
var Float32Ptr = Float32
// Float32Deref dereferences the float32 ptr and returns it if not nil, or else
// returns def.
-func Float32Deref(ptr *float32, def float32) float32 {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var Float32Deref = ptr.Deref[float32]
// Float32PtrDerefOr is a function variable referring to Float32Deref.
//
-// Deprecated: Use Float32Deref instead.
+// Deprecated: Use ptr.Deref instead.
var Float32PtrDerefOr = Float32Deref // for back-compat
// Float32Equal returns true if both arguments are nil or both arguments
// dereference to the same value.
-func Float32Equal(a, b *float32) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var Float32Equal = ptr.Equal[float32]
// Float64 returns a pointer to a float64.
-func Float64(i float64) *float64 {
- return &i
-}
+var Float64 = ptr.To[float64]
// Float64Ptr is a function variable referring to Float64.
//
-// Deprecated: Use Float64 instead.
+// Deprecated: Use ptr.To instead.
var Float64Ptr = Float64
// Float64Deref dereferences the float64 ptr and returns it if not nil, or else
// returns def.
-func Float64Deref(ptr *float64, def float64) float64 {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var Float64Deref = ptr.Deref[float64]
// Float64PtrDerefOr is a function variable referring to Float64Deref.
//
-// Deprecated: Use Float64Deref instead.
+// Deprecated: Use ptr.Deref instead.
var Float64PtrDerefOr = Float64Deref // for back-compat
// Float64Equal returns true if both arguments are nil or both arguments
// dereference to the same value.
-func Float64Equal(a, b *float64) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var Float64Equal = ptr.Equal[float64]
// Duration returns a pointer to a time.Duration.
-func Duration(d time.Duration) *time.Duration {
- return &d
-}
+var Duration = ptr.To[time.Duration]
// DurationDeref dereferences the time.Duration ptr and returns it if not nil, or else
// returns def.
-func DurationDeref(ptr *time.Duration, def time.Duration) time.Duration {
- if ptr != nil {
- return *ptr
- }
- return def
-}
+var DurationDeref = ptr.Deref[time.Duration]
// DurationEqual returns true if both arguments are nil or both arguments
// dereference to the same value.
-func DurationEqual(a, b *time.Duration) bool {
- if (a == nil) != (b == nil) {
- return false
- }
- if a == nil {
- return true
- }
- return *a == *b
-}
+var DurationEqual = ptr.Equal[time.Duration]
diff --git a/vendor/k8s.io/utils/ptr/OWNERS b/vendor/k8s.io/utils/ptr/OWNERS
new file mode 100644
index 000000000..0d6392752
--- /dev/null
+++ b/vendor/k8s.io/utils/ptr/OWNERS
@@ -0,0 +1,10 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+approvers:
+- apelisse
+- stewart-yu
+- thockin
+reviewers:
+- apelisse
+- stewart-yu
+- thockin
diff --git a/vendor/k8s.io/utils/ptr/README.md b/vendor/k8s.io/utils/ptr/README.md
new file mode 100644
index 000000000..2ca8073dc
--- /dev/null
+++ b/vendor/k8s.io/utils/ptr/README.md
@@ -0,0 +1,3 @@
+# Pointer
+
+This package provides some functions for pointer-based operations.
diff --git a/vendor/k8s.io/utils/ptr/ptr.go b/vendor/k8s.io/utils/ptr/ptr.go
new file mode 100644
index 000000000..659ed3b9e
--- /dev/null
+++ b/vendor/k8s.io/utils/ptr/ptr.go
@@ -0,0 +1,73 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package ptr
+
+import (
+ "fmt"
+ "reflect"
+)
+
+// AllPtrFieldsNil tests whether all pointer fields in a struct are nil. This is useful when,
+// for example, an API struct is handled by plugins which need to distinguish
+// "no plugin accepted this spec" from "this spec is empty".
+//
+// This function is only valid for structs and pointers to structs. Any other
+// type will cause a panic. Passing a typed nil pointer will return true.
+func AllPtrFieldsNil(obj interface{}) bool {
+ v := reflect.ValueOf(obj)
+ if !v.IsValid() {
+ panic(fmt.Sprintf("reflect.ValueOf() produced a non-valid Value for %#v", obj))
+ }
+ if v.Kind() == reflect.Ptr {
+ if v.IsNil() {
+ return true
+ }
+ v = v.Elem()
+ }
+ for i := 0; i < v.NumField(); i++ {
+ if v.Field(i).Kind() == reflect.Ptr && !v.Field(i).IsNil() {
+ return false
+ }
+ }
+ return true
+}
+
+// To returns a pointer to the given value.
+func To[T any](v T) *T {
+ return &v
+}
+
+// Deref dereferences ptr and returns the value it points to if no nil, or else
+// returns def.
+func Deref[T any](ptr *T, def T) T {
+ if ptr != nil {
+ return *ptr
+ }
+ return def
+}
+
+// Equal returns true if both arguments are nil or both arguments
+// dereference to the same value.
+func Equal[T comparable](a, b *T) bool {
+ if (a == nil) != (b == nil) {
+ return false
+ }
+ if a == nil {
+ return true
+ }
+ return *a == *b
+}
diff --git a/vendor/k8s.io/utils/trace/trace.go b/vendor/k8s.io/utils/trace/trace.go
index a0b07a6d7..559aebb59 100644
--- a/vendor/k8s.io/utils/trace/trace.go
+++ b/vendor/k8s.io/utils/trace/trace.go
@@ -65,6 +65,11 @@ func durationToMilliseconds(timeDuration time.Duration) int64 {
}
type traceItem interface {
+ // rLock must be called before invoking time or writeItem.
+ rLock()
+ // rUnlock must be called after processing the item is complete.
+ rUnlock()
+
// time returns when the trace was recorded as completed.
time() time.Time
// writeItem outputs the traceItem to the buffer. If stepThreshold is non-nil, only output the
@@ -79,6 +84,10 @@ type traceStep struct {
fields []Field
}
+// rLock doesn't need to do anything because traceStep instances are immutable.
+func (s traceStep) rLock() {}
+func (s traceStep) rUnlock() {}
+
func (s traceStep) time() time.Time {
return s.stepTime
}
@@ -106,6 +115,14 @@ type Trace struct {
traceItems []traceItem
}
+func (t *Trace) rLock() {
+ t.lock.RLock()
+}
+
+func (t *Trace) rUnlock() {
+ t.lock.RUnlock()
+}
+
func (t *Trace) time() time.Time {
if t.endTime != nil {
return *t.endTime
@@ -175,7 +192,7 @@ func (t *Trace) Log() {
t.endTime = &endTime
t.lock.Unlock()
// an explicit logging request should dump all the steps out at the higher level
- if t.parentTrace == nil { // We don't start logging until Log or LogIfLong is called on the root trace
+ if t.parentTrace == nil && klogV(2) { // We don't start logging until Log or LogIfLong is called on the root trace
t.logTrace()
}
}
@@ -231,8 +248,10 @@ func (t *Trace) logTrace() {
func (t *Trace) writeTraceSteps(b *bytes.Buffer, formatter string, stepThreshold *time.Duration) {
lastStepTime := t.startTime
for _, stepOrTrace := range t.traceItems {
+ stepOrTrace.rLock()
stepOrTrace.writeItem(b, formatter, lastStepTime, stepThreshold)
lastStepTime = stepOrTrace.time()
+ stepOrTrace.rUnlock()
}
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 9ea46ba52..f8d165882 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -23,7 +23,7 @@ github.com/coreos/go-semver/semver
## explicit; go 1.12
github.com/coreos/go-systemd/v22/daemon
github.com/coreos/go-systemd/v22/journal
-# github.com/davecgh/go-spew v1.1.1
+# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
## explicit
github.com/davecgh/go-spew/spew
# github.com/emicklei/go-restful/v3 v3.9.0
@@ -42,6 +42,9 @@ github.com/felixge/httpsnoop
# github.com/fsnotify/fsnotify v1.6.0
## explicit; go 1.16
github.com/fsnotify/fsnotify
+# github.com/fxamacker/cbor/v2 v2.7.0
+## explicit; go 1.17
+github.com/fxamacker/cbor/v2
# github.com/go-logr/logr v1.4.2
## explicit; go 1.18
github.com/go-logr/logr
@@ -49,15 +52,15 @@ github.com/go-logr/logr/funcr
# github.com/go-logr/stdr v1.2.2
## explicit; go 1.16
github.com/go-logr/stdr
-# github.com/go-openapi/jsonpointer v0.19.5
+# github.com/go-openapi/jsonpointer v0.19.6
## explicit; go 1.13
github.com/go-openapi/jsonpointer
-# github.com/go-openapi/jsonreference v0.20.0
+# github.com/go-openapi/jsonreference v0.20.2
## explicit; go 1.13
github.com/go-openapi/jsonreference
github.com/go-openapi/jsonreference/internal
-# github.com/go-openapi/swag v0.19.14
-## explicit; go 1.11
+# github.com/go-openapi/swag v0.22.4
+## explicit; go 1.18
github.com/go-openapi/swag
# github.com/go-task/slim-sprig/v3 v3.0.0
## explicit; go 1.20
@@ -71,8 +74,8 @@ github.com/gogo/protobuf/sortkeys
# github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
## explicit
github.com/golang/groupcache/lru
-# github.com/golang/protobuf v1.5.3
-## explicit; go 1.9
+# github.com/golang/protobuf v1.5.4
+## explicit; go 1.17
github.com/golang/protobuf/jsonpb
github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes
@@ -105,7 +108,13 @@ github.com/google/gnostic/compiler
github.com/google/gnostic/extensions
github.com/google/gnostic/jsonschema
github.com/google/gnostic/openapiv2
-github.com/google/gnostic/openapiv3
+# github.com/google/gnostic-models v0.6.8
+## explicit; go 1.18
+github.com/google/gnostic-models/compiler
+github.com/google/gnostic-models/extensions
+github.com/google/gnostic-models/jsonschema
+github.com/google/gnostic-models/openapiv2
+github.com/google/gnostic-models/openapiv3
# github.com/google/go-cmp v0.6.0
## explicit; go 1.13
github.com/google/go-cmp/cmp
@@ -113,13 +122,14 @@ github.com/google/go-cmp/cmp/internal/diff
github.com/google/go-cmp/cmp/internal/flags
github.com/google/go-cmp/cmp/internal/function
github.com/google/go-cmp/cmp/internal/value
-# github.com/google/gofuzz v1.1.0
+# github.com/google/gofuzz v1.2.0
## explicit; go 1.12
github.com/google/gofuzz
+github.com/google/gofuzz/bytesource
# github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db
## explicit; go 1.22
github.com/google/pprof/profile
-# github.com/google/uuid v1.1.2
+# github.com/google/uuid v1.6.0
## explicit
github.com/google/uuid
# github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
@@ -255,6 +265,9 @@ github.com/spf13/pflag
# github.com/stoewer/go-strcase v1.2.0
## explicit; go 1.11
github.com/stoewer/go-strcase
+# github.com/x448/float16 v0.8.4
+## explicit; go 1.11
+github.com/x448/float16
# go.etcd.io/etcd/api/v3 v3.5.5
## explicit; go 1.16
go.etcd.io/etcd/api/v3/authpb
@@ -594,8 +607,8 @@ k8s.io/api/storage/v1beta1
## explicit; go 1.19
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions
k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1
-# k8s.io/apimachinery v0.26.4
-## explicit; go 1.19
+# k8s.io/apimachinery v0.31.2
+## explicit; go 1.22.0
k8s.io/apimachinery/pkg/api/equality
k8s.io/apimachinery/pkg/api/errors
k8s.io/apimachinery/pkg/api/meta
@@ -617,6 +630,8 @@ k8s.io/apimachinery/pkg/labels
k8s.io/apimachinery/pkg/runtime
k8s.io/apimachinery/pkg/runtime/schema
k8s.io/apimachinery/pkg/runtime/serializer
+k8s.io/apimachinery/pkg/runtime/serializer/cbor/direct
+k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes
k8s.io/apimachinery/pkg/runtime/serializer/json
k8s.io/apimachinery/pkg/runtime/serializer/protobuf
k8s.io/apimachinery/pkg/runtime/serializer/recognizer
@@ -626,11 +641,13 @@ k8s.io/apimachinery/pkg/selection
k8s.io/apimachinery/pkg/types
k8s.io/apimachinery/pkg/util/cache
k8s.io/apimachinery/pkg/util/diff
+k8s.io/apimachinery/pkg/util/dump
k8s.io/apimachinery/pkg/util/errors
k8s.io/apimachinery/pkg/util/framer
k8s.io/apimachinery/pkg/util/intstr
k8s.io/apimachinery/pkg/util/json
k8s.io/apimachinery/pkg/util/managedfields
+k8s.io/apimachinery/pkg/util/managedfields/internal
k8s.io/apimachinery/pkg/util/mergepatch
k8s.io/apimachinery/pkg/util/naming
k8s.io/apimachinery/pkg/util/net
@@ -1090,26 +1107,25 @@ k8s.io/klog/v2/internal/dbg
k8s.io/klog/v2/internal/serialize
k8s.io/klog/v2/internal/severity
k8s.io/klog/v2/internal/sloghandler
-# k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280
-## explicit; go 1.18
+# k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
+## explicit; go 1.20
k8s.io/kube-openapi/pkg/builder
k8s.io/kube-openapi/pkg/builder3
k8s.io/kube-openapi/pkg/builder3/util
+k8s.io/kube-openapi/pkg/cached
k8s.io/kube-openapi/pkg/common
k8s.io/kube-openapi/pkg/common/restfuladapter
k8s.io/kube-openapi/pkg/handler
k8s.io/kube-openapi/pkg/handler3
k8s.io/kube-openapi/pkg/internal
-k8s.io/kube-openapi/pkg/internal/handler
k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json
-k8s.io/kube-openapi/pkg/openapiconv
k8s.io/kube-openapi/pkg/schemaconv
k8s.io/kube-openapi/pkg/schemamutation
k8s.io/kube-openapi/pkg/spec3
k8s.io/kube-openapi/pkg/util
k8s.io/kube-openapi/pkg/util/proto
k8s.io/kube-openapi/pkg/validation/spec
-# k8s.io/utils v0.0.0-20221128185143-99ec85e7a448
+# k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
## explicit; go 1.18
k8s.io/utils/buffer
k8s.io/utils/clock
@@ -1121,6 +1137,7 @@ k8s.io/utils/lru
k8s.io/utils/net
k8s.io/utils/path
k8s.io/utils/pointer
+k8s.io/utils/ptr
k8s.io/utils/strings/slices
k8s.io/utils/trace
# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36
@@ -1174,18 +1191,19 @@ sigs.k8s.io/controller-runtime/pkg/webhook
sigs.k8s.io/controller-runtime/pkg/webhook/admission
sigs.k8s.io/controller-runtime/pkg/webhook/conversion
sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics
-# sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2
+# sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd
## explicit; go 1.18
sigs.k8s.io/json
sigs.k8s.io/json/internal/golang/encoding/json
-# sigs.k8s.io/structured-merge-diff/v4 v4.2.3
+# sigs.k8s.io/structured-merge-diff/v4 v4.4.1
## explicit; go 1.13
sigs.k8s.io/structured-merge-diff/v4/fieldpath
sigs.k8s.io/structured-merge-diff/v4/merge
sigs.k8s.io/structured-merge-diff/v4/schema
sigs.k8s.io/structured-merge-diff/v4/typed
sigs.k8s.io/structured-merge-diff/v4/value
-# sigs.k8s.io/yaml v1.3.0
+# sigs.k8s.io/yaml v1.4.0
## explicit; go 1.12
sigs.k8s.io/yaml
+sigs.k8s.io/yaml/goyaml.v2
# github.com/kubean-io/kubean-api => ./api
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go
index a6c419365..6a13cf2df 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go
@@ -75,6 +75,8 @@ import (
// either be any string type, an integer, implement json.Unmarshaler, or
// implement encoding.TextUnmarshaler.
//
+// If the JSON-encoded data contain a syntax error, Unmarshal returns a SyntaxError.
+//
// If a JSON value is not appropriate for a given target type,
// or if a JSON number overflows the target type, Unmarshal
// skips that field and completes the unmarshaling as best it can.
@@ -85,14 +87,13 @@ import (
//
// The JSON null value unmarshals into an interface, map, pointer, or slice
// by setting that Go value to nil. Because null is often used in JSON to mean
-// ``not present,'' unmarshaling a JSON null into any other Go type has no effect
+// “not present,” unmarshaling a JSON null into any other Go type has no effect
// on the value and produces no error.
//
// When unmarshaling quoted strings, invalid UTF-8 or
// invalid UTF-16 surrogate pairs are not treated as an error.
// Instead, they are replaced by the Unicode replacement
// character U+FFFD.
-//
func Unmarshal(data []byte, v any, opts ...UnmarshalOpt) error {
// Check for well-formedness.
// Avoids filling out half a data structure
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go
index 1f5e3e446..5b67251fb 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go
@@ -77,31 +77,31 @@ import (
//
// Examples of struct field tags and their meanings:
//
-// // Field appears in JSON as key "myName".
-// Field int `json:"myName"`
+// // Field appears in JSON as key "myName".
+// Field int `json:"myName"`
//
-// // Field appears in JSON as key "myName" and
-// // the field is omitted from the object if its value is empty,
-// // as defined above.
-// Field int `json:"myName,omitempty"`
+// // Field appears in JSON as key "myName" and
+// // the field is omitted from the object if its value is empty,
+// // as defined above.
+// Field int `json:"myName,omitempty"`
//
-// // Field appears in JSON as key "Field" (the default), but
-// // the field is skipped if empty.
-// // Note the leading comma.
-// Field int `json:",omitempty"`
+// // Field appears in JSON as key "Field" (the default), but
+// // the field is skipped if empty.
+// // Note the leading comma.
+// Field int `json:",omitempty"`
//
-// // Field is ignored by this package.
-// Field int `json:"-"`
+// // Field is ignored by this package.
+// Field int `json:"-"`
//
-// // Field appears in JSON as key "-".
-// Field int `json:"-,"`
+// // Field appears in JSON as key "-".
+// Field int `json:"-,"`
//
// The "string" option signals that a field is stored as JSON inside a
// JSON-encoded string. It applies only to fields of string, floating point,
// integer, or boolean types. This extra level of encoding is sometimes used
// when communicating with JavaScript programs:
//
-// Int64String int64 `json:",string"`
+// Int64String int64 `json:",string"`
//
// The key name will be used if it's a non-empty string consisting of
// only Unicode letters, digits, and ASCII punctuation except quotation
@@ -154,7 +154,6 @@ import (
// JSON cannot represent cyclic data structures and Marshal does not
// handle them. Passing cyclic structures to Marshal will result in
// an error.
-//
func Marshal(v any) ([]byte, error) {
e := newEncodeState()
@@ -784,7 +783,7 @@ func (me mapEncoder) encode(e *encodeState, v reflect.Value, opts encOpts) {
if e.ptrLevel++; e.ptrLevel > startDetectingCyclesAfter {
// We're a large number of nested ptrEncoder.encode calls deep;
// start checking if we've run into a pointer cycle.
- ptr := v.Pointer()
+ ptr := v.UnsafePointer()
if _, ok := e.ptrSeen[ptr]; ok {
e.error(&UnsupportedValueError{v, fmt.Sprintf("encountered a cycle via %s", v.Type())})
}
@@ -877,9 +876,9 @@ func (se sliceEncoder) encode(e *encodeState, v reflect.Value, opts encOpts) {
// Here we use a struct to memorize the pointer to the first element of the slice
// and its length.
ptr := struct {
- ptr uintptr
+ ptr interface{} // always an unsafe.Pointer, but avoids a dependency on package unsafe
len int
- }{v.Pointer(), v.Len()}
+ }{v.UnsafePointer(), v.Len()}
if _, ok := e.ptrSeen[ptr]; ok {
e.error(&UnsupportedValueError{v, fmt.Sprintf("encountered a cycle via %s", v.Type())})
}
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go
index 9e170127d..ab249b2bb 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go
@@ -24,8 +24,9 @@ const (
// 4) simpleLetterEqualFold, no specials, no non-letters.
//
// The letters S and K are special because they map to 3 runes, not just 2:
-// * S maps to s and to U+017F 'ſ' Latin small letter long s
-// * k maps to K and to U+212A 'K' Kelvin sign
+// - S maps to s and to U+017F 'ſ' Latin small letter long s
+// - k maps to K and to U+212A 'K' Kelvin sign
+//
// See https://play.golang.org/p/tTxjOc0OGo
//
// The returned function is specialized for matching against s and
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go
index dbaa821be..22fc6922d 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go
@@ -27,6 +27,7 @@ func Valid(data []byte) bool {
// checkValid verifies that data is valid JSON-encoded data.
// scan is passed in for use by checkValid to avoid an allocation.
+// checkValid returns nil or a SyntaxError.
func checkValid(data []byte, scan *scanner) error {
scan.reset()
for _, c := range data {
@@ -42,6 +43,7 @@ func checkValid(data []byte, scan *scanner) error {
}
// A SyntaxError is a description of a JSON syntax error.
+// Unmarshal will return a SyntaxError if the JSON can't be parsed.
type SyntaxError struct {
msg string // description of error
Offset int64 // error occurred after reading Offset bytes
diff --git a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go
index 6775b4cf8..1967755ac 100644
--- a/vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go
+++ b/vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go
@@ -289,7 +289,6 @@ var _ Unmarshaler = (*RawMessage)(nil)
// Number, for JSON numbers
// string, for JSON string literals
// nil, for JSON null
-//
type Token any
*/
diff --git a/vendor/sigs.k8s.io/json/json.go b/vendor/sigs.k8s.io/json/json.go
index d3a42b426..e8f31b16c 100644
--- a/vendor/sigs.k8s.io/json/json.go
+++ b/vendor/sigs.k8s.io/json/json.go
@@ -34,13 +34,13 @@ type Decoder interface {
}
// NewDecoderCaseSensitivePreserveInts returns a decoder that matches the behavior of encoding/json#NewDecoder, with the following changes:
-// - When unmarshaling into a struct, JSON keys must case-sensitively match `json` tag names (for tagged struct fields)
-// or struct field names (for untagged struct fields), or they are treated as unknown fields and discarded.
-// - When unmarshaling a number into an interface value, it is unmarshaled as an int64 if
-// the JSON data does not contain a "." character and parses as an integer successfully and
-// does not overflow int64. Otherwise, the number is unmarshaled as a float64.
-// - If a syntax error is returned, it will not be of type encoding/json#SyntaxError,
-// but will be recognizeable by this package's IsSyntaxError() function.
+// - When unmarshaling into a struct, JSON keys must case-sensitively match `json` tag names (for tagged struct fields)
+// or struct field names (for untagged struct fields), or they are treated as unknown fields and discarded.
+// - When unmarshaling a number into an interface value, it is unmarshaled as an int64 if
+// the JSON data does not contain a "." character and parses as an integer successfully and
+// does not overflow int64. Otherwise, the number is unmarshaled as a float64.
+// - If a syntax error is returned, it will not be of type encoding/json#SyntaxError,
+// but will be recognizeable by this package's IsSyntaxError() function.
func NewDecoderCaseSensitivePreserveInts(r io.Reader) Decoder {
d := internaljson.NewDecoder(r)
d.CaseSensitive()
@@ -51,13 +51,13 @@ func NewDecoderCaseSensitivePreserveInts(r io.Reader) Decoder {
// UnmarshalCaseSensitivePreserveInts parses the JSON-encoded data and stores the result in the value pointed to by v.
//
// UnmarshalCaseSensitivePreserveInts matches the behavior of encoding/json#Unmarshal, with the following changes:
-// - When unmarshaling into a struct, JSON keys must case-sensitively match `json` tag names (for tagged struct fields)
-// or struct field names (for untagged struct fields), or they are treated as unknown fields and discarded.
-// - When unmarshaling a number into an interface value, it is unmarshaled as an int64 if
-// the JSON data does not contain a "." character and parses as an integer successfully and
-// does not overflow int64. Otherwise, the number is unmarshaled as a float64.
-// - If a syntax error is returned, it will not be of type encoding/json#SyntaxError,
-// but will be recognizeable by this package's IsSyntaxError() function.
+// - When unmarshaling into a struct, JSON keys must case-sensitively match `json` tag names (for tagged struct fields)
+// or struct field names (for untagged struct fields), or they are treated as unknown fields and discarded.
+// - When unmarshaling a number into an interface value, it is unmarshaled as an int64 if
+// the JSON data does not contain a "." character and parses as an integer successfully and
+// does not overflow int64. Otherwise, the number is unmarshaled as a float64.
+// - If a syntax error is returned, it will not be of type encoding/json#SyntaxError,
+// but will be recognizeable by this package's IsSyntaxError() function.
func UnmarshalCaseSensitivePreserveInts(data []byte, v interface{}) error {
return internaljson.Unmarshal(
data,
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go
index 9b14ca581..41fc2474a 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go
@@ -28,20 +28,15 @@ import (
// for PathElementSet and SetNodeMap, so we could probably share the
// code.
type PathElementValueMap struct {
- members sortedPathElementValues
+ valueMap PathElementMap
}
func MakePathElementValueMap(size int) PathElementValueMap {
return PathElementValueMap{
- members: make(sortedPathElementValues, 0, size),
+ valueMap: MakePathElementMap(size),
}
}
-type pathElementValue struct {
- PathElement PathElement
- Value value.Value
-}
-
type sortedPathElementValues []pathElementValue
// Implement the sort interface; this would permit bulk creation, which would
@@ -53,7 +48,40 @@ func (spev sortedPathElementValues) Less(i, j int) bool {
func (spev sortedPathElementValues) Swap(i, j int) { spev[i], spev[j] = spev[j], spev[i] }
// Insert adds the pathelement and associated value in the map.
+// If insert is called twice with the same PathElement, the value is replaced.
func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
+ s.valueMap.Insert(pe, v)
+}
+
+// Get retrieves the value associated with the given PathElement from the map.
+// (nil, false) is returned if there is no such PathElement.
+func (s *PathElementValueMap) Get(pe PathElement) (value.Value, bool) {
+ v, ok := s.valueMap.Get(pe)
+ if !ok {
+ return nil, false
+ }
+ return v.(value.Value), true
+}
+
+// PathElementValueMap is a map from PathElement to interface{}.
+type PathElementMap struct {
+ members sortedPathElementValues
+}
+
+type pathElementValue struct {
+ PathElement PathElement
+ Value interface{}
+}
+
+func MakePathElementMap(size int) PathElementMap {
+ return PathElementMap{
+ members: make(sortedPathElementValues, 0, size),
+ }
+}
+
+// Insert adds the pathelement and associated value in the map.
+// If insert is called twice with the same PathElement, the value is replaced.
+func (s *PathElementMap) Insert(pe PathElement, v interface{}) {
loc := sort.Search(len(s.members), func(i int) bool {
return !s.members[i].PathElement.Less(pe)
})
@@ -62,6 +90,7 @@ func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
return
}
if s.members[loc].PathElement.Equals(pe) {
+ s.members[loc].Value = v
return
}
s.members = append(s.members, pathElementValue{})
@@ -71,7 +100,7 @@ func (s *PathElementValueMap) Insert(pe PathElement, v value.Value) {
// Get retrieves the value associated with the given PathElement from the map.
// (nil, false) is returned if there is no such PathElement.
-func (s *PathElementValueMap) Get(pe PathElement) (value.Value, bool) {
+func (s *PathElementMap) Get(pe PathElement) (interface{}, bool) {
loc := sort.Search(len(s.members), func(i int) bool {
return !s.members[i].PathElement.Less(pe)
})
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/conflict.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/conflict.go
index 75a492d8e..f1aa25860 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/conflict.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/conflict.go
@@ -112,7 +112,7 @@ func ConflictsFromManagers(sets fieldpath.ManagedFields) Conflicts {
set.Set().Iterate(func(p fieldpath.Path) {
conflicts = append(conflicts, Conflict{
Manager: manager,
- Path: p,
+ Path: p.Copy(),
})
})
}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go
index 1b23dcbd5..d5a977d60 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/merge/update.go
@@ -18,6 +18,7 @@ import (
"sigs.k8s.io/structured-merge-diff/v4/fieldpath"
"sigs.k8s.io/structured-merge-diff/v4/typed"
+ "sigs.k8s.io/structured-merge-diff/v4/value"
)
// Converter is an interface to the conversion logic. The converter
@@ -27,19 +28,39 @@ type Converter interface {
IsMissingVersionError(error) bool
}
-// Updater is the object used to compute updated FieldSets and also
-// merge the object on Apply.
-type Updater struct {
+// UpdateBuilder allows you to create a new Updater by exposing all of
+// the options and setting them once.
+type UpdaterBuilder struct {
Converter Converter
IgnoredFields map[fieldpath.APIVersion]*fieldpath.Set
- enableUnions bool
+ // Stop comparing the new object with old object after applying.
+ // This was initially used to avoid spurious etcd update, but
+ // since that's vastly inefficient, we've come-up with a better
+ // way of doing that. Create this flag to stop it.
+ // Comparing has become more expensive too now that we're not using
+ // `Compare` but `value.Equals` so this gives an option to avoid it.
+ ReturnInputOnNoop bool
}
-// EnableUnionFeature turns on union handling. It is disabled by default until the
-// feature is complete.
-func (s *Updater) EnableUnionFeature() {
- s.enableUnions = true
+func (u *UpdaterBuilder) BuildUpdater() *Updater {
+ return &Updater{
+ Converter: u.Converter,
+ IgnoredFields: u.IgnoredFields,
+ returnInputOnNoop: u.ReturnInputOnNoop,
+ }
+}
+
+// Updater is the object used to compute updated FieldSets and also
+// merge the object on Apply.
+type Updater struct {
+ // Deprecated: This will eventually become private.
+ Converter Converter
+
+ // Deprecated: This will eventually become private.
+ IgnoredFields map[fieldpath.APIVersion]*fieldpath.Set
+
+ returnInputOnNoop bool
}
func (s *Updater) update(oldObject, newObject *typed.TypedValue, version fieldpath.APIVersion, managers fieldpath.ManagedFields, workflow string, force bool) (fieldpath.ManagedFields, *typed.Comparison, error) {
@@ -126,12 +147,6 @@ func (s *Updater) Update(liveObject, newObject *typed.TypedValue, version fieldp
if err != nil {
return nil, fieldpath.ManagedFields{}, err
}
- if s.enableUnions {
- newObject, err = liveObject.NormalizeUnions(newObject)
- if err != nil {
- return nil, fieldpath.ManagedFields{}, err
- }
- }
managers, compare, err := s.update(liveObject, newObject, version, managers, manager, true)
if err != nil {
return nil, fieldpath.ManagedFields{}, err
@@ -145,7 +160,7 @@ func (s *Updater) Update(liveObject, newObject *typed.TypedValue, version fieldp
ignored = fieldpath.NewSet()
}
managers[manager] = fieldpath.NewVersionedSet(
- managers[manager].Set().Union(compare.Modified).Union(compare.Added).Difference(compare.Removed).RecursiveDifference(ignored),
+ managers[manager].Set().Difference(compare.Removed).Union(compare.Modified).Union(compare.Added).RecursiveDifference(ignored),
version,
false,
)
@@ -157,30 +172,17 @@ func (s *Updater) Update(liveObject, newObject *typed.TypedValue, version fieldp
// Apply should be called when Apply is run, given the current object as
// well as the configuration that is applied. This will merge the object
-// and return it. If the object hasn't changed, nil is returned (the
-// managers can still have changed though).
+// and return it.
func (s *Updater) Apply(liveObject, configObject *typed.TypedValue, version fieldpath.APIVersion, managers fieldpath.ManagedFields, manager string, force bool) (*typed.TypedValue, fieldpath.ManagedFields, error) {
var err error
managers, err = s.reconcileManagedFieldsWithSchemaChanges(liveObject, managers)
if err != nil {
return nil, fieldpath.ManagedFields{}, err
}
- if s.enableUnions {
- configObject, err = configObject.NormalizeUnionsApply(configObject)
- if err != nil {
- return nil, fieldpath.ManagedFields{}, err
- }
- }
newObject, err := liveObject.Merge(configObject)
if err != nil {
return nil, fieldpath.ManagedFields{}, fmt.Errorf("failed to merge config: %v", err)
}
- if s.enableUnions {
- newObject, err = configObject.NormalizeUnionsApply(newObject)
- if err != nil {
- return nil, fieldpath.ManagedFields{}, err
- }
- }
lastSet := managers[manager]
set, err := configObject.ToFieldSet()
if err != nil {
@@ -200,11 +202,11 @@ func (s *Updater) Apply(liveObject, configObject *typed.TypedValue, version fiel
if err != nil {
return nil, fieldpath.ManagedFields{}, fmt.Errorf("failed to prune fields: %v", err)
}
- managers, compare, err := s.update(liveObject, newObject, version, managers, manager, force)
+ managers, _, err = s.update(liveObject, newObject, version, managers, manager, force)
if err != nil {
return nil, fieldpath.ManagedFields{}, err
}
- if compare.IsSame() {
+ if !s.returnInputOnNoop && value.EqualsUsing(value.NewFreelistAllocator(), liveObject.AsValue(), newObject.AsValue()) {
newObject = nil
}
return newObject, managers, nil
@@ -218,7 +220,8 @@ func (s *Updater) prune(merged *typed.TypedValue, managers fieldpath.ManagedFiel
if lastSet == nil || lastSet.Set().Empty() {
return merged, nil
}
- convertedMerged, err := s.Converter.Convert(merged, lastSet.APIVersion())
+ version := lastSet.APIVersion()
+ convertedMerged, err := s.Converter.Convert(merged, version)
if err != nil {
if s.Converter.IsMissingVersionError(err) {
return merged, nil
@@ -228,7 +231,7 @@ func (s *Updater) prune(merged *typed.TypedValue, managers fieldpath.ManagedFiel
sc, tr := convertedMerged.Schema(), convertedMerged.TypeRef()
pruned := convertedMerged.RemoveItems(lastSet.Set().EnsureNamedFieldsAreMembers(sc, tr))
- pruned, err = s.addBackOwnedItems(convertedMerged, pruned, managers, applyingManager)
+ pruned, err = s.addBackOwnedItems(convertedMerged, pruned, version, managers, applyingManager)
if err != nil {
return nil, fmt.Errorf("failed add back owned items: %v", err)
}
@@ -241,7 +244,7 @@ func (s *Updater) prune(merged *typed.TypedValue, managers fieldpath.ManagedFiel
// addBackOwnedItems adds back any fields, list and map items that were removed by prune,
// but other appliers or updaters (or the current applier's new config) claim to own.
-func (s *Updater) addBackOwnedItems(merged, pruned *typed.TypedValue, managedFields fieldpath.ManagedFields, applyingManager string) (*typed.TypedValue, error) {
+func (s *Updater) addBackOwnedItems(merged, pruned *typed.TypedValue, prunedVersion fieldpath.APIVersion, managedFields fieldpath.ManagedFields, applyingManager string) (*typed.TypedValue, error) {
var err error
managedAtVersion := map[fieldpath.APIVersion]*fieldpath.Set{}
for _, managerSet := range managedFields {
@@ -252,7 +255,6 @@ func (s *Updater) addBackOwnedItems(merged, pruned *typed.TypedValue, managedFie
}
// Add back owned items at pruned version first to avoid conversion failure
// caused by pruned fields which are required for conversion.
- prunedVersion := fieldpath.APIVersion(*pruned.TypeRef().NamedType)
if managed, ok := managedAtVersion[prunedVersion]; ok {
merged, pruned, err = s.addBackOwnedItemsForVersion(merged, pruned, prunedVersion, managed)
if err != nil {
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go
index 7e5dc7582..5d3707a5b 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go
@@ -73,7 +73,7 @@ type Atom struct {
}
// Scalar (AKA "primitive") represents a type which has a single value which is
-// either numeric, string, or boolean.
+// either numeric, string, or boolean, or untyped for any of them.
//
// TODO: split numeric into float/int? Something even more fine-grained?
type Scalar string
@@ -82,6 +82,7 @@ const (
Numeric = Scalar("numeric")
String = Scalar("string")
Boolean = Scalar("boolean")
+ Untyped = Scalar("untyped")
)
// ElementRelationship is an enum of the different possible relationships
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go
index 7d64d1308..6eb6c36df 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go
@@ -110,7 +110,7 @@ var SchemaSchemaYAML = `types:
scalar: string
- name: deduceInvalidDiscriminator
type:
- scalar: bool
+ scalar: boolean
- name: fields
type:
list:
@@ -145,6 +145,7 @@ var SchemaSchemaYAML = `types:
list:
elementType:
scalar: string
+ elementRelationship: atomic
- name: untyped
map:
fields:
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go
new file mode 100644
index 000000000..ed483cbbc
--- /dev/null
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/compare.go
@@ -0,0 +1,460 @@
+/*
+Copyright 2018 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package typed
+
+import (
+ "fmt"
+ "strings"
+
+ "sigs.k8s.io/structured-merge-diff/v4/fieldpath"
+ "sigs.k8s.io/structured-merge-diff/v4/schema"
+ "sigs.k8s.io/structured-merge-diff/v4/value"
+)
+
+// Comparison is the return value of a TypedValue.Compare() operation.
+//
+// No field will appear in more than one of the three fieldsets. If all of the
+// fieldsets are empty, then the objects must have been equal.
+type Comparison struct {
+ // Removed contains any fields removed by rhs (the right-hand-side
+ // object in the comparison).
+ Removed *fieldpath.Set
+ // Modified contains fields present in both objects but different.
+ Modified *fieldpath.Set
+ // Added contains any fields added by rhs.
+ Added *fieldpath.Set
+}
+
+// IsSame returns true if the comparison returned no changes (the two
+// compared objects are similar).
+func (c *Comparison) IsSame() bool {
+ return c.Removed.Empty() && c.Modified.Empty() && c.Added.Empty()
+}
+
+// String returns a human readable version of the comparison.
+func (c *Comparison) String() string {
+ bld := strings.Builder{}
+ if !c.Modified.Empty() {
+ bld.WriteString(fmt.Sprintf("- Modified Fields:\n%v\n", c.Modified))
+ }
+ if !c.Added.Empty() {
+ bld.WriteString(fmt.Sprintf("- Added Fields:\n%v\n", c.Added))
+ }
+ if !c.Removed.Empty() {
+ bld.WriteString(fmt.Sprintf("- Removed Fields:\n%v\n", c.Removed))
+ }
+ return bld.String()
+}
+
+// ExcludeFields fields from the compare recursively removes the fields
+// from the entire comparison
+func (c *Comparison) ExcludeFields(fields *fieldpath.Set) *Comparison {
+ if fields == nil || fields.Empty() {
+ return c
+ }
+ c.Removed = c.Removed.RecursiveDifference(fields)
+ c.Modified = c.Modified.RecursiveDifference(fields)
+ c.Added = c.Added.RecursiveDifference(fields)
+ return c
+}
+
+type compareWalker struct {
+ lhs value.Value
+ rhs value.Value
+ schema *schema.Schema
+ typeRef schema.TypeRef
+
+ // Current path that we are comparing
+ path fieldpath.Path
+
+ // Resulting comparison.
+ comparison *Comparison
+
+ // internal housekeeping--don't set when constructing.
+ inLeaf bool // Set to true if we're in a "big leaf"--atomic map/list
+
+ // Allocate only as many walkers as needed for the depth by storing them here.
+ spareWalkers *[]*compareWalker
+
+ allocator value.Allocator
+}
+
+// compare compares stuff.
+func (w *compareWalker) compare(prefixFn func() string) (errs ValidationErrors) {
+ if w.lhs == nil && w.rhs == nil {
+ // check this condidition here instead of everywhere below.
+ return errorf("at least one of lhs and rhs must be provided")
+ }
+ a, ok := w.schema.Resolve(w.typeRef)
+ if !ok {
+ return errorf("schema error: no type found matching: %v", *w.typeRef.NamedType)
+ }
+
+ alhs := deduceAtom(a, w.lhs)
+ arhs := deduceAtom(a, w.rhs)
+
+ // deduceAtom does not fix the type for nil values
+ // nil is a wildcard and will accept whatever form the other operand takes
+ if w.rhs == nil {
+ errs = append(errs, handleAtom(alhs, w.typeRef, w)...)
+ } else if w.lhs == nil || alhs.Equals(&arhs) {
+ errs = append(errs, handleAtom(arhs, w.typeRef, w)...)
+ } else {
+ w2 := *w
+ errs = append(errs, handleAtom(alhs, w.typeRef, &w2)...)
+ errs = append(errs, handleAtom(arhs, w.typeRef, w)...)
+ }
+
+ if !w.inLeaf {
+ if w.lhs == nil {
+ w.comparison.Added.Insert(w.path)
+ } else if w.rhs == nil {
+ w.comparison.Removed.Insert(w.path)
+ }
+ }
+ return errs.WithLazyPrefix(prefixFn)
+}
+
+// doLeaf should be called on leaves before descending into children, if there
+// will be a descent. It modifies w.inLeaf.
+func (w *compareWalker) doLeaf() {
+ if w.inLeaf {
+ // We're in a "big leaf", an atomic map or list. Ignore
+ // subsequent leaves.
+ return
+ }
+ w.inLeaf = true
+
+ // We don't recurse into leaf fields for merging.
+ if w.lhs == nil {
+ w.comparison.Added.Insert(w.path)
+ } else if w.rhs == nil {
+ w.comparison.Removed.Insert(w.path)
+ } else if !value.EqualsUsing(w.allocator, w.rhs, w.lhs) {
+ // TODO: Equality is not sufficient for this.
+ // Need to implement equality check on the value type.
+ w.comparison.Modified.Insert(w.path)
+ }
+}
+
+func (w *compareWalker) doScalar(t *schema.Scalar) ValidationErrors {
+ // Make sure at least one side is a valid scalar.
+ lerrs := validateScalar(t, w.lhs, "lhs: ")
+ rerrs := validateScalar(t, w.rhs, "rhs: ")
+ if len(lerrs) > 0 && len(rerrs) > 0 {
+ return append(lerrs, rerrs...)
+ }
+
+ // All scalars are leaf fields.
+ w.doLeaf()
+
+ return nil
+}
+
+func (w *compareWalker) prepareDescent(pe fieldpath.PathElement, tr schema.TypeRef, cmp *Comparison) *compareWalker {
+ if w.spareWalkers == nil {
+ // first descent.
+ w.spareWalkers = &[]*compareWalker{}
+ }
+ var w2 *compareWalker
+ if n := len(*w.spareWalkers); n > 0 {
+ w2, *w.spareWalkers = (*w.spareWalkers)[n-1], (*w.spareWalkers)[:n-1]
+ } else {
+ w2 = &compareWalker{}
+ }
+ *w2 = *w
+ w2.typeRef = tr
+ w2.path = append(w2.path, pe)
+ w2.lhs = nil
+ w2.rhs = nil
+ w2.comparison = cmp
+ return w2
+}
+
+func (w *compareWalker) finishDescent(w2 *compareWalker) {
+ // if the descent caused a realloc, ensure that we reuse the buffer
+ // for the next sibling.
+ w.path = w2.path[:len(w2.path)-1]
+ *w.spareWalkers = append(*w.spareWalkers, w2)
+}
+
+func (w *compareWalker) derefMap(prefix string, v value.Value) (value.Map, ValidationErrors) {
+ if v == nil {
+ return nil, nil
+ }
+ m, err := mapValue(w.allocator, v)
+ if err != nil {
+ return nil, errorf("%v: %v", prefix, err)
+ }
+ return m, nil
+}
+
+func (w *compareWalker) visitListItems(t *schema.List, lhs, rhs value.List) (errs ValidationErrors) {
+ rLen := 0
+ if rhs != nil {
+ rLen = rhs.Length()
+ }
+ lLen := 0
+ if lhs != nil {
+ lLen = lhs.Length()
+ }
+
+ maxLength := rLen
+ if lLen > maxLength {
+ maxLength = lLen
+ }
+ // Contains all the unique PEs between lhs and rhs, exactly once.
+ // Order doesn't matter since we're just tracking ownership in a set.
+ allPEs := make([]fieldpath.PathElement, 0, maxLength)
+
+ // Gather all the elements from lhs, indexed by PE, in a list for duplicates.
+ lValues := fieldpath.MakePathElementMap(lLen)
+ for i := 0; i < lLen; i++ {
+ child := lhs.At(i)
+ pe, err := listItemToPathElement(w.allocator, w.schema, t, child)
+ if err != nil {
+ errs = append(errs, errorf("element %v: %v", i, err.Error())...)
+ // If we can't construct the path element, we can't
+ // even report errors deeper in the schema, so bail on
+ // this element.
+ continue
+ }
+
+ if v, found := lValues.Get(pe); found {
+ list := v.([]value.Value)
+ lValues.Insert(pe, append(list, child))
+ } else {
+ lValues.Insert(pe, []value.Value{child})
+ allPEs = append(allPEs, pe)
+ }
+ }
+
+ // Gather all the elements from rhs, indexed by PE, in a list for duplicates.
+ rValues := fieldpath.MakePathElementMap(rLen)
+ for i := 0; i < rLen; i++ {
+ rValue := rhs.At(i)
+ pe, err := listItemToPathElement(w.allocator, w.schema, t, rValue)
+ if err != nil {
+ errs = append(errs, errorf("element %v: %v", i, err.Error())...)
+ // If we can't construct the path element, we can't
+ // even report errors deeper in the schema, so bail on
+ // this element.
+ continue
+ }
+ if v, found := rValues.Get(pe); found {
+ list := v.([]value.Value)
+ rValues.Insert(pe, append(list, rValue))
+ } else {
+ rValues.Insert(pe, []value.Value{rValue})
+ if _, found := lValues.Get(pe); !found {
+ allPEs = append(allPEs, pe)
+ }
+ }
+ }
+
+ for _, pe := range allPEs {
+ lList := []value.Value(nil)
+ if l, ok := lValues.Get(pe); ok {
+ lList = l.([]value.Value)
+ }
+ rList := []value.Value(nil)
+ if l, ok := rValues.Get(pe); ok {
+ rList = l.([]value.Value)
+ }
+
+ switch {
+ case len(lList) == 0 && len(rList) == 0:
+ // We shouldn't be here anyway.
+ return
+ // Normal use-case:
+ // We have no duplicates for this PE, compare items one-to-one.
+ case len(lList) <= 1 && len(rList) <= 1:
+ lValue := value.Value(nil)
+ if len(lList) != 0 {
+ lValue = lList[0]
+ }
+ rValue := value.Value(nil)
+ if len(rList) != 0 {
+ rValue = rList[0]
+ }
+ errs = append(errs, w.compareListItem(t, pe, lValue, rValue)...)
+ // Duplicates before & after use-case:
+ // Compare the duplicates lists as if they were atomic, mark modified if they changed.
+ case len(lList) >= 2 && len(rList) >= 2:
+ listEqual := func(lList, rList []value.Value) bool {
+ if len(lList) != len(rList) {
+ return false
+ }
+ for i := range lList {
+ if !value.Equals(lList[i], rList[i]) {
+ return false
+ }
+ }
+ return true
+ }
+ if !listEqual(lList, rList) {
+ w.comparison.Modified.Insert(append(w.path, pe))
+ }
+ // Duplicates before & not anymore use-case:
+ // Rcursively add new non-duplicate items, Remove duplicate marker,
+ case len(lList) >= 2:
+ if len(rList) != 0 {
+ errs = append(errs, w.compareListItem(t, pe, nil, rList[0])...)
+ }
+ w.comparison.Removed.Insert(append(w.path, pe))
+ // New duplicates use-case:
+ // Recursively remove old non-duplicate items, add duplicate marker.
+ case len(rList) >= 2:
+ if len(lList) != 0 {
+ errs = append(errs, w.compareListItem(t, pe, lList[0], nil)...)
+ }
+ w.comparison.Added.Insert(append(w.path, pe))
+ }
+ }
+
+ return
+}
+
+func (w *compareWalker) indexListPathElements(t *schema.List, list value.List) ([]fieldpath.PathElement, fieldpath.PathElementValueMap, ValidationErrors) {
+ var errs ValidationErrors
+ length := 0
+ if list != nil {
+ length = list.Length()
+ }
+ observed := fieldpath.MakePathElementValueMap(length)
+ pes := make([]fieldpath.PathElement, 0, length)
+ for i := 0; i < length; i++ {
+ child := list.At(i)
+ pe, err := listItemToPathElement(w.allocator, w.schema, t, child)
+ if err != nil {
+ errs = append(errs, errorf("element %v: %v", i, err.Error())...)
+ // If we can't construct the path element, we can't
+ // even report errors deeper in the schema, so bail on
+ // this element.
+ continue
+ }
+ // Ignore repeated occurences of `pe`.
+ if _, found := observed.Get(pe); found {
+ continue
+ }
+ observed.Insert(pe, child)
+ pes = append(pes, pe)
+ }
+ return pes, observed, errs
+}
+
+func (w *compareWalker) compareListItem(t *schema.List, pe fieldpath.PathElement, lChild, rChild value.Value) ValidationErrors {
+ w2 := w.prepareDescent(pe, t.ElementType, w.comparison)
+ w2.lhs = lChild
+ w2.rhs = rChild
+ errs := w2.compare(pe.String)
+ w.finishDescent(w2)
+ return errs
+}
+
+func (w *compareWalker) derefList(prefix string, v value.Value) (value.List, ValidationErrors) {
+ if v == nil {
+ return nil, nil
+ }
+ l, err := listValue(w.allocator, v)
+ if err != nil {
+ return nil, errorf("%v: %v", prefix, err)
+ }
+ return l, nil
+}
+
+func (w *compareWalker) doList(t *schema.List) (errs ValidationErrors) {
+ lhs, _ := w.derefList("lhs: ", w.lhs)
+ if lhs != nil {
+ defer w.allocator.Free(lhs)
+ }
+ rhs, _ := w.derefList("rhs: ", w.rhs)
+ if rhs != nil {
+ defer w.allocator.Free(rhs)
+ }
+
+ // If both lhs and rhs are empty/null, treat it as a
+ // leaf: this helps preserve the empty/null
+ // distinction.
+ emptyPromoteToLeaf := (lhs == nil || lhs.Length() == 0) && (rhs == nil || rhs.Length() == 0)
+
+ if t.ElementRelationship == schema.Atomic || emptyPromoteToLeaf {
+ w.doLeaf()
+ return nil
+ }
+
+ if lhs == nil && rhs == nil {
+ return nil
+ }
+
+ errs = w.visitListItems(t, lhs, rhs)
+
+ return errs
+}
+
+func (w *compareWalker) visitMapItem(t *schema.Map, out map[string]interface{}, key string, lhs, rhs value.Value) (errs ValidationErrors) {
+ fieldType := t.ElementType
+ if sf, ok := t.FindField(key); ok {
+ fieldType = sf.Type
+ }
+ pe := fieldpath.PathElement{FieldName: &key}
+ w2 := w.prepareDescent(pe, fieldType, w.comparison)
+ w2.lhs = lhs
+ w2.rhs = rhs
+ errs = append(errs, w2.compare(pe.String)...)
+ w.finishDescent(w2)
+ return errs
+}
+
+func (w *compareWalker) visitMapItems(t *schema.Map, lhs, rhs value.Map) (errs ValidationErrors) {
+ out := map[string]interface{}{}
+
+ value.MapZipUsing(w.allocator, lhs, rhs, value.Unordered, func(key string, lhsValue, rhsValue value.Value) bool {
+ errs = append(errs, w.visitMapItem(t, out, key, lhsValue, rhsValue)...)
+ return true
+ })
+
+ return errs
+}
+
+func (w *compareWalker) doMap(t *schema.Map) (errs ValidationErrors) {
+ lhs, _ := w.derefMap("lhs: ", w.lhs)
+ if lhs != nil {
+ defer w.allocator.Free(lhs)
+ }
+ rhs, _ := w.derefMap("rhs: ", w.rhs)
+ if rhs != nil {
+ defer w.allocator.Free(rhs)
+ }
+ // If both lhs and rhs are empty/null, treat it as a
+ // leaf: this helps preserve the empty/null
+ // distinction.
+ emptyPromoteToLeaf := (lhs == nil || lhs.Empty()) && (rhs == nil || rhs.Empty())
+
+ if t.ElementRelationship == schema.Atomic || emptyPromoteToLeaf {
+ w.doLeaf()
+ return nil
+ }
+
+ if lhs == nil && rhs == nil {
+ return nil
+ }
+
+ errs = append(errs, w.visitMapItems(t, lhs, rhs)...)
+
+ return errs
+}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go
index 19c77334f..78fdb0e75 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go
@@ -197,7 +197,7 @@ func getAssociativeKeyDefault(s *schema.Schema, list *schema.List, fieldName str
return field.Default, nil
}
-func keyedAssociativeListItemToPathElement(a value.Allocator, s *schema.Schema, list *schema.List, index int, child value.Value) (fieldpath.PathElement, error) {
+func keyedAssociativeListItemToPathElement(a value.Allocator, s *schema.Schema, list *schema.List, child value.Value) (fieldpath.PathElement, error) {
pe := fieldpath.PathElement{}
if child.IsNull() {
// null entries are illegal.
@@ -225,7 +225,7 @@ func keyedAssociativeListItemToPathElement(a value.Allocator, s *schema.Schema,
return pe, nil
}
-func setItemToPathElement(list *schema.List, index int, child value.Value) (fieldpath.PathElement, error) {
+func setItemToPathElement(child value.Value) (fieldpath.PathElement, error) {
pe := fieldpath.PathElement{}
switch {
case child.IsMap():
@@ -245,16 +245,15 @@ func setItemToPathElement(list *schema.List, index int, child value.Value) (fiel
}
}
-func listItemToPathElement(a value.Allocator, s *schema.Schema, list *schema.List, index int, child value.Value) (fieldpath.PathElement, error) {
- if list.ElementRelationship == schema.Associative {
- if len(list.Keys) > 0 {
- return keyedAssociativeListItemToPathElement(a, s, list, index, child)
- }
+func listItemToPathElement(a value.Allocator, s *schema.Schema, list *schema.List, child value.Value) (fieldpath.PathElement, error) {
+ if list.ElementRelationship != schema.Associative {
+ return fieldpath.PathElement{}, errors.New("invalid indexing of non-associative list")
+ }
- // If there's no keys, then we must be a set of primitives.
- return setItemToPathElement(list, index, child)
+ if len(list.Keys) > 0 {
+ return keyedAssociativeListItemToPathElement(a, s, list, child)
}
- // Use the index as a key for atomic lists.
- return fieldpath.PathElement{Index: &index}, nil
+ // If there's no keys, then we must be a set of primitives.
+ return setItemToPathElement(child)
}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go
index 913644083..fa227ac40 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go
@@ -113,11 +113,12 @@ func (w *mergingWalker) doLeaf() {
w.rule(w)
}
-func (w *mergingWalker) doScalar(t *schema.Scalar) (errs ValidationErrors) {
- errs = append(errs, validateScalar(t, w.lhs, "lhs: ")...)
- errs = append(errs, validateScalar(t, w.rhs, "rhs: ")...)
- if len(errs) > 0 {
- return errs
+func (w *mergingWalker) doScalar(t *schema.Scalar) ValidationErrors {
+ // Make sure at least one side is a valid scalar.
+ lerrs := validateScalar(t, w.lhs, "lhs: ")
+ rerrs := validateScalar(t, w.rhs, "rhs: ")
+ if len(lerrs) > 0 && len(rerrs) > 0 {
+ return append(lerrs, rerrs...)
}
// All scalars are leaf fields.
@@ -179,14 +180,18 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
}
out := make([]interface{}, 0, outLen)
- rhsOrder, observedRHS, rhsErrs := w.indexListPathElements(t, rhs)
+ rhsPEs, observedRHS, rhsErrs := w.indexListPathElements(t, rhs, false)
errs = append(errs, rhsErrs...)
- lhsOrder, observedLHS, lhsErrs := w.indexListPathElements(t, lhs)
+ lhsPEs, observedLHS, lhsErrs := w.indexListPathElements(t, lhs, true)
errs = append(errs, lhsErrs...)
+ if len(errs) != 0 {
+ return errs
+ }
+
sharedOrder := make([]*fieldpath.PathElement, 0, rLen)
- for i := range rhsOrder {
- pe := &rhsOrder[i]
+ for i := range rhsPEs {
+ pe := &rhsPEs[i]
if _, ok := observedLHS.Get(*pe); ok {
sharedOrder = append(sharedOrder, pe)
}
@@ -198,13 +203,15 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
sharedOrder = sharedOrder[1:]
}
- lLen, rLen = len(lhsOrder), len(rhsOrder)
+ mergedRHS := fieldpath.MakePathElementMap(len(rhsPEs))
+ lLen, rLen = len(lhsPEs), len(rhsPEs)
for lI, rI := 0, 0; lI < lLen || rI < rLen; {
if lI < lLen && rI < rLen {
- pe := lhsOrder[lI]
- if pe.Equals(rhsOrder[rI]) {
+ pe := lhsPEs[lI]
+ if pe.Equals(rhsPEs[rI]) {
// merge LHS & RHS items
- lChild, _ := observedLHS.Get(pe)
+ mergedRHS.Insert(pe, struct{}{})
+ lChild, _ := observedLHS.Get(pe) // may be nil if the PE is duplicaated.
rChild, _ := observedRHS.Get(pe)
mergeOut, errs := w.mergeListItem(t, pe, lChild, rChild)
errs = append(errs, errs...)
@@ -221,17 +228,17 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
}
continue
}
- if _, ok := observedRHS.Get(pe); ok && nextShared != nil && !nextShared.Equals(lhsOrder[lI]) {
+ if _, ok := observedRHS.Get(pe); ok && nextShared != nil && !nextShared.Equals(lhsPEs[lI]) {
// shared item, but not the one we want in this round
lI++
continue
}
}
if lI < lLen {
- pe := lhsOrder[lI]
+ pe := lhsPEs[lI]
if _, ok := observedRHS.Get(pe); !ok {
- // take LHS item
- lChild, _ := observedLHS.Get(pe)
+ // take LHS item using At to make sure we get the right item (observed may not contain the right item).
+ lChild := lhs.AtUsing(w.allocator, lI)
mergeOut, errs := w.mergeListItem(t, pe, lChild, nil)
errs = append(errs, errs...)
if mergeOut != nil {
@@ -239,12 +246,16 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
}
lI++
continue
+ } else if _, ok := mergedRHS.Get(pe); ok {
+ // we've already merged it with RHS, we don't want to duplicate it, skip it.
+ lI++
}
}
if rI < rLen {
// Take the RHS item, merge with matching LHS item if possible
- pe := rhsOrder[rI]
- lChild, _ := observedLHS.Get(pe) // may be nil
+ pe := rhsPEs[rI]
+ mergedRHS.Insert(pe, struct{}{})
+ lChild, _ := observedLHS.Get(pe) // may be nil if absent or duplicaated.
rChild, _ := observedRHS.Get(pe)
mergeOut, errs := w.mergeListItem(t, pe, lChild, rChild)
errs = append(errs, errs...)
@@ -271,7 +282,7 @@ func (w *mergingWalker) visitListItems(t *schema.List, lhs, rhs value.List) (err
return errs
}
-func (w *mergingWalker) indexListPathElements(t *schema.List, list value.List) ([]fieldpath.PathElement, fieldpath.PathElementValueMap, ValidationErrors) {
+func (w *mergingWalker) indexListPathElements(t *schema.List, list value.List, allowDuplicates bool) ([]fieldpath.PathElement, fieldpath.PathElementValueMap, ValidationErrors) {
var errs ValidationErrors
length := 0
if list != nil {
@@ -281,7 +292,7 @@ func (w *mergingWalker) indexListPathElements(t *schema.List, list value.List) (
pes := make([]fieldpath.PathElement, 0, length)
for i := 0; i < length; i++ {
child := list.At(i)
- pe, err := listItemToPathElement(w.allocator, w.schema, t, i, child)
+ pe, err := listItemToPathElement(w.allocator, w.schema, t, child)
if err != nil {
errs = append(errs, errorf("element %v: %v", i, err.Error())...)
// If we can't construct the path element, we can't
@@ -289,11 +300,15 @@ func (w *mergingWalker) indexListPathElements(t *schema.List, list value.List) (
// this element.
continue
}
- if _, found := observed.Get(pe); found {
+ if _, found := observed.Get(pe); found && !allowDuplicates {
errs = append(errs, errorf("duplicate entries for key %v", pe.String())...)
continue
+ } else if !found {
+ observed.Insert(pe, child)
+ } else {
+ // Duplicated items are not merged with the new value, make them nil.
+ observed.Insert(pe, value.NewValueInterface(nil))
}
- observed.Insert(pe, child)
pes = append(pes, pe)
}
return pes, observed, errs
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go
index 3949a78fc..4258ee5ba 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go
@@ -93,13 +93,13 @@ func (p ParseableType) IsValid() bool {
// FromYAML parses a yaml string into an object with the current schema
// and the type "typename" or an error if validation fails.
-func (p ParseableType) FromYAML(object YAMLObject) (*TypedValue, error) {
+func (p ParseableType) FromYAML(object YAMLObject, opts ...ValidationOptions) (*TypedValue, error) {
var v interface{}
err := yaml.Unmarshal([]byte(object), &v)
if err != nil {
return nil, err
}
- return AsTyped(value.NewValueInterface(v), p.Schema, p.TypeRef)
+ return AsTyped(value.NewValueInterface(v), p.Schema, p.TypeRef, opts...)
}
// FromUnstructured converts a go "interface{}" type, typically an
@@ -108,8 +108,8 @@ func (p ParseableType) FromYAML(object YAMLObject) (*TypedValue, error) {
// The provided interface{} must be one of: map[string]interface{},
// map[interface{}]interface{}, []interface{}, int types, float types,
// string or boolean. Nested interface{} must also be one of these types.
-func (p ParseableType) FromUnstructured(in interface{}) (*TypedValue, error) {
- return AsTyped(value.NewValueInterface(in), p.Schema, p.TypeRef)
+func (p ParseableType) FromUnstructured(in interface{}, opts ...ValidationOptions) (*TypedValue, error) {
+ return AsTyped(value.NewValueInterface(in), p.Schema, p.TypeRef, opts...)
}
// FromStructured converts a go "interface{}" type, typically an structured object in
@@ -117,12 +117,12 @@ func (p ParseableType) FromUnstructured(in interface{}) (*TypedValue, error) {
// schema validation. The provided "interface{}" value must be a pointer so that the
// value can be modified via reflection. The provided "interface{}" may contain structs
// and types that are converted to Values by the jsonMarshaler interface.
-func (p ParseableType) FromStructured(in interface{}) (*TypedValue, error) {
+func (p ParseableType) FromStructured(in interface{}, opts ...ValidationOptions) (*TypedValue, error) {
v, err := value.NewValueReflect(in)
if err != nil {
return nil, fmt.Errorf("error creating struct value reflector: %v", err)
}
- return AsTyped(v, p.Schema, p.TypeRef)
+ return AsTyped(v, p.Schema, p.TypeRef, opts...)
}
// DeducedParseableType is a ParseableType that deduces the type from
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go
index a338d761d..ad071ee8f 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go
@@ -74,9 +74,9 @@ func (w *removingWalker) doList(t *schema.List) (errs ValidationErrors) {
iter := l.RangeUsing(w.allocator)
defer w.allocator.Free(iter)
for iter.Next() {
- i, item := iter.Item()
+ _, item := iter.Item()
// Ignore error because we have already validated this list
- pe, _ := listItemToPathElement(w.allocator, w.schema, t, i, item)
+ pe, _ := listItemToPathElement(w.allocator, w.schema, t, item)
path, _ := fieldpath.MakePath(pe)
// save items on the path when we shouldExtract
// but ignore them when we are removing (i.e. !w.shouldExtract)
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go
index 047efff05..d563a87ee 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go
@@ -94,9 +94,31 @@ func (v *toFieldSetWalker) doScalar(t *schema.Scalar) ValidationErrors {
}
func (v *toFieldSetWalker) visitListItems(t *schema.List, list value.List) (errs ValidationErrors) {
+ // Keeps track of the PEs we've seen
+ seen := fieldpath.MakePathElementSet(list.Length())
+ // Keeps tracks of the PEs we've counted as duplicates
+ duplicates := fieldpath.MakePathElementSet(list.Length())
for i := 0; i < list.Length(); i++ {
child := list.At(i)
- pe, _ := listItemToPathElement(v.allocator, v.schema, t, i, child)
+ pe, _ := listItemToPathElement(v.allocator, v.schema, t, child)
+ if seen.Has(pe) {
+ if duplicates.Has(pe) {
+ // do nothing
+ } else {
+ v.set.Insert(append(v.path, pe))
+ duplicates.Insert(pe)
+ }
+ } else {
+ seen.Insert(pe)
+ }
+ }
+
+ for i := 0; i < list.Length(); i++ {
+ child := list.At(i)
+ pe, _ := listItemToPathElement(v.allocator, v.schema, t, child)
+ if duplicates.Has(pe) {
+ continue
+ }
v2 := v.prepareDescent(pe, t.ElementType)
v2.value = child
errs = append(errs, v2.toFieldSet()...)
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go
index d63a97fe2..9be902828 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go
@@ -17,8 +17,6 @@ limitations under the License.
package typed
import (
- "fmt"
- "strings"
"sync"
"sigs.k8s.io/structured-merge-diff/v4/fieldpath"
@@ -26,16 +24,24 @@ import (
"sigs.k8s.io/structured-merge-diff/v4/value"
)
+// ValidationOptions is the list of all the options available when running the validation.
+type ValidationOptions int
+
+const (
+ // AllowDuplicates means that sets and associative lists can have duplicate similar items.
+ AllowDuplicates ValidationOptions = iota
+)
+
// AsTyped accepts a value and a type and returns a TypedValue. 'v' must have
// type 'typeName' in the schema. An error is returned if the v doesn't conform
// to the schema.
-func AsTyped(v value.Value, s *schema.Schema, typeRef schema.TypeRef) (*TypedValue, error) {
+func AsTyped(v value.Value, s *schema.Schema, typeRef schema.TypeRef, opts ...ValidationOptions) (*TypedValue, error) {
tv := &TypedValue{
value: v,
typeRef: typeRef,
schema: s,
}
- if err := tv.Validate(); err != nil {
+ if err := tv.Validate(opts...); err != nil {
return nil, err
}
return tv, nil
@@ -45,6 +51,10 @@ func AsTyped(v value.Value, s *schema.Schema, typeRef schema.TypeRef) (*TypedVal
// conforms to the schema, for cases where that has already been checked or
// where you're going to call a method that validates as a side-effect (like
// ToFieldSet).
+//
+// Deprecated: This function was initially created because validation
+// was expensive. Now that this has been solved, objects should always
+// be created as validated, using `AsTyped`.
func AsTypedUnvalidated(v value.Value, s *schema.Schema, typeRef schema.TypeRef) *TypedValue {
tv := &TypedValue{
value: v,
@@ -77,8 +87,14 @@ func (tv TypedValue) Schema() *schema.Schema {
}
// Validate returns an error with a list of every spec violation.
-func (tv TypedValue) Validate() error {
+func (tv TypedValue) Validate(opts ...ValidationOptions) error {
w := tv.walker()
+ for _, opt := range opts {
+ switch opt {
+ case AllowDuplicates:
+ w.allowDuplicates = true
+ }
+ }
defer w.finished()
if errs := w.validate(nil); len(errs) != 0 {
return errs
@@ -113,6 +129,10 @@ func (tv TypedValue) Merge(pso *TypedValue) (*TypedValue, error) {
return merge(&tv, pso, ruleKeepRHS, nil)
}
+var cmpwPool = sync.Pool{
+ New: func() interface{} { return &compareWalker{} },
+}
+
// Compare compares the two objects. See the comments on the `Comparison`
// struct for details on the return value.
//
@@ -120,33 +140,44 @@ func (tv TypedValue) Merge(pso *TypedValue) (*TypedValue, error) {
// match), or an error will be returned. Validation errors will be returned if
// the objects don't conform to the schema.
func (tv TypedValue) Compare(rhs *TypedValue) (c *Comparison, err error) {
- c = &Comparison{
+ lhs := tv
+ if lhs.schema != rhs.schema {
+ return nil, errorf("expected objects with types from the same schema")
+ }
+ if !lhs.typeRef.Equals(&rhs.typeRef) {
+ return nil, errorf("expected objects of the same type, but got %v and %v", lhs.typeRef, rhs.typeRef)
+ }
+
+ cmpw := cmpwPool.Get().(*compareWalker)
+ defer func() {
+ cmpw.lhs = nil
+ cmpw.rhs = nil
+ cmpw.schema = nil
+ cmpw.typeRef = schema.TypeRef{}
+ cmpw.comparison = nil
+ cmpw.inLeaf = false
+
+ cmpwPool.Put(cmpw)
+ }()
+
+ cmpw.lhs = lhs.value
+ cmpw.rhs = rhs.value
+ cmpw.schema = lhs.schema
+ cmpw.typeRef = lhs.typeRef
+ cmpw.comparison = &Comparison{
Removed: fieldpath.NewSet(),
Modified: fieldpath.NewSet(),
Added: fieldpath.NewSet(),
}
- _, err = merge(&tv, rhs, func(w *mergingWalker) {
- if w.lhs == nil {
- c.Added.Insert(w.path)
- } else if w.rhs == nil {
- c.Removed.Insert(w.path)
- } else if !value.Equals(w.rhs, w.lhs) {
- // TODO: Equality is not sufficient for this.
- // Need to implement equality check on the value type.
- c.Modified.Insert(w.path)
- }
- }, func(w *mergingWalker) {
- if w.lhs == nil {
- c.Added.Insert(w.path)
- } else if w.rhs == nil {
- c.Removed.Insert(w.path)
- }
- })
- if err != nil {
- return nil, err
+ if cmpw.allocator == nil {
+ cmpw.allocator = value.NewFreelistAllocator()
}
- return c, nil
+ errs := cmpw.compare(nil)
+ if len(errs) > 0 {
+ return nil, errs
+ }
+ return cmpw.comparison, nil
}
// RemoveItems removes each provided list or map item from the value.
@@ -161,63 +192,6 @@ func (tv TypedValue) ExtractItems(items *fieldpath.Set) *TypedValue {
return &tv
}
-// NormalizeUnions takes the new object and normalizes the union:
-// - If discriminator changed to non-nil, and a new field has been added
-// that doesn't match, an error is returned,
-// - If discriminator hasn't changed and two fields or more are set, an
-// error is returned,
-// - If discriminator changed to non-nil, all other fields but the
-// discriminated one will be cleared,
-// - Otherwise, If only one field is left, update discriminator to that value.
-//
-// Please note: union behavior isn't finalized yet and this is still experimental.
-func (tv TypedValue) NormalizeUnions(new *TypedValue) (*TypedValue, error) {
- var errs ValidationErrors
- var normalizeFn = func(w *mergingWalker) {
- if w.rhs != nil {
- v := w.rhs.Unstructured()
- w.out = &v
- }
- if err := normalizeUnions(w); err != nil {
- errs = append(errs, errorf(err.Error())...)
- }
- }
- out, mergeErrs := merge(&tv, new, func(w *mergingWalker) {}, normalizeFn)
- if mergeErrs != nil {
- errs = append(errs, mergeErrs.(ValidationErrors)...)
- }
- if len(errs) > 0 {
- return nil, errs
- }
- return out, nil
-}
-
-// NormalizeUnionsApply specifically normalize unions on apply. It
-// validates that the applied union is correct (there should be no
-// ambiguity there), and clear the fields according to the sent intent.
-//
-// Please note: union behavior isn't finalized yet and this is still experimental.
-func (tv TypedValue) NormalizeUnionsApply(new *TypedValue) (*TypedValue, error) {
- var errs ValidationErrors
- var normalizeFn = func(w *mergingWalker) {
- if w.rhs != nil {
- v := w.rhs.Unstructured()
- w.out = &v
- }
- if err := normalizeUnionsApply(w); err != nil {
- errs = append(errs, errorf(err.Error())...)
- }
- }
- out, mergeErrs := merge(&tv, new, func(w *mergingWalker) {}, normalizeFn)
- if mergeErrs != nil {
- errs = append(errs, mergeErrs.(ValidationErrors)...)
- }
- if len(errs) > 0 {
- return nil, errs
- }
- return out, nil
-}
-
func (tv TypedValue) Empty() *TypedValue {
tv.value = value.NewValueInterface(nil)
return &tv
@@ -273,50 +247,3 @@ func merge(lhs, rhs *TypedValue, rule, postRule mergeRule) (*TypedValue, error)
}
return out, nil
}
-
-// Comparison is the return value of a TypedValue.Compare() operation.
-//
-// No field will appear in more than one of the three fieldsets. If all of the
-// fieldsets are empty, then the objects must have been equal.
-type Comparison struct {
- // Removed contains any fields removed by rhs (the right-hand-side
- // object in the comparison).
- Removed *fieldpath.Set
- // Modified contains fields present in both objects but different.
- Modified *fieldpath.Set
- // Added contains any fields added by rhs.
- Added *fieldpath.Set
-}
-
-// IsSame returns true if the comparison returned no changes (the two
-// compared objects are similar).
-func (c *Comparison) IsSame() bool {
- return c.Removed.Empty() && c.Modified.Empty() && c.Added.Empty()
-}
-
-// String returns a human readable version of the comparison.
-func (c *Comparison) String() string {
- bld := strings.Builder{}
- if !c.Modified.Empty() {
- bld.WriteString(fmt.Sprintf("- Modified Fields:\n%v\n", c.Modified))
- }
- if !c.Added.Empty() {
- bld.WriteString(fmt.Sprintf("- Added Fields:\n%v\n", c.Added))
- }
- if !c.Removed.Empty() {
- bld.WriteString(fmt.Sprintf("- Removed Fields:\n%v\n", c.Removed))
- }
- return bld.String()
-}
-
-// ExcludeFields fields from the compare recursively removes the fields
-// from the entire comparison
-func (c *Comparison) ExcludeFields(fields *fieldpath.Set) *Comparison {
- if fields == nil || fields.Empty() {
- return c
- }
- c.Removed = c.Removed.RecursiveDifference(fields)
- c.Modified = c.Modified.RecursiveDifference(fields)
- c.Added = c.Added.RecursiveDifference(fields)
- return c
-}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go
deleted file mode 100644
index 1fa5d88ae..000000000
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
-Copyright 2019 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package typed
-
-import (
- "fmt"
- "strings"
-
- "sigs.k8s.io/structured-merge-diff/v4/schema"
- "sigs.k8s.io/structured-merge-diff/v4/value"
-)
-
-func normalizeUnions(w *mergingWalker) error {
- atom, found := w.schema.Resolve(w.typeRef)
- if !found {
- panic(fmt.Sprintf("Unable to resolve schema in normalize union: %v/%v", w.schema, w.typeRef))
- }
- // Unions can only be in structures, and the struct must not have been removed
- if atom.Map == nil || w.out == nil {
- return nil
- }
-
- var old value.Map
- if w.lhs != nil && !w.lhs.IsNull() {
- old = w.lhs.AsMap()
- }
- for _, union := range atom.Map.Unions {
- if err := newUnion(&union).Normalize(old, w.rhs.AsMap(), value.NewValueInterface(*w.out).AsMap()); err != nil {
- return err
- }
- }
- return nil
-}
-
-func normalizeUnionsApply(w *mergingWalker) error {
- atom, found := w.schema.Resolve(w.typeRef)
- if !found {
- panic(fmt.Sprintf("Unable to resolve schema in normalize union: %v/%v", w.schema, w.typeRef))
- }
- // Unions can only be in structures, and the struct must not have been removed
- if atom.Map == nil || w.out == nil {
- return nil
- }
-
- var old value.Map
- if w.lhs != nil && !w.lhs.IsNull() {
- old = w.lhs.AsMap()
- }
-
- for _, union := range atom.Map.Unions {
- out := value.NewValueInterface(*w.out)
- if err := newUnion(&union).NormalizeApply(old, w.rhs.AsMap(), out.AsMap()); err != nil {
- return err
- }
- *w.out = out.Unstructured()
- }
- return nil
-}
-
-type discriminated string
-type field string
-
-type discriminatedNames struct {
- f2d map[field]discriminated
- d2f map[discriminated]field
-}
-
-func newDiscriminatedName(f2d map[field]discriminated) discriminatedNames {
- d2f := map[discriminated]field{}
- for key, value := range f2d {
- d2f[value] = key
- }
- return discriminatedNames{
- f2d: f2d,
- d2f: d2f,
- }
-}
-
-func (dn discriminatedNames) toField(d discriminated) field {
- if f, ok := dn.d2f[d]; ok {
- return f
- }
- return field(d)
-}
-
-func (dn discriminatedNames) toDiscriminated(f field) discriminated {
- if d, ok := dn.f2d[f]; ok {
- return d
- }
- return discriminated(f)
-}
-
-type discriminator struct {
- name string
-}
-
-func (d *discriminator) Set(m value.Map, v discriminated) {
- if d == nil {
- return
- }
- m.Set(d.name, value.NewValueInterface(string(v)))
-}
-
-func (d *discriminator) Get(m value.Map) discriminated {
- if d == nil || m == nil {
- return ""
- }
- val, ok := m.Get(d.name)
- if !ok {
- return ""
- }
- if !val.IsString() {
- return ""
- }
- return discriminated(val.AsString())
-}
-
-type fieldsSet map[field]struct{}
-
-// newFieldsSet returns a map of the fields that are part of the union and are set
-// in the given map.
-func newFieldsSet(m value.Map, fields []field) fieldsSet {
- if m == nil {
- return nil
- }
- set := fieldsSet{}
- for _, f := range fields {
- if subField, ok := m.Get(string(f)); ok && !subField.IsNull() {
- set.Add(f)
- }
- }
- return set
-}
-
-func (fs fieldsSet) Add(f field) {
- if fs == nil {
- fs = map[field]struct{}{}
- }
- fs[f] = struct{}{}
-}
-
-func (fs fieldsSet) One() *field {
- for f := range fs {
- return &f
- }
- return nil
-}
-
-func (fs fieldsSet) Has(f field) bool {
- _, ok := fs[f]
- return ok
-}
-
-func (fs fieldsSet) List() []field {
- fields := []field{}
- for f := range fs {
- fields = append(fields, f)
- }
- return fields
-}
-
-func (fs fieldsSet) Difference(o fieldsSet) fieldsSet {
- n := fieldsSet{}
- for f := range fs {
- if !o.Has(f) {
- n.Add(f)
- }
- }
- return n
-}
-
-func (fs fieldsSet) String() string {
- s := []string{}
- for k := range fs {
- s = append(s, string(k))
- }
- return strings.Join(s, ", ")
-}
-
-type union struct {
- deduceInvalidDiscriminator bool
- d *discriminator
- dn discriminatedNames
- f []field
-}
-
-func newUnion(su *schema.Union) *union {
- u := &union{}
- if su.Discriminator != nil {
- u.d = &discriminator{name: *su.Discriminator}
- }
- f2d := map[field]discriminated{}
- for _, f := range su.Fields {
- u.f = append(u.f, field(f.FieldName))
- f2d[field(f.FieldName)] = discriminated(f.DiscriminatorValue)
- }
- u.dn = newDiscriminatedName(f2d)
- u.deduceInvalidDiscriminator = su.DeduceInvalidDiscriminator
- return u
-}
-
-// clear removes all the fields in map that are part of the union, but
-// the one we decided to keep.
-func (u *union) clear(m value.Map, f field) {
- for _, fieldName := range u.f {
- if field(fieldName) != f {
- m.Delete(string(fieldName))
- }
- }
-}
-
-func (u *union) Normalize(old, new, out value.Map) error {
- os := newFieldsSet(old, u.f)
- ns := newFieldsSet(new, u.f)
- diff := ns.Difference(os)
-
- if u.d.Get(old) != u.d.Get(new) && u.d.Get(new) != "" {
- if len(diff) == 1 && u.d.Get(new) != u.dn.toDiscriminated(*diff.One()) {
- return fmt.Errorf("discriminator (%v) and field changed (%v) don't match", u.d.Get(new), diff.One())
- }
- if len(diff) > 1 {
- return fmt.Errorf("multiple new fields added: %v", diff)
- }
- u.clear(out, u.dn.toField(u.d.Get(new)))
- return nil
- }
-
- if len(ns) > 1 {
- return fmt.Errorf("multiple fields set without discriminator change: %v", ns)
- }
-
- // Set discriminiator if it needs to be deduced.
- if u.deduceInvalidDiscriminator && len(ns) == 1 {
- u.d.Set(out, u.dn.toDiscriminated(*ns.One()))
- }
-
- return nil
-}
-
-func (u *union) NormalizeApply(applied, merged, out value.Map) error {
- as := newFieldsSet(applied, u.f)
- if len(as) > 1 {
- return fmt.Errorf("more than one field of union applied: %v", as)
- }
- if len(as) == 0 {
- // None is set, just leave.
- return nil
- }
- // We have exactly one, discriminiator must match if set
- if u.d.Get(applied) != "" && u.d.Get(applied) != u.dn.toDiscriminated(*as.One()) {
- return fmt.Errorf("applied discriminator (%v) doesn't match applied field (%v)", u.d.Get(applied), *as.One())
- }
-
- // Update discriminiator if needed
- if u.deduceInvalidDiscriminator {
- u.d.Set(out, u.dn.toDiscriminated(*as.One()))
- }
- // Clear others fields.
- u.clear(out, *as.One())
-
- return nil
-}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go
index 378d30219..652e24c81 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go
@@ -33,6 +33,7 @@ func (tv TypedValue) walker() *validatingObjectWalker {
v.value = tv.value
v.schema = tv.schema
v.typeRef = tv.typeRef
+ v.allowDuplicates = false
if v.allocator == nil {
v.allocator = value.NewFreelistAllocator()
}
@@ -49,6 +50,9 @@ type validatingObjectWalker struct {
value value.Value
schema *schema.Schema
typeRef schema.TypeRef
+ // If set to true, duplicates will be allowed in
+ // associativeLists/sets.
+ allowDuplicates bool
// Allocate only as many walkers as needed for the depth by storing them here.
spareWalkers *[]*validatingObjectWalker
@@ -102,6 +106,12 @@ func validateScalar(t *schema.Scalar, v value.Value, prefix string) (errs Valida
if !v.IsBool() {
return errorf("%vexpected boolean, got %v", prefix, v)
}
+ case schema.Untyped:
+ if !v.IsFloat() && !v.IsInt() && !v.IsString() && !v.IsBool() {
+ return errorf("%vexpected any scalar, got %v", prefix, v)
+ }
+ default:
+ return errorf("%vunexpected scalar type in schema: %v", prefix, *t)
}
return nil
}
@@ -123,7 +133,7 @@ func (v *validatingObjectWalker) visitListItems(t *schema.List, list value.List)
pe.Index = &i
} else {
var err error
- pe, err = listItemToPathElement(v.allocator, v.schema, t, i, child)
+ pe, err = listItemToPathElement(v.allocator, v.schema, t, child)
if err != nil {
errs = append(errs, errorf("element %v: %v", i, err.Error())...)
// If we can't construct the path element, we can't
@@ -131,7 +141,7 @@ func (v *validatingObjectWalker) visitListItems(t *schema.List, list value.List)
// this element.
return
}
- if observedKeys.Has(pe) {
+ if observedKeys.Has(pe) && !v.allowDuplicates {
errs = append(errs, errorf("duplicate entries for key %v", pe.String())...)
}
observedKeys.Insert(pe)
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go
index dc8b8c720..c38402b99 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go
@@ -136,7 +136,7 @@ func (r mapReflect) EqualsUsing(a Allocator, m Map) bool {
if !ok {
return false
}
- return Equals(vr.mustReuse(lhsVal, entry, nil, nil), value)
+ return EqualsUsing(a, vr.mustReuse(lhsVal, entry, nil, nil), value)
})
}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go
index d8e208628..c3ae00b18 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go
@@ -88,12 +88,12 @@ func (m mapUnstructuredInterface) EqualsUsing(a Allocator, other Map) bool {
}
vv := a.allocValueUnstructured()
defer a.Free(vv)
- return other.Iterate(func(key string, value Value) bool {
+ return other.IterateUsing(a, func(key string, value Value) bool {
lhsVal, ok := m[key]
if !ok {
return false
}
- return Equals(vv.reuse(lhsVal), value)
+ return EqualsUsing(a, vv.reuse(lhsVal), value)
})
}
@@ -168,12 +168,12 @@ func (m mapUnstructuredString) EqualsUsing(a Allocator, other Map) bool {
}
vv := a.allocValueUnstructured()
defer a.Free(vv)
- return other.Iterate(func(key string, value Value) bool {
+ return other.IterateUsing(a, func(key string, value Value) bool {
lhsVal, ok := m[key]
if !ok {
return false
}
- return Equals(vv.reuse(lhsVal), value)
+ return EqualsUsing(a, vv.reuse(lhsVal), value)
})
}
diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go
index a5a467c0f..f0d58d42c 100644
--- a/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go
+++ b/vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go
@@ -154,7 +154,9 @@ func buildStructCacheEntry(t reflect.Type, infos map[string]*FieldCacheEntry, fi
if field.Type.Kind() == reflect.Ptr {
e = field.Type.Elem()
}
- buildStructCacheEntry(e, infos, append(fieldPath, field.Index))
+ if e.Kind() == reflect.Struct {
+ buildStructCacheEntry(e, infos, append(fieldPath, field.Index))
+ }
continue
}
info := &FieldCacheEntry{JsonName: jsonName, isOmitEmpty: isOmitempty, fieldPath: append(fieldPath, field.Index), fieldType: field.Type}
diff --git a/vendor/sigs.k8s.io/yaml/LICENSE b/vendor/sigs.k8s.io/yaml/LICENSE
index 7805d36de..093d6d3ed 100644
--- a/vendor/sigs.k8s.io/yaml/LICENSE
+++ b/vendor/sigs.k8s.io/yaml/LICENSE
@@ -48,3 +48,259 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# The forked go-yaml.v3 library under this project is covered by two
+different licenses (MIT and Apache):
+
+#### MIT License ####
+
+The following files were ported to Go from C files of libyaml, and thus
+are still covered by their original MIT license, with the additional
+copyright staring in 2011 when the project was ported over:
+
+ apic.go emitterc.go parserc.go readerc.go scannerc.go
+ writerc.go yamlh.go yamlprivateh.go
+
+Copyright (c) 2006-2010 Kirill Simonov
+Copyright (c) 2006-2011 Kirill Simonov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+### Apache License ###
+
+All the remaining project files are covered by the Apache license:
+
+Copyright (c) 2011-2019 Canonical Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+# The forked go-yaml.v2 library under the project is covered by an
+Apache license:
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/sigs.k8s.io/yaml/OWNERS b/vendor/sigs.k8s.io/yaml/OWNERS
index 325b40b07..003a149e1 100644
--- a/vendor/sigs.k8s.io/yaml/OWNERS
+++ b/vendor/sigs.k8s.io/yaml/OWNERS
@@ -2,26 +2,22 @@
approvers:
- dims
-- lavalamp
+- jpbetz
- smarterclayton
- deads2k
- sttts
- liggitt
-- caesarxuchao
reviewers:
- dims
- thockin
-- lavalamp
+- jpbetz
- smarterclayton
- wojtek-t
- deads2k
- derekwaynecarr
-- caesarxuchao
- mikedanese
- liggitt
-- gmarek
- sttts
-- ncdc
- tallclair
labels:
- sig/api-machinery
diff --git a/vendor/sigs.k8s.io/yaml/fields.go b/vendor/sigs.k8s.io/yaml/fields.go
index 235b7f2cf..0ea28bd03 100644
--- a/vendor/sigs.k8s.io/yaml/fields.go
+++ b/vendor/sigs.k8s.io/yaml/fields.go
@@ -16,53 +16,53 @@ import (
"unicode/utf8"
)
-// indirect walks down v allocating pointers as needed,
+// indirect walks down 'value' allocating pointers as needed,
// until it gets to a non-pointer.
// if it encounters an Unmarshaler, indirect stops and returns that.
// if decodingNull is true, indirect stops at the last pointer so it can be set to nil.
-func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) {
- // If v is a named type and is addressable,
+func indirect(value reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) {
+ // If 'value' is a named type and is addressable,
// start with its address, so that if the type has pointer methods,
// we find them.
- if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
- v = v.Addr()
+ if value.Kind() != reflect.Ptr && value.Type().Name() != "" && value.CanAddr() {
+ value = value.Addr()
}
for {
// Load value from interface, but only if the result will be
// usefully addressable.
- if v.Kind() == reflect.Interface && !v.IsNil() {
- e := v.Elem()
- if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) {
- v = e
+ if value.Kind() == reflect.Interface && !value.IsNil() {
+ element := value.Elem()
+ if element.Kind() == reflect.Ptr && !element.IsNil() && (!decodingNull || element.Elem().Kind() == reflect.Ptr) {
+ value = element
continue
}
}
- if v.Kind() != reflect.Ptr {
+ if value.Kind() != reflect.Ptr {
break
}
- if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() {
+ if value.Elem().Kind() != reflect.Ptr && decodingNull && value.CanSet() {
break
}
- if v.IsNil() {
- if v.CanSet() {
- v.Set(reflect.New(v.Type().Elem()))
+ if value.IsNil() {
+ if value.CanSet() {
+ value.Set(reflect.New(value.Type().Elem()))
} else {
- v = reflect.New(v.Type().Elem())
+ value = reflect.New(value.Type().Elem())
}
}
- if v.Type().NumMethod() > 0 {
- if u, ok := v.Interface().(json.Unmarshaler); ok {
+ if value.Type().NumMethod() > 0 {
+ if u, ok := value.Interface().(json.Unmarshaler); ok {
return u, nil, reflect.Value{}
}
- if u, ok := v.Interface().(encoding.TextUnmarshaler); ok {
+ if u, ok := value.Interface().(encoding.TextUnmarshaler); ok {
return nil, u, reflect.Value{}
}
}
- v = v.Elem()
+ value = value.Elem()
}
- return nil, nil, v
+ return nil, nil, value
}
// A field represents a single field found in a struct.
@@ -134,8 +134,8 @@ func typeFields(t reflect.Type) []field {
next := []field{{typ: t}}
// Count of queued names for current level and the next.
- count := map[reflect.Type]int{}
- nextCount := map[reflect.Type]int{}
+ var count map[reflect.Type]int
+ var nextCount map[reflect.Type]int
// Types already visited at an earlier level.
visited := map[reflect.Type]bool{}
@@ -348,8 +348,9 @@ const (
// 4) simpleLetterEqualFold, no specials, no non-letters.
//
// The letters S and K are special because they map to 3 runes, not just 2:
-// * S maps to s and to U+017F 'ſ' Latin small letter long s
-// * k maps to K and to U+212A 'K' Kelvin sign
+// - S maps to s and to U+017F 'ſ' Latin small letter long s
+// - k maps to K and to U+212A 'K' Kelvin sign
+//
// See http://play.golang.org/p/tTxjOc0OGo
//
// The returned function is specialized for matching against s and
@@ -420,10 +421,8 @@ func equalFoldRight(s, t []byte) bool {
t = t[size:]
}
- if len(t) > 0 {
- return false
- }
- return true
+
+ return len(t) <= 0
}
// asciiEqualFold is a specialization of bytes.EqualFold for use when
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE
new file mode 100644
index 000000000..8dada3eda
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml
new file mode 100644
index 000000000..8da58fbf6
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/LICENSE.libyaml
@@ -0,0 +1,31 @@
+The following files were ported to Go from C files of libyaml, and thus
+are still covered by their original copyright and license:
+
+ apic.go
+ emitterc.go
+ parserc.go
+ readerc.go
+ scannerc.go
+ writerc.go
+ yamlh.go
+ yamlprivateh.go
+
+Copyright (c) 2006 Kirill Simonov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/NOTICE b/vendor/sigs.k8s.io/yaml/goyaml.v2/NOTICE
new file mode 100644
index 000000000..866d74a7a
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/NOTICE
@@ -0,0 +1,13 @@
+Copyright 2011-2016 Canonical Ltd.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS b/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS
new file mode 100644
index 000000000..73be0a3a9
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/OWNERS
@@ -0,0 +1,24 @@
+# See the OWNERS docs at https://go.k8s.io/owners
+
+approvers:
+- dims
+- jpbetz
+- smarterclayton
+- deads2k
+- sttts
+- liggitt
+- natasha41575
+- knverey
+reviewers:
+- dims
+- thockin
+- jpbetz
+- smarterclayton
+- deads2k
+- derekwaynecarr
+- mikedanese
+- liggitt
+- sttts
+- tallclair
+labels:
+- sig/api-machinery
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md b/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md
new file mode 100644
index 000000000..53f4139dc
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md
@@ -0,0 +1,143 @@
+# go-yaml fork
+
+This package is a fork of the go-yaml library and is intended solely for consumption
+by kubernetes projects. In this fork, we plan to support only critical changes required for
+kubernetes, such as small bug fixes and regressions. Larger, general-purpose feature requests
+should be made in the upstream go-yaml library, and we will reject such changes in this fork
+unless we are pulling them from upstream.
+
+This fork is based on v2.4.0: https://github.com/go-yaml/yaml/releases/tag/v2.4.0
+
+# YAML support for the Go language
+
+Introduction
+------------
+
+The yaml package enables Go programs to comfortably encode and decode YAML
+values. It was developed within [Canonical](https://www.canonical.com) as
+part of the [juju](https://juju.ubuntu.com) project, and is based on a
+pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML)
+C library to parse and generate YAML data quickly and reliably.
+
+Compatibility
+-------------
+
+The yaml package supports most of YAML 1.1 and 1.2, including support for
+anchors, tags, map merging, etc. Multi-document unmarshalling is not yet
+implemented, and base-60 floats from YAML 1.1 are purposefully not
+supported since they're a poor design and are gone in YAML 1.2.
+
+Installation and usage
+----------------------
+
+The import path for the package is *gopkg.in/yaml.v2*.
+
+To install it, run:
+
+ go get gopkg.in/yaml.v2
+
+API documentation
+-----------------
+
+If opened in a browser, the import path itself leads to the API documentation:
+
+ * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2)
+
+API stability
+-------------
+
+The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in).
+
+
+License
+-------
+
+The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details.
+
+
+Example
+-------
+
+```Go
+package main
+
+import (
+ "fmt"
+ "log"
+
+ "gopkg.in/yaml.v2"
+)
+
+var data = `
+a: Easy!
+b:
+ c: 2
+ d: [3, 4]
+`
+
+// Note: struct fields must be public in order for unmarshal to
+// correctly populate the data.
+type T struct {
+ A string
+ B struct {
+ RenamedC int `yaml:"c"`
+ D []int `yaml:",flow"`
+ }
+}
+
+func main() {
+ t := T{}
+
+ err := yaml.Unmarshal([]byte(data), &t)
+ if err != nil {
+ log.Fatalf("error: %v", err)
+ }
+ fmt.Printf("--- t:\n%v\n\n", t)
+
+ d, err := yaml.Marshal(&t)
+ if err != nil {
+ log.Fatalf("error: %v", err)
+ }
+ fmt.Printf("--- t dump:\n%s\n\n", string(d))
+
+ m := make(map[interface{}]interface{})
+
+ err = yaml.Unmarshal([]byte(data), &m)
+ if err != nil {
+ log.Fatalf("error: %v", err)
+ }
+ fmt.Printf("--- m:\n%v\n\n", m)
+
+ d, err = yaml.Marshal(&m)
+ if err != nil {
+ log.Fatalf("error: %v", err)
+ }
+ fmt.Printf("--- m dump:\n%s\n\n", string(d))
+}
+```
+
+This example will generate the following output:
+
+```
+--- t:
+{Easy! {2 [3 4]}}
+
+--- t dump:
+a: Easy!
+b:
+ c: 2
+ d: [3, 4]
+
+
+--- m:
+map[a:Easy! b:map[c:2 d:[3 4]]]
+
+--- m dump:
+a: Easy!
+b:
+ c: 2
+ d:
+ - 3
+ - 4
+```
+
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go
new file mode 100644
index 000000000..acf71402c
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/apic.go
@@ -0,0 +1,744 @@
+package yaml
+
+import (
+ "io"
+)
+
+func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) {
+ //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens))
+
+ // Check if we can move the queue at the beginning of the buffer.
+ if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) {
+ if parser.tokens_head != len(parser.tokens) {
+ copy(parser.tokens, parser.tokens[parser.tokens_head:])
+ }
+ parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head]
+ parser.tokens_head = 0
+ }
+ parser.tokens = append(parser.tokens, *token)
+ if pos < 0 {
+ return
+ }
+ copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:])
+ parser.tokens[parser.tokens_head+pos] = *token
+}
+
+// Create a new parser object.
+func yaml_parser_initialize(parser *yaml_parser_t) bool {
+ *parser = yaml_parser_t{
+ raw_buffer: make([]byte, 0, input_raw_buffer_size),
+ buffer: make([]byte, 0, input_buffer_size),
+ }
+ return true
+}
+
+// Destroy a parser object.
+func yaml_parser_delete(parser *yaml_parser_t) {
+ *parser = yaml_parser_t{}
+}
+
+// String read handler.
+func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) {
+ if parser.input_pos == len(parser.input) {
+ return 0, io.EOF
+ }
+ n = copy(buffer, parser.input[parser.input_pos:])
+ parser.input_pos += n
+ return n, nil
+}
+
+// Reader read handler.
+func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) {
+ return parser.input_reader.Read(buffer)
+}
+
+// Set a string input.
+func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) {
+ if parser.read_handler != nil {
+ panic("must set the input source only once")
+ }
+ parser.read_handler = yaml_string_read_handler
+ parser.input = input
+ parser.input_pos = 0
+}
+
+// Set a file input.
+func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) {
+ if parser.read_handler != nil {
+ panic("must set the input source only once")
+ }
+ parser.read_handler = yaml_reader_read_handler
+ parser.input_reader = r
+}
+
+// Set the source encoding.
+func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) {
+ if parser.encoding != yaml_ANY_ENCODING {
+ panic("must set the encoding only once")
+ }
+ parser.encoding = encoding
+}
+
+var disableLineWrapping = false
+
+// Create a new emitter object.
+func yaml_emitter_initialize(emitter *yaml_emitter_t) {
+ *emitter = yaml_emitter_t{
+ buffer: make([]byte, output_buffer_size),
+ raw_buffer: make([]byte, 0, output_raw_buffer_size),
+ states: make([]yaml_emitter_state_t, 0, initial_stack_size),
+ events: make([]yaml_event_t, 0, initial_queue_size),
+ }
+ if disableLineWrapping {
+ emitter.best_width = -1
+ }
+}
+
+// Destroy an emitter object.
+func yaml_emitter_delete(emitter *yaml_emitter_t) {
+ *emitter = yaml_emitter_t{}
+}
+
+// String write handler.
+func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error {
+ *emitter.output_buffer = append(*emitter.output_buffer, buffer...)
+ return nil
+}
+
+// yaml_writer_write_handler uses emitter.output_writer to write the
+// emitted text.
+func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error {
+ _, err := emitter.output_writer.Write(buffer)
+ return err
+}
+
+// Set a string output.
+func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) {
+ if emitter.write_handler != nil {
+ panic("must set the output target only once")
+ }
+ emitter.write_handler = yaml_string_write_handler
+ emitter.output_buffer = output_buffer
+}
+
+// Set a file output.
+func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) {
+ if emitter.write_handler != nil {
+ panic("must set the output target only once")
+ }
+ emitter.write_handler = yaml_writer_write_handler
+ emitter.output_writer = w
+}
+
+// Set the output encoding.
+func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) {
+ if emitter.encoding != yaml_ANY_ENCODING {
+ panic("must set the output encoding only once")
+ }
+ emitter.encoding = encoding
+}
+
+// Set the canonical output style.
+func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) {
+ emitter.canonical = canonical
+}
+
+//// Set the indentation increment.
+func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) {
+ if indent < 2 || indent > 9 {
+ indent = 2
+ }
+ emitter.best_indent = indent
+}
+
+// Set the preferred line width.
+func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) {
+ if width < 0 {
+ width = -1
+ }
+ emitter.best_width = width
+}
+
+// Set if unescaped non-ASCII characters are allowed.
+func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) {
+ emitter.unicode = unicode
+}
+
+// Set the preferred line break character.
+func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) {
+ emitter.line_break = line_break
+}
+
+///*
+// * Destroy a token object.
+// */
+//
+//YAML_DECLARE(void)
+//yaml_token_delete(yaml_token_t *token)
+//{
+// assert(token); // Non-NULL token object expected.
+//
+// switch (token.type)
+// {
+// case YAML_TAG_DIRECTIVE_TOKEN:
+// yaml_free(token.data.tag_directive.handle);
+// yaml_free(token.data.tag_directive.prefix);
+// break;
+//
+// case YAML_ALIAS_TOKEN:
+// yaml_free(token.data.alias.value);
+// break;
+//
+// case YAML_ANCHOR_TOKEN:
+// yaml_free(token.data.anchor.value);
+// break;
+//
+// case YAML_TAG_TOKEN:
+// yaml_free(token.data.tag.handle);
+// yaml_free(token.data.tag.suffix);
+// break;
+//
+// case YAML_SCALAR_TOKEN:
+// yaml_free(token.data.scalar.value);
+// break;
+//
+// default:
+// break;
+// }
+//
+// memset(token, 0, sizeof(yaml_token_t));
+//}
+//
+///*
+// * Check if a string is a valid UTF-8 sequence.
+// *
+// * Check 'reader.c' for more details on UTF-8 encoding.
+// */
+//
+//static int
+//yaml_check_utf8(yaml_char_t *start, size_t length)
+//{
+// yaml_char_t *end = start+length;
+// yaml_char_t *pointer = start;
+//
+// while (pointer < end) {
+// unsigned char octet;
+// unsigned int width;
+// unsigned int value;
+// size_t k;
+//
+// octet = pointer[0];
+// width = (octet & 0x80) == 0x00 ? 1 :
+// (octet & 0xE0) == 0xC0 ? 2 :
+// (octet & 0xF0) == 0xE0 ? 3 :
+// (octet & 0xF8) == 0xF0 ? 4 : 0;
+// value = (octet & 0x80) == 0x00 ? octet & 0x7F :
+// (octet & 0xE0) == 0xC0 ? octet & 0x1F :
+// (octet & 0xF0) == 0xE0 ? octet & 0x0F :
+// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0;
+// if (!width) return 0;
+// if (pointer+width > end) return 0;
+// for (k = 1; k < width; k ++) {
+// octet = pointer[k];
+// if ((octet & 0xC0) != 0x80) return 0;
+// value = (value << 6) + (octet & 0x3F);
+// }
+// if (!((width == 1) ||
+// (width == 2 && value >= 0x80) ||
+// (width == 3 && value >= 0x800) ||
+// (width == 4 && value >= 0x10000))) return 0;
+//
+// pointer += width;
+// }
+//
+// return 1;
+//}
+//
+
+// Create STREAM-START.
+func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) {
+ *event = yaml_event_t{
+ typ: yaml_STREAM_START_EVENT,
+ encoding: encoding,
+ }
+}
+
+// Create STREAM-END.
+func yaml_stream_end_event_initialize(event *yaml_event_t) {
+ *event = yaml_event_t{
+ typ: yaml_STREAM_END_EVENT,
+ }
+}
+
+// Create DOCUMENT-START.
+func yaml_document_start_event_initialize(
+ event *yaml_event_t,
+ version_directive *yaml_version_directive_t,
+ tag_directives []yaml_tag_directive_t,
+ implicit bool,
+) {
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_START_EVENT,
+ version_directive: version_directive,
+ tag_directives: tag_directives,
+ implicit: implicit,
+ }
+}
+
+// Create DOCUMENT-END.
+func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) {
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_END_EVENT,
+ implicit: implicit,
+ }
+}
+
+///*
+// * Create ALIAS.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_alias_event_initialize(event *yaml_event_t, anchor *yaml_char_t)
+//{
+// mark yaml_mark_t = { 0, 0, 0 }
+// anchor_copy *yaml_char_t = NULL
+//
+// assert(event) // Non-NULL event object is expected.
+// assert(anchor) // Non-NULL anchor is expected.
+//
+// if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0
+//
+// anchor_copy = yaml_strdup(anchor)
+// if (!anchor_copy)
+// return 0
+//
+// ALIAS_EVENT_INIT(*event, anchor_copy, mark, mark)
+//
+// return 1
+//}
+
+// Create SCALAR.
+func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool {
+ *event = yaml_event_t{
+ typ: yaml_SCALAR_EVENT,
+ anchor: anchor,
+ tag: tag,
+ value: value,
+ implicit: plain_implicit,
+ quoted_implicit: quoted_implicit,
+ style: yaml_style_t(style),
+ }
+ return true
+}
+
+// Create SEQUENCE-START.
+func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool {
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_START_EVENT,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(style),
+ }
+ return true
+}
+
+// Create SEQUENCE-END.
+func yaml_sequence_end_event_initialize(event *yaml_event_t) bool {
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_END_EVENT,
+ }
+ return true
+}
+
+// Create MAPPING-START.
+func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) {
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_START_EVENT,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(style),
+ }
+}
+
+// Create MAPPING-END.
+func yaml_mapping_end_event_initialize(event *yaml_event_t) {
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_END_EVENT,
+ }
+}
+
+// Destroy an event object.
+func yaml_event_delete(event *yaml_event_t) {
+ *event = yaml_event_t{}
+}
+
+///*
+// * Create a document object.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_initialize(document *yaml_document_t,
+// version_directive *yaml_version_directive_t,
+// tag_directives_start *yaml_tag_directive_t,
+// tag_directives_end *yaml_tag_directive_t,
+// start_implicit int, end_implicit int)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// struct {
+// start *yaml_node_t
+// end *yaml_node_t
+// top *yaml_node_t
+// } nodes = { NULL, NULL, NULL }
+// version_directive_copy *yaml_version_directive_t = NULL
+// struct {
+// start *yaml_tag_directive_t
+// end *yaml_tag_directive_t
+// top *yaml_tag_directive_t
+// } tag_directives_copy = { NULL, NULL, NULL }
+// value yaml_tag_directive_t = { NULL, NULL }
+// mark yaml_mark_t = { 0, 0, 0 }
+//
+// assert(document) // Non-NULL document object is expected.
+// assert((tag_directives_start && tag_directives_end) ||
+// (tag_directives_start == tag_directives_end))
+// // Valid tag directives are expected.
+//
+// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error
+//
+// if (version_directive) {
+// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t))
+// if (!version_directive_copy) goto error
+// version_directive_copy.major = version_directive.major
+// version_directive_copy.minor = version_directive.minor
+// }
+//
+// if (tag_directives_start != tag_directives_end) {
+// tag_directive *yaml_tag_directive_t
+// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE))
+// goto error
+// for (tag_directive = tag_directives_start
+// tag_directive != tag_directives_end; tag_directive ++) {
+// assert(tag_directive.handle)
+// assert(tag_directive.prefix)
+// if (!yaml_check_utf8(tag_directive.handle,
+// strlen((char *)tag_directive.handle)))
+// goto error
+// if (!yaml_check_utf8(tag_directive.prefix,
+// strlen((char *)tag_directive.prefix)))
+// goto error
+// value.handle = yaml_strdup(tag_directive.handle)
+// value.prefix = yaml_strdup(tag_directive.prefix)
+// if (!value.handle || !value.prefix) goto error
+// if (!PUSH(&context, tag_directives_copy, value))
+// goto error
+// value.handle = NULL
+// value.prefix = NULL
+// }
+// }
+//
+// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy,
+// tag_directives_copy.start, tag_directives_copy.top,
+// start_implicit, end_implicit, mark, mark)
+//
+// return 1
+//
+//error:
+// STACK_DEL(&context, nodes)
+// yaml_free(version_directive_copy)
+// while (!STACK_EMPTY(&context, tag_directives_copy)) {
+// value yaml_tag_directive_t = POP(&context, tag_directives_copy)
+// yaml_free(value.handle)
+// yaml_free(value.prefix)
+// }
+// STACK_DEL(&context, tag_directives_copy)
+// yaml_free(value.handle)
+// yaml_free(value.prefix)
+//
+// return 0
+//}
+//
+///*
+// * Destroy a document object.
+// */
+//
+//YAML_DECLARE(void)
+//yaml_document_delete(document *yaml_document_t)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// tag_directive *yaml_tag_directive_t
+//
+// context.error = YAML_NO_ERROR // Eliminate a compiler warning.
+//
+// assert(document) // Non-NULL document object is expected.
+//
+// while (!STACK_EMPTY(&context, document.nodes)) {
+// node yaml_node_t = POP(&context, document.nodes)
+// yaml_free(node.tag)
+// switch (node.type) {
+// case YAML_SCALAR_NODE:
+// yaml_free(node.data.scalar.value)
+// break
+// case YAML_SEQUENCE_NODE:
+// STACK_DEL(&context, node.data.sequence.items)
+// break
+// case YAML_MAPPING_NODE:
+// STACK_DEL(&context, node.data.mapping.pairs)
+// break
+// default:
+// assert(0) // Should not happen.
+// }
+// }
+// STACK_DEL(&context, document.nodes)
+//
+// yaml_free(document.version_directive)
+// for (tag_directive = document.tag_directives.start
+// tag_directive != document.tag_directives.end
+// tag_directive++) {
+// yaml_free(tag_directive.handle)
+// yaml_free(tag_directive.prefix)
+// }
+// yaml_free(document.tag_directives.start)
+//
+// memset(document, 0, sizeof(yaml_document_t))
+//}
+//
+///**
+// * Get a document node.
+// */
+//
+//YAML_DECLARE(yaml_node_t *)
+//yaml_document_get_node(document *yaml_document_t, index int)
+//{
+// assert(document) // Non-NULL document object is expected.
+//
+// if (index > 0 && document.nodes.start + index <= document.nodes.top) {
+// return document.nodes.start + index - 1
+// }
+// return NULL
+//}
+//
+///**
+// * Get the root object.
+// */
+//
+//YAML_DECLARE(yaml_node_t *)
+//yaml_document_get_root_node(document *yaml_document_t)
+//{
+// assert(document) // Non-NULL document object is expected.
+//
+// if (document.nodes.top != document.nodes.start) {
+// return document.nodes.start
+// }
+// return NULL
+//}
+//
+///*
+// * Add a scalar node to a document.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_add_scalar(document *yaml_document_t,
+// tag *yaml_char_t, value *yaml_char_t, length int,
+// style yaml_scalar_style_t)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// mark yaml_mark_t = { 0, 0, 0 }
+// tag_copy *yaml_char_t = NULL
+// value_copy *yaml_char_t = NULL
+// node yaml_node_t
+//
+// assert(document) // Non-NULL document object is expected.
+// assert(value) // Non-NULL value is expected.
+//
+// if (!tag) {
+// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG
+// }
+//
+// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error
+// tag_copy = yaml_strdup(tag)
+// if (!tag_copy) goto error
+//
+// if (length < 0) {
+// length = strlen((char *)value)
+// }
+//
+// if (!yaml_check_utf8(value, length)) goto error
+// value_copy = yaml_malloc(length+1)
+// if (!value_copy) goto error
+// memcpy(value_copy, value, length)
+// value_copy[length] = '\0'
+//
+// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark)
+// if (!PUSH(&context, document.nodes, node)) goto error
+//
+// return document.nodes.top - document.nodes.start
+//
+//error:
+// yaml_free(tag_copy)
+// yaml_free(value_copy)
+//
+// return 0
+//}
+//
+///*
+// * Add a sequence node to a document.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_add_sequence(document *yaml_document_t,
+// tag *yaml_char_t, style yaml_sequence_style_t)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// mark yaml_mark_t = { 0, 0, 0 }
+// tag_copy *yaml_char_t = NULL
+// struct {
+// start *yaml_node_item_t
+// end *yaml_node_item_t
+// top *yaml_node_item_t
+// } items = { NULL, NULL, NULL }
+// node yaml_node_t
+//
+// assert(document) // Non-NULL document object is expected.
+//
+// if (!tag) {
+// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG
+// }
+//
+// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error
+// tag_copy = yaml_strdup(tag)
+// if (!tag_copy) goto error
+//
+// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error
+//
+// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end,
+// style, mark, mark)
+// if (!PUSH(&context, document.nodes, node)) goto error
+//
+// return document.nodes.top - document.nodes.start
+//
+//error:
+// STACK_DEL(&context, items)
+// yaml_free(tag_copy)
+//
+// return 0
+//}
+//
+///*
+// * Add a mapping node to a document.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_add_mapping(document *yaml_document_t,
+// tag *yaml_char_t, style yaml_mapping_style_t)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+// mark yaml_mark_t = { 0, 0, 0 }
+// tag_copy *yaml_char_t = NULL
+// struct {
+// start *yaml_node_pair_t
+// end *yaml_node_pair_t
+// top *yaml_node_pair_t
+// } pairs = { NULL, NULL, NULL }
+// node yaml_node_t
+//
+// assert(document) // Non-NULL document object is expected.
+//
+// if (!tag) {
+// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG
+// }
+//
+// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error
+// tag_copy = yaml_strdup(tag)
+// if (!tag_copy) goto error
+//
+// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error
+//
+// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end,
+// style, mark, mark)
+// if (!PUSH(&context, document.nodes, node)) goto error
+//
+// return document.nodes.top - document.nodes.start
+//
+//error:
+// STACK_DEL(&context, pairs)
+// yaml_free(tag_copy)
+//
+// return 0
+//}
+//
+///*
+// * Append an item to a sequence node.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_append_sequence_item(document *yaml_document_t,
+// sequence int, item int)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+//
+// assert(document) // Non-NULL document is required.
+// assert(sequence > 0
+// && document.nodes.start + sequence <= document.nodes.top)
+// // Valid sequence id is required.
+// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE)
+// // A sequence node is required.
+// assert(item > 0 && document.nodes.start + item <= document.nodes.top)
+// // Valid item id is required.
+//
+// if (!PUSH(&context,
+// document.nodes.start[sequence-1].data.sequence.items, item))
+// return 0
+//
+// return 1
+//}
+//
+///*
+// * Append a pair of a key and a value to a mapping node.
+// */
+//
+//YAML_DECLARE(int)
+//yaml_document_append_mapping_pair(document *yaml_document_t,
+// mapping int, key int, value int)
+//{
+// struct {
+// error yaml_error_type_t
+// } context
+//
+// pair yaml_node_pair_t
+//
+// assert(document) // Non-NULL document is required.
+// assert(mapping > 0
+// && document.nodes.start + mapping <= document.nodes.top)
+// // Valid mapping id is required.
+// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE)
+// // A mapping node is required.
+// assert(key > 0 && document.nodes.start + key <= document.nodes.top)
+// // Valid key id is required.
+// assert(value > 0 && document.nodes.start + value <= document.nodes.top)
+// // Valid value id is required.
+//
+// pair.key = key
+// pair.value = value
+//
+// if (!PUSH(&context,
+// document.nodes.start[mapping-1].data.mapping.pairs, pair))
+// return 0
+//
+// return 1
+//}
+//
+//
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go
new file mode 100644
index 000000000..129bc2a97
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/decode.go
@@ -0,0 +1,815 @@
+package yaml
+
+import (
+ "encoding"
+ "encoding/base64"
+ "fmt"
+ "io"
+ "math"
+ "reflect"
+ "strconv"
+ "time"
+)
+
+const (
+ documentNode = 1 << iota
+ mappingNode
+ sequenceNode
+ scalarNode
+ aliasNode
+)
+
+type node struct {
+ kind int
+ line, column int
+ tag string
+ // For an alias node, alias holds the resolved alias.
+ alias *node
+ value string
+ implicit bool
+ children []*node
+ anchors map[string]*node
+}
+
+// ----------------------------------------------------------------------------
+// Parser, produces a node tree out of a libyaml event stream.
+
+type parser struct {
+ parser yaml_parser_t
+ event yaml_event_t
+ doc *node
+ doneInit bool
+}
+
+func newParser(b []byte) *parser {
+ p := parser{}
+ if !yaml_parser_initialize(&p.parser) {
+ panic("failed to initialize YAML emitter")
+ }
+ if len(b) == 0 {
+ b = []byte{'\n'}
+ }
+ yaml_parser_set_input_string(&p.parser, b)
+ return &p
+}
+
+func newParserFromReader(r io.Reader) *parser {
+ p := parser{}
+ if !yaml_parser_initialize(&p.parser) {
+ panic("failed to initialize YAML emitter")
+ }
+ yaml_parser_set_input_reader(&p.parser, r)
+ return &p
+}
+
+func (p *parser) init() {
+ if p.doneInit {
+ return
+ }
+ p.expect(yaml_STREAM_START_EVENT)
+ p.doneInit = true
+}
+
+func (p *parser) destroy() {
+ if p.event.typ != yaml_NO_EVENT {
+ yaml_event_delete(&p.event)
+ }
+ yaml_parser_delete(&p.parser)
+}
+
+// expect consumes an event from the event stream and
+// checks that it's of the expected type.
+func (p *parser) expect(e yaml_event_type_t) {
+ if p.event.typ == yaml_NO_EVENT {
+ if !yaml_parser_parse(&p.parser, &p.event) {
+ p.fail()
+ }
+ }
+ if p.event.typ == yaml_STREAM_END_EVENT {
+ failf("attempted to go past the end of stream; corrupted value?")
+ }
+ if p.event.typ != e {
+ p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ)
+ p.fail()
+ }
+ yaml_event_delete(&p.event)
+ p.event.typ = yaml_NO_EVENT
+}
+
+// peek peeks at the next event in the event stream,
+// puts the results into p.event and returns the event type.
+func (p *parser) peek() yaml_event_type_t {
+ if p.event.typ != yaml_NO_EVENT {
+ return p.event.typ
+ }
+ if !yaml_parser_parse(&p.parser, &p.event) {
+ p.fail()
+ }
+ return p.event.typ
+}
+
+func (p *parser) fail() {
+ var where string
+ var line int
+ if p.parser.problem_mark.line != 0 {
+ line = p.parser.problem_mark.line
+ // Scanner errors don't iterate line before returning error
+ if p.parser.error == yaml_SCANNER_ERROR {
+ line++
+ }
+ } else if p.parser.context_mark.line != 0 {
+ line = p.parser.context_mark.line
+ }
+ if line != 0 {
+ where = "line " + strconv.Itoa(line) + ": "
+ }
+ var msg string
+ if len(p.parser.problem) > 0 {
+ msg = p.parser.problem
+ } else {
+ msg = "unknown problem parsing YAML content"
+ }
+ failf("%s%s", where, msg)
+}
+
+func (p *parser) anchor(n *node, anchor []byte) {
+ if anchor != nil {
+ p.doc.anchors[string(anchor)] = n
+ }
+}
+
+func (p *parser) parse() *node {
+ p.init()
+ switch p.peek() {
+ case yaml_SCALAR_EVENT:
+ return p.scalar()
+ case yaml_ALIAS_EVENT:
+ return p.alias()
+ case yaml_MAPPING_START_EVENT:
+ return p.mapping()
+ case yaml_SEQUENCE_START_EVENT:
+ return p.sequence()
+ case yaml_DOCUMENT_START_EVENT:
+ return p.document()
+ case yaml_STREAM_END_EVENT:
+ // Happens when attempting to decode an empty buffer.
+ return nil
+ default:
+ panic("attempted to parse unknown event: " + p.event.typ.String())
+ }
+}
+
+func (p *parser) node(kind int) *node {
+ return &node{
+ kind: kind,
+ line: p.event.start_mark.line,
+ column: p.event.start_mark.column,
+ }
+}
+
+func (p *parser) document() *node {
+ n := p.node(documentNode)
+ n.anchors = make(map[string]*node)
+ p.doc = n
+ p.expect(yaml_DOCUMENT_START_EVENT)
+ n.children = append(n.children, p.parse())
+ p.expect(yaml_DOCUMENT_END_EVENT)
+ return n
+}
+
+func (p *parser) alias() *node {
+ n := p.node(aliasNode)
+ n.value = string(p.event.anchor)
+ n.alias = p.doc.anchors[n.value]
+ if n.alias == nil {
+ failf("unknown anchor '%s' referenced", n.value)
+ }
+ p.expect(yaml_ALIAS_EVENT)
+ return n
+}
+
+func (p *parser) scalar() *node {
+ n := p.node(scalarNode)
+ n.value = string(p.event.value)
+ n.tag = string(p.event.tag)
+ n.implicit = p.event.implicit
+ p.anchor(n, p.event.anchor)
+ p.expect(yaml_SCALAR_EVENT)
+ return n
+}
+
+func (p *parser) sequence() *node {
+ n := p.node(sequenceNode)
+ p.anchor(n, p.event.anchor)
+ p.expect(yaml_SEQUENCE_START_EVENT)
+ for p.peek() != yaml_SEQUENCE_END_EVENT {
+ n.children = append(n.children, p.parse())
+ }
+ p.expect(yaml_SEQUENCE_END_EVENT)
+ return n
+}
+
+func (p *parser) mapping() *node {
+ n := p.node(mappingNode)
+ p.anchor(n, p.event.anchor)
+ p.expect(yaml_MAPPING_START_EVENT)
+ for p.peek() != yaml_MAPPING_END_EVENT {
+ n.children = append(n.children, p.parse(), p.parse())
+ }
+ p.expect(yaml_MAPPING_END_EVENT)
+ return n
+}
+
+// ----------------------------------------------------------------------------
+// Decoder, unmarshals a node into a provided value.
+
+type decoder struct {
+ doc *node
+ aliases map[*node]bool
+ mapType reflect.Type
+ terrors []string
+ strict bool
+
+ decodeCount int
+ aliasCount int
+ aliasDepth int
+}
+
+var (
+ mapItemType = reflect.TypeOf(MapItem{})
+ durationType = reflect.TypeOf(time.Duration(0))
+ defaultMapType = reflect.TypeOf(map[interface{}]interface{}{})
+ ifaceType = defaultMapType.Elem()
+ timeType = reflect.TypeOf(time.Time{})
+ ptrTimeType = reflect.TypeOf(&time.Time{})
+)
+
+func newDecoder(strict bool) *decoder {
+ d := &decoder{mapType: defaultMapType, strict: strict}
+ d.aliases = make(map[*node]bool)
+ return d
+}
+
+func (d *decoder) terror(n *node, tag string, out reflect.Value) {
+ if n.tag != "" {
+ tag = n.tag
+ }
+ value := n.value
+ if tag != yaml_SEQ_TAG && tag != yaml_MAP_TAG {
+ if len(value) > 10 {
+ value = " `" + value[:7] + "...`"
+ } else {
+ value = " `" + value + "`"
+ }
+ }
+ d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.line+1, shortTag(tag), value, out.Type()))
+}
+
+func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) {
+ terrlen := len(d.terrors)
+ err := u.UnmarshalYAML(func(v interface{}) (err error) {
+ defer handleErr(&err)
+ d.unmarshal(n, reflect.ValueOf(v))
+ if len(d.terrors) > terrlen {
+ issues := d.terrors[terrlen:]
+ d.terrors = d.terrors[:terrlen]
+ return &TypeError{issues}
+ }
+ return nil
+ })
+ if e, ok := err.(*TypeError); ok {
+ d.terrors = append(d.terrors, e.Errors...)
+ return false
+ }
+ if err != nil {
+ fail(err)
+ }
+ return true
+}
+
+// d.prepare initializes and dereferences pointers and calls UnmarshalYAML
+// if a value is found to implement it.
+// It returns the initialized and dereferenced out value, whether
+// unmarshalling was already done by UnmarshalYAML, and if so whether
+// its types unmarshalled appropriately.
+//
+// If n holds a null value, prepare returns before doing anything.
+func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) {
+ if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "~" || n.value == "" && n.implicit) {
+ return out, false, false
+ }
+ again := true
+ for again {
+ again = false
+ if out.Kind() == reflect.Ptr {
+ if out.IsNil() {
+ out.Set(reflect.New(out.Type().Elem()))
+ }
+ out = out.Elem()
+ again = true
+ }
+ if out.CanAddr() {
+ if u, ok := out.Addr().Interface().(Unmarshaler); ok {
+ good = d.callUnmarshaler(n, u)
+ return out, true, good
+ }
+ }
+ }
+ return out, false, false
+}
+
+const (
+ // 400,000 decode operations is ~500kb of dense object declarations, or
+ // ~5kb of dense object declarations with 10000% alias expansion
+ alias_ratio_range_low = 400000
+
+ // 4,000,000 decode operations is ~5MB of dense object declarations, or
+ // ~4.5MB of dense object declarations with 10% alias expansion
+ alias_ratio_range_high = 4000000
+
+ // alias_ratio_range is the range over which we scale allowed alias ratios
+ alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low)
+)
+
+func allowedAliasRatio(decodeCount int) float64 {
+ switch {
+ case decodeCount <= alias_ratio_range_low:
+ // allow 99% to come from alias expansion for small-to-medium documents
+ return 0.99
+ case decodeCount >= alias_ratio_range_high:
+ // allow 10% to come from alias expansion for very large documents
+ return 0.10
+ default:
+ // scale smoothly from 99% down to 10% over the range.
+ // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range.
+ // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps).
+ return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range)
+ }
+}
+
+func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) {
+ d.decodeCount++
+ if d.aliasDepth > 0 {
+ d.aliasCount++
+ }
+ if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) {
+ failf("document contains excessive aliasing")
+ }
+ switch n.kind {
+ case documentNode:
+ return d.document(n, out)
+ case aliasNode:
+ return d.alias(n, out)
+ }
+ out, unmarshaled, good := d.prepare(n, out)
+ if unmarshaled {
+ return good
+ }
+ switch n.kind {
+ case scalarNode:
+ good = d.scalar(n, out)
+ case mappingNode:
+ good = d.mapping(n, out)
+ case sequenceNode:
+ good = d.sequence(n, out)
+ default:
+ panic("internal error: unknown node kind: " + strconv.Itoa(n.kind))
+ }
+ return good
+}
+
+func (d *decoder) document(n *node, out reflect.Value) (good bool) {
+ if len(n.children) == 1 {
+ d.doc = n
+ d.unmarshal(n.children[0], out)
+ return true
+ }
+ return false
+}
+
+func (d *decoder) alias(n *node, out reflect.Value) (good bool) {
+ if d.aliases[n] {
+ // TODO this could actually be allowed in some circumstances.
+ failf("anchor '%s' value contains itself", n.value)
+ }
+ d.aliases[n] = true
+ d.aliasDepth++
+ good = d.unmarshal(n.alias, out)
+ d.aliasDepth--
+ delete(d.aliases, n)
+ return good
+}
+
+var zeroValue reflect.Value
+
+func resetMap(out reflect.Value) {
+ for _, k := range out.MapKeys() {
+ out.SetMapIndex(k, zeroValue)
+ }
+}
+
+func (d *decoder) scalar(n *node, out reflect.Value) bool {
+ var tag string
+ var resolved interface{}
+ if n.tag == "" && !n.implicit {
+ tag = yaml_STR_TAG
+ resolved = n.value
+ } else {
+ tag, resolved = resolve(n.tag, n.value)
+ if tag == yaml_BINARY_TAG {
+ data, err := base64.StdEncoding.DecodeString(resolved.(string))
+ if err != nil {
+ failf("!!binary value contains invalid base64 data")
+ }
+ resolved = string(data)
+ }
+ }
+ if resolved == nil {
+ if out.Kind() == reflect.Map && !out.CanAddr() {
+ resetMap(out)
+ } else {
+ out.Set(reflect.Zero(out.Type()))
+ }
+ return true
+ }
+ if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() {
+ // We've resolved to exactly the type we want, so use that.
+ out.Set(resolvedv)
+ return true
+ }
+ // Perhaps we can use the value as a TextUnmarshaler to
+ // set its value.
+ if out.CanAddr() {
+ u, ok := out.Addr().Interface().(encoding.TextUnmarshaler)
+ if ok {
+ var text []byte
+ if tag == yaml_BINARY_TAG {
+ text = []byte(resolved.(string))
+ } else {
+ // We let any value be unmarshaled into TextUnmarshaler.
+ // That might be more lax than we'd like, but the
+ // TextUnmarshaler itself should bowl out any dubious values.
+ text = []byte(n.value)
+ }
+ err := u.UnmarshalText(text)
+ if err != nil {
+ fail(err)
+ }
+ return true
+ }
+ }
+ switch out.Kind() {
+ case reflect.String:
+ if tag == yaml_BINARY_TAG {
+ out.SetString(resolved.(string))
+ return true
+ }
+ if resolved != nil {
+ out.SetString(n.value)
+ return true
+ }
+ case reflect.Interface:
+ if resolved == nil {
+ out.Set(reflect.Zero(out.Type()))
+ } else if tag == yaml_TIMESTAMP_TAG {
+ // It looks like a timestamp but for backward compatibility
+ // reasons we set it as a string, so that code that unmarshals
+ // timestamp-like values into interface{} will continue to
+ // see a string and not a time.Time.
+ // TODO(v3) Drop this.
+ out.Set(reflect.ValueOf(n.value))
+ } else {
+ out.Set(reflect.ValueOf(resolved))
+ }
+ return true
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ switch resolved := resolved.(type) {
+ case int:
+ if !out.OverflowInt(int64(resolved)) {
+ out.SetInt(int64(resolved))
+ return true
+ }
+ case int64:
+ if !out.OverflowInt(resolved) {
+ out.SetInt(resolved)
+ return true
+ }
+ case uint64:
+ if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) {
+ out.SetInt(int64(resolved))
+ return true
+ }
+ case float64:
+ if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) {
+ out.SetInt(int64(resolved))
+ return true
+ }
+ case string:
+ if out.Type() == durationType {
+ d, err := time.ParseDuration(resolved)
+ if err == nil {
+ out.SetInt(int64(d))
+ return true
+ }
+ }
+ }
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ switch resolved := resolved.(type) {
+ case int:
+ if resolved >= 0 && !out.OverflowUint(uint64(resolved)) {
+ out.SetUint(uint64(resolved))
+ return true
+ }
+ case int64:
+ if resolved >= 0 && !out.OverflowUint(uint64(resolved)) {
+ out.SetUint(uint64(resolved))
+ return true
+ }
+ case uint64:
+ if !out.OverflowUint(uint64(resolved)) {
+ out.SetUint(uint64(resolved))
+ return true
+ }
+ case float64:
+ if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) {
+ out.SetUint(uint64(resolved))
+ return true
+ }
+ }
+ case reflect.Bool:
+ switch resolved := resolved.(type) {
+ case bool:
+ out.SetBool(resolved)
+ return true
+ }
+ case reflect.Float32, reflect.Float64:
+ switch resolved := resolved.(type) {
+ case int:
+ out.SetFloat(float64(resolved))
+ return true
+ case int64:
+ out.SetFloat(float64(resolved))
+ return true
+ case uint64:
+ out.SetFloat(float64(resolved))
+ return true
+ case float64:
+ out.SetFloat(resolved)
+ return true
+ }
+ case reflect.Struct:
+ if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() {
+ out.Set(resolvedv)
+ return true
+ }
+ case reflect.Ptr:
+ if out.Type().Elem() == reflect.TypeOf(resolved) {
+ // TODO DOes this make sense? When is out a Ptr except when decoding a nil value?
+ elem := reflect.New(out.Type().Elem())
+ elem.Elem().Set(reflect.ValueOf(resolved))
+ out.Set(elem)
+ return true
+ }
+ }
+ d.terror(n, tag, out)
+ return false
+}
+
+func settableValueOf(i interface{}) reflect.Value {
+ v := reflect.ValueOf(i)
+ sv := reflect.New(v.Type()).Elem()
+ sv.Set(v)
+ return sv
+}
+
+func (d *decoder) sequence(n *node, out reflect.Value) (good bool) {
+ l := len(n.children)
+
+ var iface reflect.Value
+ switch out.Kind() {
+ case reflect.Slice:
+ out.Set(reflect.MakeSlice(out.Type(), l, l))
+ case reflect.Array:
+ if l != out.Len() {
+ failf("invalid array: want %d elements but got %d", out.Len(), l)
+ }
+ case reflect.Interface:
+ // No type hints. Will have to use a generic sequence.
+ iface = out
+ out = settableValueOf(make([]interface{}, l))
+ default:
+ d.terror(n, yaml_SEQ_TAG, out)
+ return false
+ }
+ et := out.Type().Elem()
+
+ j := 0
+ for i := 0; i < l; i++ {
+ e := reflect.New(et).Elem()
+ if ok := d.unmarshal(n.children[i], e); ok {
+ out.Index(j).Set(e)
+ j++
+ }
+ }
+ if out.Kind() != reflect.Array {
+ out.Set(out.Slice(0, j))
+ }
+ if iface.IsValid() {
+ iface.Set(out)
+ }
+ return true
+}
+
+func (d *decoder) mapping(n *node, out reflect.Value) (good bool) {
+ switch out.Kind() {
+ case reflect.Struct:
+ return d.mappingStruct(n, out)
+ case reflect.Slice:
+ return d.mappingSlice(n, out)
+ case reflect.Map:
+ // okay
+ case reflect.Interface:
+ if d.mapType.Kind() == reflect.Map {
+ iface := out
+ out = reflect.MakeMap(d.mapType)
+ iface.Set(out)
+ } else {
+ slicev := reflect.New(d.mapType).Elem()
+ if !d.mappingSlice(n, slicev) {
+ return false
+ }
+ out.Set(slicev)
+ return true
+ }
+ default:
+ d.terror(n, yaml_MAP_TAG, out)
+ return false
+ }
+ outt := out.Type()
+ kt := outt.Key()
+ et := outt.Elem()
+
+ mapType := d.mapType
+ if outt.Key() == ifaceType && outt.Elem() == ifaceType {
+ d.mapType = outt
+ }
+
+ if out.IsNil() {
+ out.Set(reflect.MakeMap(outt))
+ }
+ l := len(n.children)
+ for i := 0; i < l; i += 2 {
+ if isMerge(n.children[i]) {
+ d.merge(n.children[i+1], out)
+ continue
+ }
+ k := reflect.New(kt).Elem()
+ if d.unmarshal(n.children[i], k) {
+ kkind := k.Kind()
+ if kkind == reflect.Interface {
+ kkind = k.Elem().Kind()
+ }
+ if kkind == reflect.Map || kkind == reflect.Slice {
+ failf("invalid map key: %#v", k.Interface())
+ }
+ e := reflect.New(et).Elem()
+ if d.unmarshal(n.children[i+1], e) {
+ d.setMapIndex(n.children[i+1], out, k, e)
+ }
+ }
+ }
+ d.mapType = mapType
+ return true
+}
+
+func (d *decoder) setMapIndex(n *node, out, k, v reflect.Value) {
+ if d.strict && out.MapIndex(k) != zeroValue {
+ d.terrors = append(d.terrors, fmt.Sprintf("line %d: key %#v already set in map", n.line+1, k.Interface()))
+ return
+ }
+ out.SetMapIndex(k, v)
+}
+
+func (d *decoder) mappingSlice(n *node, out reflect.Value) (good bool) {
+ outt := out.Type()
+ if outt.Elem() != mapItemType {
+ d.terror(n, yaml_MAP_TAG, out)
+ return false
+ }
+
+ mapType := d.mapType
+ d.mapType = outt
+
+ var slice []MapItem
+ var l = len(n.children)
+ for i := 0; i < l; i += 2 {
+ if isMerge(n.children[i]) {
+ d.merge(n.children[i+1], out)
+ continue
+ }
+ item := MapItem{}
+ k := reflect.ValueOf(&item.Key).Elem()
+ if d.unmarshal(n.children[i], k) {
+ v := reflect.ValueOf(&item.Value).Elem()
+ if d.unmarshal(n.children[i+1], v) {
+ slice = append(slice, item)
+ }
+ }
+ }
+ out.Set(reflect.ValueOf(slice))
+ d.mapType = mapType
+ return true
+}
+
+func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) {
+ sinfo, err := getStructInfo(out.Type())
+ if err != nil {
+ panic(err)
+ }
+ name := settableValueOf("")
+ l := len(n.children)
+
+ var inlineMap reflect.Value
+ var elemType reflect.Type
+ if sinfo.InlineMap != -1 {
+ inlineMap = out.Field(sinfo.InlineMap)
+ inlineMap.Set(reflect.New(inlineMap.Type()).Elem())
+ elemType = inlineMap.Type().Elem()
+ }
+
+ var doneFields []bool
+ if d.strict {
+ doneFields = make([]bool, len(sinfo.FieldsList))
+ }
+ for i := 0; i < l; i += 2 {
+ ni := n.children[i]
+ if isMerge(ni) {
+ d.merge(n.children[i+1], out)
+ continue
+ }
+ if !d.unmarshal(ni, name) {
+ continue
+ }
+ if info, ok := sinfo.FieldsMap[name.String()]; ok {
+ if d.strict {
+ if doneFields[info.Id] {
+ d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.line+1, name.String(), out.Type()))
+ continue
+ }
+ doneFields[info.Id] = true
+ }
+ var field reflect.Value
+ if info.Inline == nil {
+ field = out.Field(info.Num)
+ } else {
+ field = out.FieldByIndex(info.Inline)
+ }
+ d.unmarshal(n.children[i+1], field)
+ } else if sinfo.InlineMap != -1 {
+ if inlineMap.IsNil() {
+ inlineMap.Set(reflect.MakeMap(inlineMap.Type()))
+ }
+ value := reflect.New(elemType).Elem()
+ d.unmarshal(n.children[i+1], value)
+ d.setMapIndex(n.children[i+1], inlineMap, name, value)
+ } else if d.strict {
+ d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.line+1, name.String(), out.Type()))
+ }
+ }
+ return true
+}
+
+func failWantMap() {
+ failf("map merge requires map or sequence of maps as the value")
+}
+
+func (d *decoder) merge(n *node, out reflect.Value) {
+ switch n.kind {
+ case mappingNode:
+ d.unmarshal(n, out)
+ case aliasNode:
+ if n.alias != nil && n.alias.kind != mappingNode {
+ failWantMap()
+ }
+ d.unmarshal(n, out)
+ case sequenceNode:
+ // Step backwards as earlier nodes take precedence.
+ for i := len(n.children) - 1; i >= 0; i-- {
+ ni := n.children[i]
+ if ni.kind == aliasNode {
+ if ni.alias != nil && ni.alias.kind != mappingNode {
+ failWantMap()
+ }
+ } else if ni.kind != mappingNode {
+ failWantMap()
+ }
+ d.unmarshal(ni, out)
+ }
+ default:
+ failWantMap()
+ }
+}
+
+func isMerge(n *node) bool {
+ return n.kind == scalarNode && n.value == "<<" && (n.implicit == true || n.tag == yaml_MERGE_TAG)
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go
new file mode 100644
index 000000000..a1c2cc526
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/emitterc.go
@@ -0,0 +1,1685 @@
+package yaml
+
+import (
+ "bytes"
+ "fmt"
+)
+
+// Flush the buffer if needed.
+func flush(emitter *yaml_emitter_t) bool {
+ if emitter.buffer_pos+5 >= len(emitter.buffer) {
+ return yaml_emitter_flush(emitter)
+ }
+ return true
+}
+
+// Put a character to the output buffer.
+func put(emitter *yaml_emitter_t, value byte) bool {
+ if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
+ return false
+ }
+ emitter.buffer[emitter.buffer_pos] = value
+ emitter.buffer_pos++
+ emitter.column++
+ return true
+}
+
+// Put a line break to the output buffer.
+func put_break(emitter *yaml_emitter_t) bool {
+ if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
+ return false
+ }
+ switch emitter.line_break {
+ case yaml_CR_BREAK:
+ emitter.buffer[emitter.buffer_pos] = '\r'
+ emitter.buffer_pos += 1
+ case yaml_LN_BREAK:
+ emitter.buffer[emitter.buffer_pos] = '\n'
+ emitter.buffer_pos += 1
+ case yaml_CRLN_BREAK:
+ emitter.buffer[emitter.buffer_pos+0] = '\r'
+ emitter.buffer[emitter.buffer_pos+1] = '\n'
+ emitter.buffer_pos += 2
+ default:
+ panic("unknown line break setting")
+ }
+ emitter.column = 0
+ emitter.line++
+ return true
+}
+
+// Copy a character from a string into buffer.
+func write(emitter *yaml_emitter_t, s []byte, i *int) bool {
+ if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) {
+ return false
+ }
+ p := emitter.buffer_pos
+ w := width(s[*i])
+ switch w {
+ case 4:
+ emitter.buffer[p+3] = s[*i+3]
+ fallthrough
+ case 3:
+ emitter.buffer[p+2] = s[*i+2]
+ fallthrough
+ case 2:
+ emitter.buffer[p+1] = s[*i+1]
+ fallthrough
+ case 1:
+ emitter.buffer[p+0] = s[*i+0]
+ default:
+ panic("unknown character width")
+ }
+ emitter.column++
+ emitter.buffer_pos += w
+ *i += w
+ return true
+}
+
+// Write a whole string into buffer.
+func write_all(emitter *yaml_emitter_t, s []byte) bool {
+ for i := 0; i < len(s); {
+ if !write(emitter, s, &i) {
+ return false
+ }
+ }
+ return true
+}
+
+// Copy a line break character from a string into buffer.
+func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool {
+ if s[*i] == '\n' {
+ if !put_break(emitter) {
+ return false
+ }
+ *i++
+ } else {
+ if !write(emitter, s, i) {
+ return false
+ }
+ emitter.column = 0
+ emitter.line++
+ }
+ return true
+}
+
+// Set an emitter error and return false.
+func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool {
+ emitter.error = yaml_EMITTER_ERROR
+ emitter.problem = problem
+ return false
+}
+
+// Emit an event.
+func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ emitter.events = append(emitter.events, *event)
+ for !yaml_emitter_need_more_events(emitter) {
+ event := &emitter.events[emitter.events_head]
+ if !yaml_emitter_analyze_event(emitter, event) {
+ return false
+ }
+ if !yaml_emitter_state_machine(emitter, event) {
+ return false
+ }
+ yaml_event_delete(event)
+ emitter.events_head++
+ }
+ return true
+}
+
+// Check if we need to accumulate more events before emitting.
+//
+// We accumulate extra
+// - 1 event for DOCUMENT-START
+// - 2 events for SEQUENCE-START
+// - 3 events for MAPPING-START
+//
+func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool {
+ if emitter.events_head == len(emitter.events) {
+ return true
+ }
+ var accumulate int
+ switch emitter.events[emitter.events_head].typ {
+ case yaml_DOCUMENT_START_EVENT:
+ accumulate = 1
+ break
+ case yaml_SEQUENCE_START_EVENT:
+ accumulate = 2
+ break
+ case yaml_MAPPING_START_EVENT:
+ accumulate = 3
+ break
+ default:
+ return false
+ }
+ if len(emitter.events)-emitter.events_head > accumulate {
+ return false
+ }
+ var level int
+ for i := emitter.events_head; i < len(emitter.events); i++ {
+ switch emitter.events[i].typ {
+ case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT:
+ level++
+ case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT:
+ level--
+ }
+ if level == 0 {
+ return false
+ }
+ }
+ return true
+}
+
+// Append a directive to the directives stack.
+func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool {
+ for i := 0; i < len(emitter.tag_directives); i++ {
+ if bytes.Equal(value.handle, emitter.tag_directives[i].handle) {
+ if allow_duplicates {
+ return true
+ }
+ return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive")
+ }
+ }
+
+ // [Go] Do we actually need to copy this given garbage collection
+ // and the lack of deallocating destructors?
+ tag_copy := yaml_tag_directive_t{
+ handle: make([]byte, len(value.handle)),
+ prefix: make([]byte, len(value.prefix)),
+ }
+ copy(tag_copy.handle, value.handle)
+ copy(tag_copy.prefix, value.prefix)
+ emitter.tag_directives = append(emitter.tag_directives, tag_copy)
+ return true
+}
+
+// Increase the indentation level.
+func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool {
+ emitter.indents = append(emitter.indents, emitter.indent)
+ if emitter.indent < 0 {
+ if flow {
+ emitter.indent = emitter.best_indent
+ } else {
+ emitter.indent = 0
+ }
+ } else if !indentless {
+ emitter.indent += emitter.best_indent
+ }
+ return true
+}
+
+// State dispatcher.
+func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ switch emitter.state {
+ default:
+ case yaml_EMIT_STREAM_START_STATE:
+ return yaml_emitter_emit_stream_start(emitter, event)
+
+ case yaml_EMIT_FIRST_DOCUMENT_START_STATE:
+ return yaml_emitter_emit_document_start(emitter, event, true)
+
+ case yaml_EMIT_DOCUMENT_START_STATE:
+ return yaml_emitter_emit_document_start(emitter, event, false)
+
+ case yaml_EMIT_DOCUMENT_CONTENT_STATE:
+ return yaml_emitter_emit_document_content(emitter, event)
+
+ case yaml_EMIT_DOCUMENT_END_STATE:
+ return yaml_emitter_emit_document_end(emitter, event)
+
+ case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE:
+ return yaml_emitter_emit_flow_sequence_item(emitter, event, true)
+
+ case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE:
+ return yaml_emitter_emit_flow_sequence_item(emitter, event, false)
+
+ case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE:
+ return yaml_emitter_emit_flow_mapping_key(emitter, event, true)
+
+ case yaml_EMIT_FLOW_MAPPING_KEY_STATE:
+ return yaml_emitter_emit_flow_mapping_key(emitter, event, false)
+
+ case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE:
+ return yaml_emitter_emit_flow_mapping_value(emitter, event, true)
+
+ case yaml_EMIT_FLOW_MAPPING_VALUE_STATE:
+ return yaml_emitter_emit_flow_mapping_value(emitter, event, false)
+
+ case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE:
+ return yaml_emitter_emit_block_sequence_item(emitter, event, true)
+
+ case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE:
+ return yaml_emitter_emit_block_sequence_item(emitter, event, false)
+
+ case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE:
+ return yaml_emitter_emit_block_mapping_key(emitter, event, true)
+
+ case yaml_EMIT_BLOCK_MAPPING_KEY_STATE:
+ return yaml_emitter_emit_block_mapping_key(emitter, event, false)
+
+ case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE:
+ return yaml_emitter_emit_block_mapping_value(emitter, event, true)
+
+ case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE:
+ return yaml_emitter_emit_block_mapping_value(emitter, event, false)
+
+ case yaml_EMIT_END_STATE:
+ return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END")
+ }
+ panic("invalid emitter state")
+}
+
+// Expect STREAM-START.
+func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if event.typ != yaml_STREAM_START_EVENT {
+ return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START")
+ }
+ if emitter.encoding == yaml_ANY_ENCODING {
+ emitter.encoding = event.encoding
+ if emitter.encoding == yaml_ANY_ENCODING {
+ emitter.encoding = yaml_UTF8_ENCODING
+ }
+ }
+ if emitter.best_indent < 2 || emitter.best_indent > 9 {
+ emitter.best_indent = 2
+ }
+ if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 {
+ emitter.best_width = 80
+ }
+ if emitter.best_width < 0 {
+ emitter.best_width = 1<<31 - 1
+ }
+ if emitter.line_break == yaml_ANY_BREAK {
+ emitter.line_break = yaml_LN_BREAK
+ }
+
+ emitter.indent = -1
+ emitter.line = 0
+ emitter.column = 0
+ emitter.whitespace = true
+ emitter.indention = true
+
+ if emitter.encoding != yaml_UTF8_ENCODING {
+ if !yaml_emitter_write_bom(emitter) {
+ return false
+ }
+ }
+ emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE
+ return true
+}
+
+// Expect DOCUMENT-START or STREAM-END.
+func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+
+ if event.typ == yaml_DOCUMENT_START_EVENT {
+
+ if event.version_directive != nil {
+ if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) {
+ return false
+ }
+ }
+
+ for i := 0; i < len(event.tag_directives); i++ {
+ tag_directive := &event.tag_directives[i]
+ if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) {
+ return false
+ }
+ if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) {
+ return false
+ }
+ }
+
+ for i := 0; i < len(default_tag_directives); i++ {
+ tag_directive := &default_tag_directives[i]
+ if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) {
+ return false
+ }
+ }
+
+ implicit := event.implicit
+ if !first || emitter.canonical {
+ implicit = false
+ }
+
+ if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) {
+ if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+
+ if event.version_directive != nil {
+ implicit = false
+ if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+
+ if len(event.tag_directives) > 0 {
+ implicit = false
+ for i := 0; i < len(event.tag_directives); i++ {
+ tag_directive := &event.tag_directives[i]
+ if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) {
+ return false
+ }
+ if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ }
+
+ if yaml_emitter_check_empty_document(emitter) {
+ implicit = false
+ }
+ if !implicit {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) {
+ return false
+ }
+ if emitter.canonical {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ }
+
+ emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE
+ return true
+ }
+
+ if event.typ == yaml_STREAM_END_EVENT {
+ if emitter.open_ended {
+ if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_flush(emitter) {
+ return false
+ }
+ emitter.state = yaml_EMIT_END_STATE
+ return true
+ }
+
+ return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END")
+}
+
+// Expect the root node.
+func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE)
+ return yaml_emitter_emit_node(emitter, event, true, false, false, false)
+}
+
+// Expect DOCUMENT-END.
+func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if event.typ != yaml_DOCUMENT_END_EVENT {
+ return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END")
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if !event.implicit {
+ // [Go] Allocate the slice elsewhere.
+ if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_flush(emitter) {
+ return false
+ }
+ emitter.state = yaml_EMIT_DOCUMENT_START_STATE
+ emitter.tag_directives = emitter.tag_directives[:0]
+ return true
+}
+
+// Expect a flow item node.
+func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+ if first {
+ if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) {
+ return false
+ }
+ if !yaml_emitter_increase_indent(emitter, true, false) {
+ return false
+ }
+ emitter.flow_level++
+ }
+
+ if event.typ == yaml_SEQUENCE_END_EVENT {
+ emitter.flow_level--
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ if emitter.canonical && !first {
+ if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) {
+ return false
+ }
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+
+ return true
+ }
+
+ if !first {
+ if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) {
+ return false
+ }
+ }
+
+ if emitter.canonical || emitter.column > emitter.best_width {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, true, false, false)
+}
+
+// Expect a flow key node.
+func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+ if first {
+ if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) {
+ return false
+ }
+ if !yaml_emitter_increase_indent(emitter, true, false) {
+ return false
+ }
+ emitter.flow_level++
+ }
+
+ if event.typ == yaml_MAPPING_END_EVENT {
+ emitter.flow_level--
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ if emitter.canonical && !first {
+ if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) {
+ return false
+ }
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+ }
+
+ if !first {
+ if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) {
+ return false
+ }
+ }
+ if emitter.canonical || emitter.column > emitter.best_width {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+
+ if !emitter.canonical && yaml_emitter_check_simple_key(emitter) {
+ emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, true)
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) {
+ return false
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, false)
+}
+
+// Expect a flow value node.
+func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool {
+ if simple {
+ if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) {
+ return false
+ }
+ } else {
+ if emitter.canonical || emitter.column > emitter.best_width {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) {
+ return false
+ }
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, false)
+}
+
+// Expect a block item node.
+func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+ if first {
+ if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) {
+ return false
+ }
+ }
+ if event.typ == yaml_SEQUENCE_END_EVENT {
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) {
+ return false
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, true, false, false)
+}
+
+// Expect a block key node.
+func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool {
+ if first {
+ if !yaml_emitter_increase_indent(emitter, false, false) {
+ return false
+ }
+ }
+ if event.typ == yaml_MAPPING_END_EVENT {
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+ }
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if yaml_emitter_check_simple_key(emitter) {
+ emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, true)
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) {
+ return false
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, false)
+}
+
+// Expect a block value node.
+func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool {
+ if simple {
+ if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) {
+ return false
+ }
+ } else {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) {
+ return false
+ }
+ }
+ emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE)
+ return yaml_emitter_emit_node(emitter, event, false, false, true, false)
+}
+
+// Expect a node.
+func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t,
+ root bool, sequence bool, mapping bool, simple_key bool) bool {
+
+ emitter.root_context = root
+ emitter.sequence_context = sequence
+ emitter.mapping_context = mapping
+ emitter.simple_key_context = simple_key
+
+ switch event.typ {
+ case yaml_ALIAS_EVENT:
+ return yaml_emitter_emit_alias(emitter, event)
+ case yaml_SCALAR_EVENT:
+ return yaml_emitter_emit_scalar(emitter, event)
+ case yaml_SEQUENCE_START_EVENT:
+ return yaml_emitter_emit_sequence_start(emitter, event)
+ case yaml_MAPPING_START_EVENT:
+ return yaml_emitter_emit_mapping_start(emitter, event)
+ default:
+ return yaml_emitter_set_emitter_error(emitter,
+ fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ))
+ }
+}
+
+// Expect ALIAS.
+func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if !yaml_emitter_process_anchor(emitter) {
+ return false
+ }
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+}
+
+// Expect SCALAR.
+func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if !yaml_emitter_select_scalar_style(emitter, event) {
+ return false
+ }
+ if !yaml_emitter_process_anchor(emitter) {
+ return false
+ }
+ if !yaml_emitter_process_tag(emitter) {
+ return false
+ }
+ if !yaml_emitter_increase_indent(emitter, true, false) {
+ return false
+ }
+ if !yaml_emitter_process_scalar(emitter) {
+ return false
+ }
+ emitter.indent = emitter.indents[len(emitter.indents)-1]
+ emitter.indents = emitter.indents[:len(emitter.indents)-1]
+ emitter.state = emitter.states[len(emitter.states)-1]
+ emitter.states = emitter.states[:len(emitter.states)-1]
+ return true
+}
+
+// Expect SEQUENCE-START.
+func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if !yaml_emitter_process_anchor(emitter) {
+ return false
+ }
+ if !yaml_emitter_process_tag(emitter) {
+ return false
+ }
+ if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE ||
+ yaml_emitter_check_empty_sequence(emitter) {
+ emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE
+ } else {
+ emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE
+ }
+ return true
+}
+
+// Expect MAPPING-START.
+func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+ if !yaml_emitter_process_anchor(emitter) {
+ return false
+ }
+ if !yaml_emitter_process_tag(emitter) {
+ return false
+ }
+ if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE ||
+ yaml_emitter_check_empty_mapping(emitter) {
+ emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE
+ } else {
+ emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE
+ }
+ return true
+}
+
+// Check if the document content is an empty scalar.
+func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool {
+ return false // [Go] Huh?
+}
+
+// Check if the next events represent an empty sequence.
+func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool {
+ if len(emitter.events)-emitter.events_head < 2 {
+ return false
+ }
+ return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT &&
+ emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT
+}
+
+// Check if the next events represent an empty mapping.
+func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool {
+ if len(emitter.events)-emitter.events_head < 2 {
+ return false
+ }
+ return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT &&
+ emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT
+}
+
+// Check if the next node can be expressed as a simple key.
+func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool {
+ length := 0
+ switch emitter.events[emitter.events_head].typ {
+ case yaml_ALIAS_EVENT:
+ length += len(emitter.anchor_data.anchor)
+ case yaml_SCALAR_EVENT:
+ if emitter.scalar_data.multiline {
+ return false
+ }
+ length += len(emitter.anchor_data.anchor) +
+ len(emitter.tag_data.handle) +
+ len(emitter.tag_data.suffix) +
+ len(emitter.scalar_data.value)
+ case yaml_SEQUENCE_START_EVENT:
+ if !yaml_emitter_check_empty_sequence(emitter) {
+ return false
+ }
+ length += len(emitter.anchor_data.anchor) +
+ len(emitter.tag_data.handle) +
+ len(emitter.tag_data.suffix)
+ case yaml_MAPPING_START_EVENT:
+ if !yaml_emitter_check_empty_mapping(emitter) {
+ return false
+ }
+ length += len(emitter.anchor_data.anchor) +
+ len(emitter.tag_data.handle) +
+ len(emitter.tag_data.suffix)
+ default:
+ return false
+ }
+ return length <= 128
+}
+
+// Determine an acceptable scalar style.
+func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+
+ no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0
+ if no_tag && !event.implicit && !event.quoted_implicit {
+ return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified")
+ }
+
+ style := event.scalar_style()
+ if style == yaml_ANY_SCALAR_STYLE {
+ style = yaml_PLAIN_SCALAR_STYLE
+ }
+ if emitter.canonical {
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ if emitter.simple_key_context && emitter.scalar_data.multiline {
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+
+ if style == yaml_PLAIN_SCALAR_STYLE {
+ if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed ||
+ emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed {
+ style = yaml_SINGLE_QUOTED_SCALAR_STYLE
+ }
+ if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) {
+ style = yaml_SINGLE_QUOTED_SCALAR_STYLE
+ }
+ if no_tag && !event.implicit {
+ style = yaml_SINGLE_QUOTED_SCALAR_STYLE
+ }
+ }
+ if style == yaml_SINGLE_QUOTED_SCALAR_STYLE {
+ if !emitter.scalar_data.single_quoted_allowed {
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ }
+ if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE {
+ if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context {
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ }
+
+ if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE {
+ emitter.tag_data.handle = []byte{'!'}
+ }
+ emitter.scalar_data.style = style
+ return true
+}
+
+// Write an anchor.
+func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool {
+ if emitter.anchor_data.anchor == nil {
+ return true
+ }
+ c := []byte{'&'}
+ if emitter.anchor_data.alias {
+ c[0] = '*'
+ }
+ if !yaml_emitter_write_indicator(emitter, c, true, false, false) {
+ return false
+ }
+ return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor)
+}
+
+// Write a tag.
+func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool {
+ if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 {
+ return true
+ }
+ if len(emitter.tag_data.handle) > 0 {
+ if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) {
+ return false
+ }
+ if len(emitter.tag_data.suffix) > 0 {
+ if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) {
+ return false
+ }
+ }
+ } else {
+ // [Go] Allocate these slices elsewhere.
+ if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) {
+ return false
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) {
+ return false
+ }
+ }
+ return true
+}
+
+// Write a scalar.
+func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool {
+ switch emitter.scalar_data.style {
+ case yaml_PLAIN_SCALAR_STYLE:
+ return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context)
+
+ case yaml_SINGLE_QUOTED_SCALAR_STYLE:
+ return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context)
+
+ case yaml_DOUBLE_QUOTED_SCALAR_STYLE:
+ return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context)
+
+ case yaml_LITERAL_SCALAR_STYLE:
+ return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value)
+
+ case yaml_FOLDED_SCALAR_STYLE:
+ return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value)
+ }
+ panic("unknown scalar style")
+}
+
+// Check if a %YAML directive is valid.
+func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool {
+ if version_directive.major != 1 || version_directive.minor != 1 {
+ return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive")
+ }
+ return true
+}
+
+// Check if a %TAG directive is valid.
+func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool {
+ handle := tag_directive.handle
+ prefix := tag_directive.prefix
+ if len(handle) == 0 {
+ return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty")
+ }
+ if handle[0] != '!' {
+ return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'")
+ }
+ if handle[len(handle)-1] != '!' {
+ return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'")
+ }
+ for i := 1; i < len(handle)-1; i += width(handle[i]) {
+ if !is_alpha(handle, i) {
+ return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only")
+ }
+ }
+ if len(prefix) == 0 {
+ return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty")
+ }
+ return true
+}
+
+// Check if an anchor is valid.
+func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool {
+ if len(anchor) == 0 {
+ problem := "anchor value must not be empty"
+ if alias {
+ problem = "alias value must not be empty"
+ }
+ return yaml_emitter_set_emitter_error(emitter, problem)
+ }
+ for i := 0; i < len(anchor); i += width(anchor[i]) {
+ if !is_alpha(anchor, i) {
+ problem := "anchor value must contain alphanumerical characters only"
+ if alias {
+ problem = "alias value must contain alphanumerical characters only"
+ }
+ return yaml_emitter_set_emitter_error(emitter, problem)
+ }
+ }
+ emitter.anchor_data.anchor = anchor
+ emitter.anchor_data.alias = alias
+ return true
+}
+
+// Check if a tag is valid.
+func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool {
+ if len(tag) == 0 {
+ return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty")
+ }
+ for i := 0; i < len(emitter.tag_directives); i++ {
+ tag_directive := &emitter.tag_directives[i]
+ if bytes.HasPrefix(tag, tag_directive.prefix) {
+ emitter.tag_data.handle = tag_directive.handle
+ emitter.tag_data.suffix = tag[len(tag_directive.prefix):]
+ return true
+ }
+ }
+ emitter.tag_data.suffix = tag
+ return true
+}
+
+// Check if a scalar is valid.
+func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool {
+ var (
+ block_indicators = false
+ flow_indicators = false
+ line_breaks = false
+ special_characters = false
+
+ leading_space = false
+ leading_break = false
+ trailing_space = false
+ trailing_break = false
+ break_space = false
+ space_break = false
+
+ preceded_by_whitespace = false
+ followed_by_whitespace = false
+ previous_space = false
+ previous_break = false
+ )
+
+ emitter.scalar_data.value = value
+
+ if len(value) == 0 {
+ emitter.scalar_data.multiline = false
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = true
+ emitter.scalar_data.single_quoted_allowed = true
+ emitter.scalar_data.block_allowed = false
+ return true
+ }
+
+ if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) {
+ block_indicators = true
+ flow_indicators = true
+ }
+
+ preceded_by_whitespace = true
+ for i, w := 0, 0; i < len(value); i += w {
+ w = width(value[i])
+ followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w)
+
+ if i == 0 {
+ switch value[i] {
+ case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`':
+ flow_indicators = true
+ block_indicators = true
+ case '?', ':':
+ flow_indicators = true
+ if followed_by_whitespace {
+ block_indicators = true
+ }
+ case '-':
+ if followed_by_whitespace {
+ flow_indicators = true
+ block_indicators = true
+ }
+ }
+ } else {
+ switch value[i] {
+ case ',', '?', '[', ']', '{', '}':
+ flow_indicators = true
+ case ':':
+ flow_indicators = true
+ if followed_by_whitespace {
+ block_indicators = true
+ }
+ case '#':
+ if preceded_by_whitespace {
+ flow_indicators = true
+ block_indicators = true
+ }
+ }
+ }
+
+ if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode {
+ special_characters = true
+ }
+ if is_space(value, i) {
+ if i == 0 {
+ leading_space = true
+ }
+ if i+width(value[i]) == len(value) {
+ trailing_space = true
+ }
+ if previous_break {
+ break_space = true
+ }
+ previous_space = true
+ previous_break = false
+ } else if is_break(value, i) {
+ line_breaks = true
+ if i == 0 {
+ leading_break = true
+ }
+ if i+width(value[i]) == len(value) {
+ trailing_break = true
+ }
+ if previous_space {
+ space_break = true
+ }
+ previous_space = false
+ previous_break = true
+ } else {
+ previous_space = false
+ previous_break = false
+ }
+
+ // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition.
+ preceded_by_whitespace = is_blankz(value, i)
+ }
+
+ emitter.scalar_data.multiline = line_breaks
+ emitter.scalar_data.flow_plain_allowed = true
+ emitter.scalar_data.block_plain_allowed = true
+ emitter.scalar_data.single_quoted_allowed = true
+ emitter.scalar_data.block_allowed = true
+
+ if leading_space || leading_break || trailing_space || trailing_break {
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = false
+ }
+ if trailing_space {
+ emitter.scalar_data.block_allowed = false
+ }
+ if break_space {
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = false
+ emitter.scalar_data.single_quoted_allowed = false
+ }
+ if space_break || special_characters {
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = false
+ emitter.scalar_data.single_quoted_allowed = false
+ emitter.scalar_data.block_allowed = false
+ }
+ if line_breaks {
+ emitter.scalar_data.flow_plain_allowed = false
+ emitter.scalar_data.block_plain_allowed = false
+ }
+ if flow_indicators {
+ emitter.scalar_data.flow_plain_allowed = false
+ }
+ if block_indicators {
+ emitter.scalar_data.block_plain_allowed = false
+ }
+ return true
+}
+
+// Check if the event data is valid.
+func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool {
+
+ emitter.anchor_data.anchor = nil
+ emitter.tag_data.handle = nil
+ emitter.tag_data.suffix = nil
+ emitter.scalar_data.value = nil
+
+ switch event.typ {
+ case yaml_ALIAS_EVENT:
+ if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) {
+ return false
+ }
+
+ case yaml_SCALAR_EVENT:
+ if len(event.anchor) > 0 {
+ if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) {
+ return false
+ }
+ }
+ if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) {
+ if !yaml_emitter_analyze_tag(emitter, event.tag) {
+ return false
+ }
+ }
+ if !yaml_emitter_analyze_scalar(emitter, event.value) {
+ return false
+ }
+
+ case yaml_SEQUENCE_START_EVENT:
+ if len(event.anchor) > 0 {
+ if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) {
+ return false
+ }
+ }
+ if len(event.tag) > 0 && (emitter.canonical || !event.implicit) {
+ if !yaml_emitter_analyze_tag(emitter, event.tag) {
+ return false
+ }
+ }
+
+ case yaml_MAPPING_START_EVENT:
+ if len(event.anchor) > 0 {
+ if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) {
+ return false
+ }
+ }
+ if len(event.tag) > 0 && (emitter.canonical || !event.implicit) {
+ if !yaml_emitter_analyze_tag(emitter, event.tag) {
+ return false
+ }
+ }
+ }
+ return true
+}
+
+// Write the BOM character.
+func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool {
+ if !flush(emitter) {
+ return false
+ }
+ pos := emitter.buffer_pos
+ emitter.buffer[pos+0] = '\xEF'
+ emitter.buffer[pos+1] = '\xBB'
+ emitter.buffer[pos+2] = '\xBF'
+ emitter.buffer_pos += 3
+ return true
+}
+
+func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool {
+ indent := emitter.indent
+ if indent < 0 {
+ indent = 0
+ }
+ if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) {
+ if !put_break(emitter) {
+ return false
+ }
+ }
+ for emitter.column < indent {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+ emitter.whitespace = true
+ emitter.indention = true
+ return true
+}
+
+func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool {
+ if need_whitespace && !emitter.whitespace {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+ if !write_all(emitter, indicator) {
+ return false
+ }
+ emitter.whitespace = is_whitespace
+ emitter.indention = (emitter.indention && is_indention)
+ emitter.open_ended = false
+ return true
+}
+
+func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool {
+ if !write_all(emitter, value) {
+ return false
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool {
+ if !emitter.whitespace {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+ if !write_all(emitter, value) {
+ return false
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool {
+ if need_whitespace && !emitter.whitespace {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+ for i := 0; i < len(value); {
+ var must_write bool
+ switch value[i] {
+ case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']':
+ must_write = true
+ default:
+ must_write = is_alpha(value, i)
+ }
+ if must_write {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ } else {
+ w := width(value[i])
+ for k := 0; k < w; k++ {
+ octet := value[i]
+ i++
+ if !put(emitter, '%') {
+ return false
+ }
+
+ c := octet >> 4
+ if c < 10 {
+ c += '0'
+ } else {
+ c += 'A' - 10
+ }
+ if !put(emitter, c) {
+ return false
+ }
+
+ c = octet & 0x0f
+ if c < 10 {
+ c += '0'
+ } else {
+ c += 'A' - 10
+ }
+ if !put(emitter, c) {
+ return false
+ }
+ }
+ }
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool {
+ if !emitter.whitespace {
+ if !put(emitter, ' ') {
+ return false
+ }
+ }
+
+ spaces := false
+ breaks := false
+ for i := 0; i < len(value); {
+ if is_space(value, i) {
+ if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ i += width(value[i])
+ } else {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ }
+ spaces = true
+ } else if is_break(value, i) {
+ if !breaks && value[i] == '\n' {
+ if !put_break(emitter) {
+ return false
+ }
+ }
+ if !write_break(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = true
+ breaks = true
+ } else {
+ if breaks {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !write(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = false
+ spaces = false
+ breaks = false
+ }
+ }
+
+ emitter.whitespace = false
+ emitter.indention = false
+ if emitter.root_context {
+ emitter.open_ended = true
+ }
+
+ return true
+}
+
+func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool {
+
+ if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) {
+ return false
+ }
+
+ spaces := false
+ breaks := false
+ for i := 0; i < len(value); {
+ if is_space(value, i) {
+ if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ i += width(value[i])
+ } else {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ }
+ spaces = true
+ } else if is_break(value, i) {
+ if !breaks && value[i] == '\n' {
+ if !put_break(emitter) {
+ return false
+ }
+ }
+ if !write_break(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = true
+ breaks = true
+ } else {
+ if breaks {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if value[i] == '\'' {
+ if !put(emitter, '\'') {
+ return false
+ }
+ }
+ if !write(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = false
+ spaces = false
+ breaks = false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) {
+ return false
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool {
+ spaces := false
+ if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) {
+ return false
+ }
+
+ for i := 0; i < len(value); {
+ if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) ||
+ is_bom(value, i) || is_break(value, i) ||
+ value[i] == '"' || value[i] == '\\' {
+
+ octet := value[i]
+
+ var w int
+ var v rune
+ switch {
+ case octet&0x80 == 0x00:
+ w, v = 1, rune(octet&0x7F)
+ case octet&0xE0 == 0xC0:
+ w, v = 2, rune(octet&0x1F)
+ case octet&0xF0 == 0xE0:
+ w, v = 3, rune(octet&0x0F)
+ case octet&0xF8 == 0xF0:
+ w, v = 4, rune(octet&0x07)
+ }
+ for k := 1; k < w; k++ {
+ octet = value[i+k]
+ v = (v << 6) + (rune(octet) & 0x3F)
+ }
+ i += w
+
+ if !put(emitter, '\\') {
+ return false
+ }
+
+ var ok bool
+ switch v {
+ case 0x00:
+ ok = put(emitter, '0')
+ case 0x07:
+ ok = put(emitter, 'a')
+ case 0x08:
+ ok = put(emitter, 'b')
+ case 0x09:
+ ok = put(emitter, 't')
+ case 0x0A:
+ ok = put(emitter, 'n')
+ case 0x0b:
+ ok = put(emitter, 'v')
+ case 0x0c:
+ ok = put(emitter, 'f')
+ case 0x0d:
+ ok = put(emitter, 'r')
+ case 0x1b:
+ ok = put(emitter, 'e')
+ case 0x22:
+ ok = put(emitter, '"')
+ case 0x5c:
+ ok = put(emitter, '\\')
+ case 0x85:
+ ok = put(emitter, 'N')
+ case 0xA0:
+ ok = put(emitter, '_')
+ case 0x2028:
+ ok = put(emitter, 'L')
+ case 0x2029:
+ ok = put(emitter, 'P')
+ default:
+ if v <= 0xFF {
+ ok = put(emitter, 'x')
+ w = 2
+ } else if v <= 0xFFFF {
+ ok = put(emitter, 'u')
+ w = 4
+ } else {
+ ok = put(emitter, 'U')
+ w = 8
+ }
+ for k := (w - 1) * 4; ok && k >= 0; k -= 4 {
+ digit := byte((v >> uint(k)) & 0x0F)
+ if digit < 10 {
+ ok = put(emitter, digit+'0')
+ } else {
+ ok = put(emitter, digit+'A'-10)
+ }
+ }
+ }
+ if !ok {
+ return false
+ }
+ spaces = false
+ } else if is_space(value, i) {
+ if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ if is_space(value, i+1) {
+ if !put(emitter, '\\') {
+ return false
+ }
+ }
+ i += width(value[i])
+ } else if !write(emitter, value, &i) {
+ return false
+ }
+ spaces = true
+ } else {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ spaces = false
+ }
+ }
+ if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) {
+ return false
+ }
+ emitter.whitespace = false
+ emitter.indention = false
+ return true
+}
+
+func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool {
+ if is_space(value, 0) || is_break(value, 0) {
+ indent_hint := []byte{'0' + byte(emitter.best_indent)}
+ if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) {
+ return false
+ }
+ }
+
+ emitter.open_ended = false
+
+ var chomp_hint [1]byte
+ if len(value) == 0 {
+ chomp_hint[0] = '-'
+ } else {
+ i := len(value) - 1
+ for value[i]&0xC0 == 0x80 {
+ i--
+ }
+ if !is_break(value, i) {
+ chomp_hint[0] = '-'
+ } else if i == 0 {
+ chomp_hint[0] = '+'
+ emitter.open_ended = true
+ } else {
+ i--
+ for value[i]&0xC0 == 0x80 {
+ i--
+ }
+ if is_break(value, i) {
+ chomp_hint[0] = '+'
+ emitter.open_ended = true
+ }
+ }
+ }
+ if chomp_hint[0] != 0 {
+ if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) {
+ return false
+ }
+ }
+ return true
+}
+
+func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool {
+ if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_block_scalar_hints(emitter, value) {
+ return false
+ }
+ if !put_break(emitter) {
+ return false
+ }
+ emitter.indention = true
+ emitter.whitespace = true
+ breaks := true
+ for i := 0; i < len(value); {
+ if is_break(value, i) {
+ if !write_break(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = true
+ breaks = true
+ } else {
+ if breaks {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ }
+ if !write(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = false
+ breaks = false
+ }
+ }
+
+ return true
+}
+
+func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool {
+ if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) {
+ return false
+ }
+ if !yaml_emitter_write_block_scalar_hints(emitter, value) {
+ return false
+ }
+
+ if !put_break(emitter) {
+ return false
+ }
+ emitter.indention = true
+ emitter.whitespace = true
+
+ breaks := true
+ leading_spaces := true
+ for i := 0; i < len(value); {
+ if is_break(value, i) {
+ if !breaks && !leading_spaces && value[i] == '\n' {
+ k := 0
+ for is_break(value, k) {
+ k += width(value[k])
+ }
+ if !is_blankz(value, k) {
+ if !put_break(emitter) {
+ return false
+ }
+ }
+ }
+ if !write_break(emitter, value, &i) {
+ return false
+ }
+ emitter.indention = true
+ breaks = true
+ } else {
+ if breaks {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ leading_spaces = is_blank(value, i)
+ }
+ if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width {
+ if !yaml_emitter_write_indent(emitter) {
+ return false
+ }
+ i += width(value[i])
+ } else {
+ if !write(emitter, value, &i) {
+ return false
+ }
+ }
+ emitter.indention = false
+ breaks = false
+ }
+ }
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go
new file mode 100644
index 000000000..0ee738e11
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/encode.go
@@ -0,0 +1,390 @@
+package yaml
+
+import (
+ "encoding"
+ "fmt"
+ "io"
+ "reflect"
+ "regexp"
+ "sort"
+ "strconv"
+ "strings"
+ "time"
+ "unicode/utf8"
+)
+
+// jsonNumber is the interface of the encoding/json.Number datatype.
+// Repeating the interface here avoids a dependency on encoding/json, and also
+// supports other libraries like jsoniter, which use a similar datatype with
+// the same interface. Detecting this interface is useful when dealing with
+// structures containing json.Number, which is a string under the hood. The
+// encoder should prefer the use of Int64(), Float64() and string(), in that
+// order, when encoding this type.
+type jsonNumber interface {
+ Float64() (float64, error)
+ Int64() (int64, error)
+ String() string
+}
+
+type encoder struct {
+ emitter yaml_emitter_t
+ event yaml_event_t
+ out []byte
+ flow bool
+ // doneInit holds whether the initial stream_start_event has been
+ // emitted.
+ doneInit bool
+}
+
+func newEncoder() *encoder {
+ e := &encoder{}
+ yaml_emitter_initialize(&e.emitter)
+ yaml_emitter_set_output_string(&e.emitter, &e.out)
+ yaml_emitter_set_unicode(&e.emitter, true)
+ return e
+}
+
+func newEncoderWithWriter(w io.Writer) *encoder {
+ e := &encoder{}
+ yaml_emitter_initialize(&e.emitter)
+ yaml_emitter_set_output_writer(&e.emitter, w)
+ yaml_emitter_set_unicode(&e.emitter, true)
+ return e
+}
+
+func (e *encoder) init() {
+ if e.doneInit {
+ return
+ }
+ yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING)
+ e.emit()
+ e.doneInit = true
+}
+
+func (e *encoder) finish() {
+ e.emitter.open_ended = false
+ yaml_stream_end_event_initialize(&e.event)
+ e.emit()
+}
+
+func (e *encoder) destroy() {
+ yaml_emitter_delete(&e.emitter)
+}
+
+func (e *encoder) emit() {
+ // This will internally delete the e.event value.
+ e.must(yaml_emitter_emit(&e.emitter, &e.event))
+}
+
+func (e *encoder) must(ok bool) {
+ if !ok {
+ msg := e.emitter.problem
+ if msg == "" {
+ msg = "unknown problem generating YAML content"
+ }
+ failf("%s", msg)
+ }
+}
+
+func (e *encoder) marshalDoc(tag string, in reflect.Value) {
+ e.init()
+ yaml_document_start_event_initialize(&e.event, nil, nil, true)
+ e.emit()
+ e.marshal(tag, in)
+ yaml_document_end_event_initialize(&e.event, true)
+ e.emit()
+}
+
+func (e *encoder) marshal(tag string, in reflect.Value) {
+ if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() {
+ e.nilv()
+ return
+ }
+ iface := in.Interface()
+ switch m := iface.(type) {
+ case jsonNumber:
+ integer, err := m.Int64()
+ if err == nil {
+ // In this case the json.Number is a valid int64
+ in = reflect.ValueOf(integer)
+ break
+ }
+ float, err := m.Float64()
+ if err == nil {
+ // In this case the json.Number is a valid float64
+ in = reflect.ValueOf(float)
+ break
+ }
+ // fallback case - no number could be obtained
+ in = reflect.ValueOf(m.String())
+ case time.Time, *time.Time:
+ // Although time.Time implements TextMarshaler,
+ // we don't want to treat it as a string for YAML
+ // purposes because YAML has special support for
+ // timestamps.
+ case Marshaler:
+ v, err := m.MarshalYAML()
+ if err != nil {
+ fail(err)
+ }
+ if v == nil {
+ e.nilv()
+ return
+ }
+ in = reflect.ValueOf(v)
+ case encoding.TextMarshaler:
+ text, err := m.MarshalText()
+ if err != nil {
+ fail(err)
+ }
+ in = reflect.ValueOf(string(text))
+ case nil:
+ e.nilv()
+ return
+ }
+ switch in.Kind() {
+ case reflect.Interface:
+ e.marshal(tag, in.Elem())
+ case reflect.Map:
+ e.mapv(tag, in)
+ case reflect.Ptr:
+ if in.Type() == ptrTimeType {
+ e.timev(tag, in.Elem())
+ } else {
+ e.marshal(tag, in.Elem())
+ }
+ case reflect.Struct:
+ if in.Type() == timeType {
+ e.timev(tag, in)
+ } else {
+ e.structv(tag, in)
+ }
+ case reflect.Slice, reflect.Array:
+ if in.Type().Elem() == mapItemType {
+ e.itemsv(tag, in)
+ } else {
+ e.slicev(tag, in)
+ }
+ case reflect.String:
+ e.stringv(tag, in)
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ if in.Type() == durationType {
+ e.stringv(tag, reflect.ValueOf(iface.(time.Duration).String()))
+ } else {
+ e.intv(tag, in)
+ }
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ e.uintv(tag, in)
+ case reflect.Float32, reflect.Float64:
+ e.floatv(tag, in)
+ case reflect.Bool:
+ e.boolv(tag, in)
+ default:
+ panic("cannot marshal type: " + in.Type().String())
+ }
+}
+
+func (e *encoder) mapv(tag string, in reflect.Value) {
+ e.mappingv(tag, func() {
+ keys := keyList(in.MapKeys())
+ sort.Sort(keys)
+ for _, k := range keys {
+ e.marshal("", k)
+ e.marshal("", in.MapIndex(k))
+ }
+ })
+}
+
+func (e *encoder) itemsv(tag string, in reflect.Value) {
+ e.mappingv(tag, func() {
+ slice := in.Convert(reflect.TypeOf([]MapItem{})).Interface().([]MapItem)
+ for _, item := range slice {
+ e.marshal("", reflect.ValueOf(item.Key))
+ e.marshal("", reflect.ValueOf(item.Value))
+ }
+ })
+}
+
+func (e *encoder) structv(tag string, in reflect.Value) {
+ sinfo, err := getStructInfo(in.Type())
+ if err != nil {
+ panic(err)
+ }
+ e.mappingv(tag, func() {
+ for _, info := range sinfo.FieldsList {
+ var value reflect.Value
+ if info.Inline == nil {
+ value = in.Field(info.Num)
+ } else {
+ value = in.FieldByIndex(info.Inline)
+ }
+ if info.OmitEmpty && isZero(value) {
+ continue
+ }
+ e.marshal("", reflect.ValueOf(info.Key))
+ e.flow = info.Flow
+ e.marshal("", value)
+ }
+ if sinfo.InlineMap >= 0 {
+ m := in.Field(sinfo.InlineMap)
+ if m.Len() > 0 {
+ e.flow = false
+ keys := keyList(m.MapKeys())
+ sort.Sort(keys)
+ for _, k := range keys {
+ if _, found := sinfo.FieldsMap[k.String()]; found {
+ panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String()))
+ }
+ e.marshal("", k)
+ e.flow = false
+ e.marshal("", m.MapIndex(k))
+ }
+ }
+ }
+ })
+}
+
+func (e *encoder) mappingv(tag string, f func()) {
+ implicit := tag == ""
+ style := yaml_BLOCK_MAPPING_STYLE
+ if e.flow {
+ e.flow = false
+ style = yaml_FLOW_MAPPING_STYLE
+ }
+ yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)
+ e.emit()
+ f()
+ yaml_mapping_end_event_initialize(&e.event)
+ e.emit()
+}
+
+func (e *encoder) slicev(tag string, in reflect.Value) {
+ implicit := tag == ""
+ style := yaml_BLOCK_SEQUENCE_STYLE
+ if e.flow {
+ e.flow = false
+ style = yaml_FLOW_SEQUENCE_STYLE
+ }
+ e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style))
+ e.emit()
+ n := in.Len()
+ for i := 0; i < n; i++ {
+ e.marshal("", in.Index(i))
+ }
+ e.must(yaml_sequence_end_event_initialize(&e.event))
+ e.emit()
+}
+
+// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1.
+//
+// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported
+// in YAML 1.2 and by this package, but these should be marshalled quoted for
+// the time being for compatibility with other parsers.
+func isBase60Float(s string) (result bool) {
+ // Fast path.
+ if s == "" {
+ return false
+ }
+ c := s[0]
+ if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 {
+ return false
+ }
+ // Do the full match.
+ return base60float.MatchString(s)
+}
+
+// From http://yaml.org/type/float.html, except the regular expression there
+// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix.
+var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`)
+
+func (e *encoder) stringv(tag string, in reflect.Value) {
+ var style yaml_scalar_style_t
+ s := in.String()
+ canUsePlain := true
+ switch {
+ case !utf8.ValidString(s):
+ if tag == yaml_BINARY_TAG {
+ failf("explicitly tagged !!binary data must be base64-encoded")
+ }
+ if tag != "" {
+ failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag))
+ }
+ // It can't be encoded directly as YAML so use a binary tag
+ // and encode it as base64.
+ tag = yaml_BINARY_TAG
+ s = encodeBase64(s)
+ case tag == "":
+ // Check to see if it would resolve to a specific
+ // tag when encoded unquoted. If it doesn't,
+ // there's no need to quote it.
+ rtag, _ := resolve("", s)
+ canUsePlain = rtag == yaml_STR_TAG && !isBase60Float(s)
+ }
+ // Note: it's possible for user code to emit invalid YAML
+ // if they explicitly specify a tag and a string containing
+ // text that's incompatible with that tag.
+ switch {
+ case strings.Contains(s, "\n"):
+ style = yaml_LITERAL_SCALAR_STYLE
+ case canUsePlain:
+ style = yaml_PLAIN_SCALAR_STYLE
+ default:
+ style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ e.emitScalar(s, "", tag, style)
+}
+
+func (e *encoder) boolv(tag string, in reflect.Value) {
+ var s string
+ if in.Bool() {
+ s = "true"
+ } else {
+ s = "false"
+ }
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) intv(tag string, in reflect.Value) {
+ s := strconv.FormatInt(in.Int(), 10)
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) uintv(tag string, in reflect.Value) {
+ s := strconv.FormatUint(in.Uint(), 10)
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) timev(tag string, in reflect.Value) {
+ t := in.Interface().(time.Time)
+ s := t.Format(time.RFC3339Nano)
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) floatv(tag string, in reflect.Value) {
+ // Issue #352: When formatting, use the precision of the underlying value
+ precision := 64
+ if in.Kind() == reflect.Float32 {
+ precision = 32
+ }
+
+ s := strconv.FormatFloat(in.Float(), 'g', -1, precision)
+ switch s {
+ case "+Inf":
+ s = ".inf"
+ case "-Inf":
+ s = "-.inf"
+ case "NaN":
+ s = ".nan"
+ }
+ e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) nilv() {
+ e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE)
+}
+
+func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) {
+ implicit := tag == ""
+ e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style))
+ e.emit()
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go
new file mode 100644
index 000000000..81d05dfe5
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/parserc.go
@@ -0,0 +1,1095 @@
+package yaml
+
+import (
+ "bytes"
+)
+
+// The parser implements the following grammar:
+//
+// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
+// implicit_document ::= block_node DOCUMENT-END*
+// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+// block_node_or_indentless_sequence ::=
+// ALIAS
+// | properties (block_content | indentless_block_sequence)?
+// | block_content
+// | indentless_block_sequence
+// block_node ::= ALIAS
+// | properties block_content?
+// | block_content
+// flow_node ::= ALIAS
+// | properties flow_content?
+// | flow_content
+// properties ::= TAG ANCHOR? | ANCHOR TAG?
+// block_content ::= block_collection | flow_collection | SCALAR
+// flow_content ::= flow_collection | SCALAR
+// block_collection ::= block_sequence | block_mapping
+// flow_collection ::= flow_sequence | flow_mapping
+// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
+// indentless_sequence ::= (BLOCK-ENTRY block_node?)+
+// block_mapping ::= BLOCK-MAPPING_START
+// ((KEY block_node_or_indentless_sequence?)?
+// (VALUE block_node_or_indentless_sequence?)?)*
+// BLOCK-END
+// flow_sequence ::= FLOW-SEQUENCE-START
+// (flow_sequence_entry FLOW-ENTRY)*
+// flow_sequence_entry?
+// FLOW-SEQUENCE-END
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// flow_mapping ::= FLOW-MAPPING-START
+// (flow_mapping_entry FLOW-ENTRY)*
+// flow_mapping_entry?
+// FLOW-MAPPING-END
+// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+
+// Peek the next token in the token queue.
+func peek_token(parser *yaml_parser_t) *yaml_token_t {
+ if parser.token_available || yaml_parser_fetch_more_tokens(parser) {
+ return &parser.tokens[parser.tokens_head]
+ }
+ return nil
+}
+
+// Remove the next token from the queue (must be called after peek_token).
+func skip_token(parser *yaml_parser_t) {
+ parser.token_available = false
+ parser.tokens_parsed++
+ parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN
+ parser.tokens_head++
+}
+
+// Get the next event.
+func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool {
+ // Erase the event object.
+ *event = yaml_event_t{}
+
+ // No events after the end of the stream or error.
+ if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE {
+ return true
+ }
+
+ // Generate the next event.
+ return yaml_parser_state_machine(parser, event)
+}
+
+// Set parser error.
+func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool {
+ parser.error = yaml_PARSER_ERROR
+ parser.problem = problem
+ parser.problem_mark = problem_mark
+ return false
+}
+
+func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool {
+ parser.error = yaml_PARSER_ERROR
+ parser.context = context
+ parser.context_mark = context_mark
+ parser.problem = problem
+ parser.problem_mark = problem_mark
+ return false
+}
+
+// State dispatcher.
+func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool {
+ //trace("yaml_parser_state_machine", "state:", parser.state.String())
+
+ switch parser.state {
+ case yaml_PARSE_STREAM_START_STATE:
+ return yaml_parser_parse_stream_start(parser, event)
+
+ case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE:
+ return yaml_parser_parse_document_start(parser, event, true)
+
+ case yaml_PARSE_DOCUMENT_START_STATE:
+ return yaml_parser_parse_document_start(parser, event, false)
+
+ case yaml_PARSE_DOCUMENT_CONTENT_STATE:
+ return yaml_parser_parse_document_content(parser, event)
+
+ case yaml_PARSE_DOCUMENT_END_STATE:
+ return yaml_parser_parse_document_end(parser, event)
+
+ case yaml_PARSE_BLOCK_NODE_STATE:
+ return yaml_parser_parse_node(parser, event, true, false)
+
+ case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
+ return yaml_parser_parse_node(parser, event, true, true)
+
+ case yaml_PARSE_FLOW_NODE_STATE:
+ return yaml_parser_parse_node(parser, event, false, false)
+
+ case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
+ return yaml_parser_parse_block_sequence_entry(parser, event, true)
+
+ case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_block_sequence_entry(parser, event, false)
+
+ case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_indentless_sequence_entry(parser, event)
+
+ case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
+ return yaml_parser_parse_block_mapping_key(parser, event, true)
+
+ case yaml_PARSE_BLOCK_MAPPING_KEY_STATE:
+ return yaml_parser_parse_block_mapping_key(parser, event, false)
+
+ case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_block_mapping_value(parser, event)
+
+ case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
+ return yaml_parser_parse_flow_sequence_entry(parser, event, true)
+
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
+ return yaml_parser_parse_flow_sequence_entry(parser, event, false)
+
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event)
+
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event)
+
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
+ return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event)
+
+ case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
+ return yaml_parser_parse_flow_mapping_key(parser, event, true)
+
+ case yaml_PARSE_FLOW_MAPPING_KEY_STATE:
+ return yaml_parser_parse_flow_mapping_key(parser, event, false)
+
+ case yaml_PARSE_FLOW_MAPPING_VALUE_STATE:
+ return yaml_parser_parse_flow_mapping_value(parser, event, false)
+
+ case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
+ return yaml_parser_parse_flow_mapping_value(parser, event, true)
+
+ default:
+ panic("invalid parser state")
+ }
+}
+
+// Parse the production:
+// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
+// ************
+func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_STREAM_START_TOKEN {
+ return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark)
+ }
+ parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE
+ *event = yaml_event_t{
+ typ: yaml_STREAM_START_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ encoding: token.encoding,
+ }
+ skip_token(parser)
+ return true
+}
+
+// Parse the productions:
+// implicit_document ::= block_node DOCUMENT-END*
+// *
+// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+// *************************
+func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool {
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ // Parse extra document end indicators.
+ if !implicit {
+ for token.typ == yaml_DOCUMENT_END_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ }
+ }
+
+ if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN &&
+ token.typ != yaml_TAG_DIRECTIVE_TOKEN &&
+ token.typ != yaml_DOCUMENT_START_TOKEN &&
+ token.typ != yaml_STREAM_END_TOKEN {
+ // Parse an implicit document.
+ if !yaml_parser_process_directives(parser, nil, nil) {
+ return false
+ }
+ parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE)
+ parser.state = yaml_PARSE_BLOCK_NODE_STATE
+
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_START_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+
+ } else if token.typ != yaml_STREAM_END_TOKEN {
+ // Parse an explicit document.
+ var version_directive *yaml_version_directive_t
+ var tag_directives []yaml_tag_directive_t
+ start_mark := token.start_mark
+ if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) {
+ return false
+ }
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_DOCUMENT_START_TOKEN {
+ yaml_parser_set_parser_error(parser,
+ "did not find expected ", token.start_mark)
+ return false
+ }
+ parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE)
+ parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE
+ end_mark := token.end_mark
+
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ version_directive: version_directive,
+ tag_directives: tag_directives,
+ implicit: false,
+ }
+ skip_token(parser)
+
+ } else {
+ // Parse the stream end.
+ parser.state = yaml_PARSE_END_STATE
+ *event = yaml_event_t{
+ typ: yaml_STREAM_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+ skip_token(parser)
+ }
+
+ return true
+}
+
+// Parse the productions:
+// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+// ***********
+//
+func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_VERSION_DIRECTIVE_TOKEN ||
+ token.typ == yaml_TAG_DIRECTIVE_TOKEN ||
+ token.typ == yaml_DOCUMENT_START_TOKEN ||
+ token.typ == yaml_DOCUMENT_END_TOKEN ||
+ token.typ == yaml_STREAM_END_TOKEN {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ return yaml_parser_process_empty_scalar(parser, event,
+ token.start_mark)
+ }
+ return yaml_parser_parse_node(parser, event, true, false)
+}
+
+// Parse the productions:
+// implicit_document ::= block_node DOCUMENT-END*
+// *************
+// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
+//
+func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ start_mark := token.start_mark
+ end_mark := token.start_mark
+
+ implicit := true
+ if token.typ == yaml_DOCUMENT_END_TOKEN {
+ end_mark = token.end_mark
+ skip_token(parser)
+ implicit = false
+ }
+
+ parser.tag_directives = parser.tag_directives[:0]
+
+ parser.state = yaml_PARSE_DOCUMENT_START_STATE
+ *event = yaml_event_t{
+ typ: yaml_DOCUMENT_END_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ implicit: implicit,
+ }
+ return true
+}
+
+// Parse the productions:
+// block_node_or_indentless_sequence ::=
+// ALIAS
+// *****
+// | properties (block_content | indentless_block_sequence)?
+// ********** *
+// | block_content | indentless_block_sequence
+// *
+// block_node ::= ALIAS
+// *****
+// | properties block_content?
+// ********** *
+// | block_content
+// *
+// flow_node ::= ALIAS
+// *****
+// | properties flow_content?
+// ********** *
+// | flow_content
+// *
+// properties ::= TAG ANCHOR? | ANCHOR TAG?
+// *************************
+// block_content ::= block_collection | flow_collection | SCALAR
+// ******
+// flow_content ::= flow_collection | SCALAR
+// ******
+func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool {
+ //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)()
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ == yaml_ALIAS_TOKEN {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ *event = yaml_event_t{
+ typ: yaml_ALIAS_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ anchor: token.value,
+ }
+ skip_token(parser)
+ return true
+ }
+
+ start_mark := token.start_mark
+ end_mark := token.start_mark
+
+ var tag_token bool
+ var tag_handle, tag_suffix, anchor []byte
+ var tag_mark yaml_mark_t
+ if token.typ == yaml_ANCHOR_TOKEN {
+ anchor = token.value
+ start_mark = token.start_mark
+ end_mark = token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_TAG_TOKEN {
+ tag_token = true
+ tag_handle = token.value
+ tag_suffix = token.suffix
+ tag_mark = token.start_mark
+ end_mark = token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ }
+ } else if token.typ == yaml_TAG_TOKEN {
+ tag_token = true
+ tag_handle = token.value
+ tag_suffix = token.suffix
+ start_mark = token.start_mark
+ tag_mark = token.start_mark
+ end_mark = token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_ANCHOR_TOKEN {
+ anchor = token.value
+ end_mark = token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ }
+ }
+
+ var tag []byte
+ if tag_token {
+ if len(tag_handle) == 0 {
+ tag = tag_suffix
+ tag_suffix = nil
+ } else {
+ for i := range parser.tag_directives {
+ if bytes.Equal(parser.tag_directives[i].handle, tag_handle) {
+ tag = append([]byte(nil), parser.tag_directives[i].prefix...)
+ tag = append(tag, tag_suffix...)
+ break
+ }
+ }
+ if len(tag) == 0 {
+ yaml_parser_set_parser_error_context(parser,
+ "while parsing a node", start_mark,
+ "found undefined tag handle", tag_mark)
+ return false
+ }
+ }
+ }
+
+ implicit := len(tag) == 0
+ if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN {
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE),
+ }
+ return true
+ }
+ if token.typ == yaml_SCALAR_TOKEN {
+ var plain_implicit, quoted_implicit bool
+ end_mark = token.end_mark
+ if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') {
+ plain_implicit = true
+ } else if len(tag) == 0 {
+ quoted_implicit = true
+ }
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SCALAR_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ value: token.value,
+ implicit: plain_implicit,
+ quoted_implicit: quoted_implicit,
+ style: yaml_style_t(token.style),
+ }
+ skip_token(parser)
+ return true
+ }
+ if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN {
+ // [Go] Some of the events below can be merged as they differ only on style.
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE),
+ }
+ return true
+ }
+ if token.typ == yaml_FLOW_MAPPING_START_TOKEN {
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_FLOW_MAPPING_STYLE),
+ }
+ return true
+ }
+ if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN {
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE),
+ }
+ return true
+ }
+ if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN {
+ end_mark = token.end_mark
+ parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_START_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE),
+ }
+ return true
+ }
+ if len(anchor) > 0 || len(tag) > 0 {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SCALAR_EVENT,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ anchor: anchor,
+ tag: tag,
+ implicit: implicit,
+ quoted_implicit: false,
+ style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE),
+ }
+ return true
+ }
+
+ context := "while parsing a flow node"
+ if block {
+ context = "while parsing a block node"
+ }
+ yaml_parser_set_parser_error_context(parser, context, start_mark,
+ "did not find expected node content", token.start_mark)
+ return false
+}
+
+// Parse the productions:
+// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END
+// ******************** *********** * *********
+//
+func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
+ if first {
+ token := peek_token(parser)
+ parser.marks = append(parser.marks, token.start_mark)
+ skip_token(parser)
+ }
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ == yaml_BLOCK_ENTRY_TOKEN {
+ mark := token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE)
+ return yaml_parser_parse_node(parser, event, true, false)
+ } else {
+ parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+ }
+ }
+ if token.typ == yaml_BLOCK_END_TOKEN {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+
+ skip_token(parser)
+ return true
+ }
+
+ context_mark := parser.marks[len(parser.marks)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a block collection", context_mark,
+ "did not find expected '-' indicator", token.start_mark)
+}
+
+// Parse the productions:
+// indentless_sequence ::= (BLOCK-ENTRY block_node?)+
+// *********** *
+func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ == yaml_BLOCK_ENTRY_TOKEN {
+ mark := token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_BLOCK_ENTRY_TOKEN &&
+ token.typ != yaml_KEY_TOKEN &&
+ token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_BLOCK_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE)
+ return yaml_parser_parse_node(parser, event, true, false)
+ }
+ parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+ }
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark?
+ }
+ return true
+}
+
+// Parse the productions:
+// block_mapping ::= BLOCK-MAPPING_START
+// *******************
+// ((KEY block_node_or_indentless_sequence?)?
+// *** *
+// (VALUE block_node_or_indentless_sequence?)?)*
+//
+// BLOCK-END
+// *********
+//
+func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
+ if first {
+ token := peek_token(parser)
+ parser.marks = append(parser.marks, token.start_mark)
+ skip_token(parser)
+ }
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ == yaml_KEY_TOKEN {
+ mark := token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_KEY_TOKEN &&
+ token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_BLOCK_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE)
+ return yaml_parser_parse_node(parser, event, true, true)
+ } else {
+ parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+ }
+ } else if token.typ == yaml_BLOCK_END_TOKEN {
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+ skip_token(parser)
+ return true
+ }
+
+ context_mark := parser.marks[len(parser.marks)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a block mapping", context_mark,
+ "did not find expected key", token.start_mark)
+}
+
+// Parse the productions:
+// block_mapping ::= BLOCK-MAPPING_START
+//
+// ((KEY block_node_or_indentless_sequence?)?
+//
+// (VALUE block_node_or_indentless_sequence?)?)*
+// ***** *
+// BLOCK-END
+//
+//
+func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_VALUE_TOKEN {
+ mark := token.end_mark
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_KEY_TOKEN &&
+ token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_BLOCK_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE)
+ return yaml_parser_parse_node(parser, event, true, true)
+ }
+ parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+ }
+ parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+}
+
+// Parse the productions:
+// flow_sequence ::= FLOW-SEQUENCE-START
+// *******************
+// (flow_sequence_entry FLOW-ENTRY)*
+// * **********
+// flow_sequence_entry?
+// *
+// FLOW-SEQUENCE-END
+// *****************
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// *
+//
+func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
+ if first {
+ token := peek_token(parser)
+ parser.marks = append(parser.marks, token.start_mark)
+ skip_token(parser)
+ }
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN {
+ if !first {
+ if token.typ == yaml_FLOW_ENTRY_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ } else {
+ context_mark := parser.marks[len(parser.marks)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a flow sequence", context_mark,
+ "did not find expected ',' or ']'", token.start_mark)
+ }
+ }
+
+ if token.typ == yaml_KEY_TOKEN {
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_START_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ implicit: true,
+ style: yaml_style_t(yaml_FLOW_MAPPING_STYLE),
+ }
+ skip_token(parser)
+ return true
+ } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ }
+
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+
+ *event = yaml_event_t{
+ typ: yaml_SEQUENCE_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+
+ skip_token(parser)
+ return true
+}
+
+//
+// Parse the productions:
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// *** *
+//
+func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_FLOW_ENTRY_TOKEN &&
+ token.typ != yaml_FLOW_SEQUENCE_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ mark := token.end_mark
+ skip_token(parser)
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE
+ return yaml_parser_process_empty_scalar(parser, event, mark)
+}
+
+// Parse the productions:
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// ***** *
+//
+func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ == yaml_VALUE_TOKEN {
+ skip_token(parser)
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ }
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+}
+
+// Parse the productions:
+// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// *
+//
+func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.start_mark, // [Go] Shouldn't this be end_mark?
+ }
+ return true
+}
+
+// Parse the productions:
+// flow_mapping ::= FLOW-MAPPING-START
+// ******************
+// (flow_mapping_entry FLOW-ENTRY)*
+// * **********
+// flow_mapping_entry?
+// ******************
+// FLOW-MAPPING-END
+// ****************
+// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// * *** *
+//
+func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool {
+ if first {
+ token := peek_token(parser)
+ parser.marks = append(parser.marks, token.start_mark)
+ skip_token(parser)
+ }
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ if token.typ != yaml_FLOW_MAPPING_END_TOKEN {
+ if !first {
+ if token.typ == yaml_FLOW_ENTRY_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ } else {
+ context_mark := parser.marks[len(parser.marks)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ return yaml_parser_set_parser_error_context(parser,
+ "while parsing a flow mapping", context_mark,
+ "did not find expected ',' or '}'", token.start_mark)
+ }
+ }
+
+ if token.typ == yaml_KEY_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_VALUE_TOKEN &&
+ token.typ != yaml_FLOW_ENTRY_TOKEN &&
+ token.typ != yaml_FLOW_MAPPING_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ } else {
+ parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+ }
+ } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ }
+
+ parser.state = parser.states[len(parser.states)-1]
+ parser.states = parser.states[:len(parser.states)-1]
+ parser.marks = parser.marks[:len(parser.marks)-1]
+ *event = yaml_event_t{
+ typ: yaml_MAPPING_END_EVENT,
+ start_mark: token.start_mark,
+ end_mark: token.end_mark,
+ }
+ skip_token(parser)
+ return true
+}
+
+// Parse the productions:
+// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)?
+// * ***** *
+//
+func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool {
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if empty {
+ parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+ }
+ if token.typ == yaml_VALUE_TOKEN {
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN {
+ parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE)
+ return yaml_parser_parse_node(parser, event, false, false)
+ }
+ }
+ parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE
+ return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
+}
+
+// Generate an empty scalar event.
+func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool {
+ *event = yaml_event_t{
+ typ: yaml_SCALAR_EVENT,
+ start_mark: mark,
+ end_mark: mark,
+ value: nil, // Empty
+ implicit: true,
+ style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE),
+ }
+ return true
+}
+
+var default_tag_directives = []yaml_tag_directive_t{
+ {[]byte("!"), []byte("!")},
+ {[]byte("!!"), []byte("tag:yaml.org,2002:")},
+}
+
+// Parse directives.
+func yaml_parser_process_directives(parser *yaml_parser_t,
+ version_directive_ref **yaml_version_directive_t,
+ tag_directives_ref *[]yaml_tag_directive_t) bool {
+
+ var version_directive *yaml_version_directive_t
+ var tag_directives []yaml_tag_directive_t
+
+ token := peek_token(parser)
+ if token == nil {
+ return false
+ }
+
+ for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN {
+ if token.typ == yaml_VERSION_DIRECTIVE_TOKEN {
+ if version_directive != nil {
+ yaml_parser_set_parser_error(parser,
+ "found duplicate %YAML directive", token.start_mark)
+ return false
+ }
+ if token.major != 1 || token.minor != 1 {
+ yaml_parser_set_parser_error(parser,
+ "found incompatible YAML document", token.start_mark)
+ return false
+ }
+ version_directive = &yaml_version_directive_t{
+ major: token.major,
+ minor: token.minor,
+ }
+ } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN {
+ value := yaml_tag_directive_t{
+ handle: token.value,
+ prefix: token.prefix,
+ }
+ if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) {
+ return false
+ }
+ tag_directives = append(tag_directives, value)
+ }
+
+ skip_token(parser)
+ token = peek_token(parser)
+ if token == nil {
+ return false
+ }
+ }
+
+ for i := range default_tag_directives {
+ if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) {
+ return false
+ }
+ }
+
+ if version_directive_ref != nil {
+ *version_directive_ref = version_directive
+ }
+ if tag_directives_ref != nil {
+ *tag_directives_ref = tag_directives
+ }
+ return true
+}
+
+// Append a tag directive to the directives stack.
+func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool {
+ for i := range parser.tag_directives {
+ if bytes.Equal(value.handle, parser.tag_directives[i].handle) {
+ if allow_duplicates {
+ return true
+ }
+ return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark)
+ }
+ }
+
+ // [Go] I suspect the copy is unnecessary. This was likely done
+ // because there was no way to track ownership of the data.
+ value_copy := yaml_tag_directive_t{
+ handle: make([]byte, len(value.handle)),
+ prefix: make([]byte, len(value.prefix)),
+ }
+ copy(value_copy.handle, value.handle)
+ copy(value_copy.prefix, value.prefix)
+ parser.tag_directives = append(parser.tag_directives, value_copy)
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go
new file mode 100644
index 000000000..7c1f5fac3
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/readerc.go
@@ -0,0 +1,412 @@
+package yaml
+
+import (
+ "io"
+)
+
+// Set the reader error and return 0.
+func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool {
+ parser.error = yaml_READER_ERROR
+ parser.problem = problem
+ parser.problem_offset = offset
+ parser.problem_value = value
+ return false
+}
+
+// Byte order marks.
+const (
+ bom_UTF8 = "\xef\xbb\xbf"
+ bom_UTF16LE = "\xff\xfe"
+ bom_UTF16BE = "\xfe\xff"
+)
+
+// Determine the input stream encoding by checking the BOM symbol. If no BOM is
+// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure.
+func yaml_parser_determine_encoding(parser *yaml_parser_t) bool {
+ // Ensure that we had enough bytes in the raw buffer.
+ for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 {
+ if !yaml_parser_update_raw_buffer(parser) {
+ return false
+ }
+ }
+
+ // Determine the encoding.
+ buf := parser.raw_buffer
+ pos := parser.raw_buffer_pos
+ avail := len(buf) - pos
+ if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] {
+ parser.encoding = yaml_UTF16LE_ENCODING
+ parser.raw_buffer_pos += 2
+ parser.offset += 2
+ } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] {
+ parser.encoding = yaml_UTF16BE_ENCODING
+ parser.raw_buffer_pos += 2
+ parser.offset += 2
+ } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] {
+ parser.encoding = yaml_UTF8_ENCODING
+ parser.raw_buffer_pos += 3
+ parser.offset += 3
+ } else {
+ parser.encoding = yaml_UTF8_ENCODING
+ }
+ return true
+}
+
+// Update the raw buffer.
+func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool {
+ size_read := 0
+
+ // Return if the raw buffer is full.
+ if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) {
+ return true
+ }
+
+ // Return on EOF.
+ if parser.eof {
+ return true
+ }
+
+ // Move the remaining bytes in the raw buffer to the beginning.
+ if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) {
+ copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:])
+ }
+ parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos]
+ parser.raw_buffer_pos = 0
+
+ // Call the read handler to fill the buffer.
+ size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)])
+ parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read]
+ if err == io.EOF {
+ parser.eof = true
+ } else if err != nil {
+ return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1)
+ }
+ return true
+}
+
+// Ensure that the buffer contains at least `length` characters.
+// Return true on success, false on failure.
+//
+// The length is supposed to be significantly less that the buffer size.
+func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool {
+ if parser.read_handler == nil {
+ panic("read handler must be set")
+ }
+
+ // [Go] This function was changed to guarantee the requested length size at EOF.
+ // The fact we need to do this is pretty awful, but the description above implies
+ // for that to be the case, and there are tests
+
+ // If the EOF flag is set and the raw buffer is empty, do nothing.
+ if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) {
+ // [Go] ACTUALLY! Read the documentation of this function above.
+ // This is just broken. To return true, we need to have the
+ // given length in the buffer. Not doing that means every single
+ // check that calls this function to make sure the buffer has a
+ // given length is Go) panicking; or C) accessing invalid memory.
+ //return true
+ }
+
+ // Return if the buffer contains enough characters.
+ if parser.unread >= length {
+ return true
+ }
+
+ // Determine the input encoding if it is not known yet.
+ if parser.encoding == yaml_ANY_ENCODING {
+ if !yaml_parser_determine_encoding(parser) {
+ return false
+ }
+ }
+
+ // Move the unread characters to the beginning of the buffer.
+ buffer_len := len(parser.buffer)
+ if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len {
+ copy(parser.buffer, parser.buffer[parser.buffer_pos:])
+ buffer_len -= parser.buffer_pos
+ parser.buffer_pos = 0
+ } else if parser.buffer_pos == buffer_len {
+ buffer_len = 0
+ parser.buffer_pos = 0
+ }
+
+ // Open the whole buffer for writing, and cut it before returning.
+ parser.buffer = parser.buffer[:cap(parser.buffer)]
+
+ // Fill the buffer until it has enough characters.
+ first := true
+ for parser.unread < length {
+
+ // Fill the raw buffer if necessary.
+ if !first || parser.raw_buffer_pos == len(parser.raw_buffer) {
+ if !yaml_parser_update_raw_buffer(parser) {
+ parser.buffer = parser.buffer[:buffer_len]
+ return false
+ }
+ }
+ first = false
+
+ // Decode the raw buffer.
+ inner:
+ for parser.raw_buffer_pos != len(parser.raw_buffer) {
+ var value rune
+ var width int
+
+ raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos
+
+ // Decode the next character.
+ switch parser.encoding {
+ case yaml_UTF8_ENCODING:
+ // Decode a UTF-8 character. Check RFC 3629
+ // (http://www.ietf.org/rfc/rfc3629.txt) for more details.
+ //
+ // The following table (taken from the RFC) is used for
+ // decoding.
+ //
+ // Char. number range | UTF-8 octet sequence
+ // (hexadecimal) | (binary)
+ // --------------------+------------------------------------
+ // 0000 0000-0000 007F | 0xxxxxxx
+ // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
+ // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
+ // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ //
+ // Additionally, the characters in the range 0xD800-0xDFFF
+ // are prohibited as they are reserved for use with UTF-16
+ // surrogate pairs.
+
+ // Determine the length of the UTF-8 sequence.
+ octet := parser.raw_buffer[parser.raw_buffer_pos]
+ switch {
+ case octet&0x80 == 0x00:
+ width = 1
+ case octet&0xE0 == 0xC0:
+ width = 2
+ case octet&0xF0 == 0xE0:
+ width = 3
+ case octet&0xF8 == 0xF0:
+ width = 4
+ default:
+ // The leading octet is invalid.
+ return yaml_parser_set_reader_error(parser,
+ "invalid leading UTF-8 octet",
+ parser.offset, int(octet))
+ }
+
+ // Check if the raw buffer contains an incomplete character.
+ if width > raw_unread {
+ if parser.eof {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-8 octet sequence",
+ parser.offset, -1)
+ }
+ break inner
+ }
+
+ // Decode the leading octet.
+ switch {
+ case octet&0x80 == 0x00:
+ value = rune(octet & 0x7F)
+ case octet&0xE0 == 0xC0:
+ value = rune(octet & 0x1F)
+ case octet&0xF0 == 0xE0:
+ value = rune(octet & 0x0F)
+ case octet&0xF8 == 0xF0:
+ value = rune(octet & 0x07)
+ default:
+ value = 0
+ }
+
+ // Check and decode the trailing octets.
+ for k := 1; k < width; k++ {
+ octet = parser.raw_buffer[parser.raw_buffer_pos+k]
+
+ // Check if the octet is valid.
+ if (octet & 0xC0) != 0x80 {
+ return yaml_parser_set_reader_error(parser,
+ "invalid trailing UTF-8 octet",
+ parser.offset+k, int(octet))
+ }
+
+ // Decode the octet.
+ value = (value << 6) + rune(octet&0x3F)
+ }
+
+ // Check the length of the sequence against the value.
+ switch {
+ case width == 1:
+ case width == 2 && value >= 0x80:
+ case width == 3 && value >= 0x800:
+ case width == 4 && value >= 0x10000:
+ default:
+ return yaml_parser_set_reader_error(parser,
+ "invalid length of a UTF-8 sequence",
+ parser.offset, -1)
+ }
+
+ // Check the range of the value.
+ if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF {
+ return yaml_parser_set_reader_error(parser,
+ "invalid Unicode character",
+ parser.offset, int(value))
+ }
+
+ case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING:
+ var low, high int
+ if parser.encoding == yaml_UTF16LE_ENCODING {
+ low, high = 0, 1
+ } else {
+ low, high = 1, 0
+ }
+
+ // The UTF-16 encoding is not as simple as one might
+ // naively think. Check RFC 2781
+ // (http://www.ietf.org/rfc/rfc2781.txt).
+ //
+ // Normally, two subsequent bytes describe a Unicode
+ // character. However a special technique (called a
+ // surrogate pair) is used for specifying character
+ // values larger than 0xFFFF.
+ //
+ // A surrogate pair consists of two pseudo-characters:
+ // high surrogate area (0xD800-0xDBFF)
+ // low surrogate area (0xDC00-0xDFFF)
+ //
+ // The following formulas are used for decoding
+ // and encoding characters using surrogate pairs:
+ //
+ // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF)
+ // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF)
+ // W1 = 110110yyyyyyyyyy
+ // W2 = 110111xxxxxxxxxx
+ //
+ // where U is the character value, W1 is the high surrogate
+ // area, W2 is the low surrogate area.
+
+ // Check for incomplete UTF-16 character.
+ if raw_unread < 2 {
+ if parser.eof {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-16 character",
+ parser.offset, -1)
+ }
+ break inner
+ }
+
+ // Get the character.
+ value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) +
+ (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8)
+
+ // Check for unexpected low surrogate area.
+ if value&0xFC00 == 0xDC00 {
+ return yaml_parser_set_reader_error(parser,
+ "unexpected low surrogate area",
+ parser.offset, int(value))
+ }
+
+ // Check for a high surrogate area.
+ if value&0xFC00 == 0xD800 {
+ width = 4
+
+ // Check for incomplete surrogate pair.
+ if raw_unread < 4 {
+ if parser.eof {
+ return yaml_parser_set_reader_error(parser,
+ "incomplete UTF-16 surrogate pair",
+ parser.offset, -1)
+ }
+ break inner
+ }
+
+ // Get the next character.
+ value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) +
+ (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8)
+
+ // Check for a low surrogate area.
+ if value2&0xFC00 != 0xDC00 {
+ return yaml_parser_set_reader_error(parser,
+ "expected low surrogate area",
+ parser.offset+2, int(value2))
+ }
+
+ // Generate the value of the surrogate pair.
+ value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF)
+ } else {
+ width = 2
+ }
+
+ default:
+ panic("impossible")
+ }
+
+ // Check if the character is in the allowed range:
+ // #x9 | #xA | #xD | [#x20-#x7E] (8 bit)
+ // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit)
+ // | [#x10000-#x10FFFF] (32 bit)
+ switch {
+ case value == 0x09:
+ case value == 0x0A:
+ case value == 0x0D:
+ case value >= 0x20 && value <= 0x7E:
+ case value == 0x85:
+ case value >= 0xA0 && value <= 0xD7FF:
+ case value >= 0xE000 && value <= 0xFFFD:
+ case value >= 0x10000 && value <= 0x10FFFF:
+ default:
+ return yaml_parser_set_reader_error(parser,
+ "control characters are not allowed",
+ parser.offset, int(value))
+ }
+
+ // Move the raw pointers.
+ parser.raw_buffer_pos += width
+ parser.offset += width
+
+ // Finally put the character into the buffer.
+ if value <= 0x7F {
+ // 0000 0000-0000 007F . 0xxxxxxx
+ parser.buffer[buffer_len+0] = byte(value)
+ buffer_len += 1
+ } else if value <= 0x7FF {
+ // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx
+ parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6))
+ parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F))
+ buffer_len += 2
+ } else if value <= 0xFFFF {
+ // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx
+ parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12))
+ parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F))
+ parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F))
+ buffer_len += 3
+ } else {
+ // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18))
+ parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F))
+ parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F))
+ parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F))
+ buffer_len += 4
+ }
+
+ parser.unread++
+ }
+
+ // On EOF, put NUL into the buffer and return.
+ if parser.eof {
+ parser.buffer[buffer_len] = 0
+ buffer_len++
+ parser.unread++
+ break
+ }
+ }
+ // [Go] Read the documentation of this function above. To return true,
+ // we need to have the given length in the buffer. Not doing that means
+ // every single check that calls this function to make sure the buffer
+ // has a given length is Go) panicking; or C) accessing invalid memory.
+ // This happens here due to the EOF above breaking early.
+ for buffer_len < length {
+ parser.buffer[buffer_len] = 0
+ buffer_len++
+ }
+ parser.buffer = parser.buffer[:buffer_len]
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go
new file mode 100644
index 000000000..4120e0c91
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/resolve.go
@@ -0,0 +1,258 @@
+package yaml
+
+import (
+ "encoding/base64"
+ "math"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+)
+
+type resolveMapItem struct {
+ value interface{}
+ tag string
+}
+
+var resolveTable = make([]byte, 256)
+var resolveMap = make(map[string]resolveMapItem)
+
+func init() {
+ t := resolveTable
+ t[int('+')] = 'S' // Sign
+ t[int('-')] = 'S'
+ for _, c := range "0123456789" {
+ t[int(c)] = 'D' // Digit
+ }
+ for _, c := range "yYnNtTfFoO~" {
+ t[int(c)] = 'M' // In map
+ }
+ t[int('.')] = '.' // Float (potentially in map)
+
+ var resolveMapList = []struct {
+ v interface{}
+ tag string
+ l []string
+ }{
+ {true, yaml_BOOL_TAG, []string{"y", "Y", "yes", "Yes", "YES"}},
+ {true, yaml_BOOL_TAG, []string{"true", "True", "TRUE"}},
+ {true, yaml_BOOL_TAG, []string{"on", "On", "ON"}},
+ {false, yaml_BOOL_TAG, []string{"n", "N", "no", "No", "NO"}},
+ {false, yaml_BOOL_TAG, []string{"false", "False", "FALSE"}},
+ {false, yaml_BOOL_TAG, []string{"off", "Off", "OFF"}},
+ {nil, yaml_NULL_TAG, []string{"", "~", "null", "Null", "NULL"}},
+ {math.NaN(), yaml_FLOAT_TAG, []string{".nan", ".NaN", ".NAN"}},
+ {math.Inf(+1), yaml_FLOAT_TAG, []string{".inf", ".Inf", ".INF"}},
+ {math.Inf(+1), yaml_FLOAT_TAG, []string{"+.inf", "+.Inf", "+.INF"}},
+ {math.Inf(-1), yaml_FLOAT_TAG, []string{"-.inf", "-.Inf", "-.INF"}},
+ {"<<", yaml_MERGE_TAG, []string{"<<"}},
+ }
+
+ m := resolveMap
+ for _, item := range resolveMapList {
+ for _, s := range item.l {
+ m[s] = resolveMapItem{item.v, item.tag}
+ }
+ }
+}
+
+const longTagPrefix = "tag:yaml.org,2002:"
+
+func shortTag(tag string) string {
+ // TODO This can easily be made faster and produce less garbage.
+ if strings.HasPrefix(tag, longTagPrefix) {
+ return "!!" + tag[len(longTagPrefix):]
+ }
+ return tag
+}
+
+func longTag(tag string) string {
+ if strings.HasPrefix(tag, "!!") {
+ return longTagPrefix + tag[2:]
+ }
+ return tag
+}
+
+func resolvableTag(tag string) bool {
+ switch tag {
+ case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG, yaml_TIMESTAMP_TAG:
+ return true
+ }
+ return false
+}
+
+var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`)
+
+func resolve(tag string, in string) (rtag string, out interface{}) {
+ if !resolvableTag(tag) {
+ return tag, in
+ }
+
+ defer func() {
+ switch tag {
+ case "", rtag, yaml_STR_TAG, yaml_BINARY_TAG:
+ return
+ case yaml_FLOAT_TAG:
+ if rtag == yaml_INT_TAG {
+ switch v := out.(type) {
+ case int64:
+ rtag = yaml_FLOAT_TAG
+ out = float64(v)
+ return
+ case int:
+ rtag = yaml_FLOAT_TAG
+ out = float64(v)
+ return
+ }
+ }
+ }
+ failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag))
+ }()
+
+ // Any data is accepted as a !!str or !!binary.
+ // Otherwise, the prefix is enough of a hint about what it might be.
+ hint := byte('N')
+ if in != "" {
+ hint = resolveTable[in[0]]
+ }
+ if hint != 0 && tag != yaml_STR_TAG && tag != yaml_BINARY_TAG {
+ // Handle things we can lookup in a map.
+ if item, ok := resolveMap[in]; ok {
+ return item.tag, item.value
+ }
+
+ // Base 60 floats are a bad idea, were dropped in YAML 1.2, and
+ // are purposefully unsupported here. They're still quoted on
+ // the way out for compatibility with other parser, though.
+
+ switch hint {
+ case 'M':
+ // We've already checked the map above.
+
+ case '.':
+ // Not in the map, so maybe a normal float.
+ floatv, err := strconv.ParseFloat(in, 64)
+ if err == nil {
+ return yaml_FLOAT_TAG, floatv
+ }
+
+ case 'D', 'S':
+ // Int, float, or timestamp.
+ // Only try values as a timestamp if the value is unquoted or there's an explicit
+ // !!timestamp tag.
+ if tag == "" || tag == yaml_TIMESTAMP_TAG {
+ t, ok := parseTimestamp(in)
+ if ok {
+ return yaml_TIMESTAMP_TAG, t
+ }
+ }
+
+ plain := strings.Replace(in, "_", "", -1)
+ intv, err := strconv.ParseInt(plain, 0, 64)
+ if err == nil {
+ if intv == int64(int(intv)) {
+ return yaml_INT_TAG, int(intv)
+ } else {
+ return yaml_INT_TAG, intv
+ }
+ }
+ uintv, err := strconv.ParseUint(plain, 0, 64)
+ if err == nil {
+ return yaml_INT_TAG, uintv
+ }
+ if yamlStyleFloat.MatchString(plain) {
+ floatv, err := strconv.ParseFloat(plain, 64)
+ if err == nil {
+ return yaml_FLOAT_TAG, floatv
+ }
+ }
+ if strings.HasPrefix(plain, "0b") {
+ intv, err := strconv.ParseInt(plain[2:], 2, 64)
+ if err == nil {
+ if intv == int64(int(intv)) {
+ return yaml_INT_TAG, int(intv)
+ } else {
+ return yaml_INT_TAG, intv
+ }
+ }
+ uintv, err := strconv.ParseUint(plain[2:], 2, 64)
+ if err == nil {
+ return yaml_INT_TAG, uintv
+ }
+ } else if strings.HasPrefix(plain, "-0b") {
+ intv, err := strconv.ParseInt("-" + plain[3:], 2, 64)
+ if err == nil {
+ if true || intv == int64(int(intv)) {
+ return yaml_INT_TAG, int(intv)
+ } else {
+ return yaml_INT_TAG, intv
+ }
+ }
+ }
+ default:
+ panic("resolveTable item not yet handled: " + string(rune(hint)) + " (with " + in + ")")
+ }
+ }
+ return yaml_STR_TAG, in
+}
+
+// encodeBase64 encodes s as base64 that is broken up into multiple lines
+// as appropriate for the resulting length.
+func encodeBase64(s string) string {
+ const lineLen = 70
+ encLen := base64.StdEncoding.EncodedLen(len(s))
+ lines := encLen/lineLen + 1
+ buf := make([]byte, encLen*2+lines)
+ in := buf[0:encLen]
+ out := buf[encLen:]
+ base64.StdEncoding.Encode(in, []byte(s))
+ k := 0
+ for i := 0; i < len(in); i += lineLen {
+ j := i + lineLen
+ if j > len(in) {
+ j = len(in)
+ }
+ k += copy(out[k:], in[i:j])
+ if lines > 1 {
+ out[k] = '\n'
+ k++
+ }
+ }
+ return string(out[:k])
+}
+
+// This is a subset of the formats allowed by the regular expression
+// defined at http://yaml.org/type/timestamp.html.
+var allowedTimestampFormats = []string{
+ "2006-1-2T15:4:5.999999999Z07:00", // RCF3339Nano with short date fields.
+ "2006-1-2t15:4:5.999999999Z07:00", // RFC3339Nano with short date fields and lower-case "t".
+ "2006-1-2 15:4:5.999999999", // space separated with no time zone
+ "2006-1-2", // date only
+ // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5"
+ // from the set of examples.
+}
+
+// parseTimestamp parses s as a timestamp string and
+// returns the timestamp and reports whether it succeeded.
+// Timestamp formats are defined at http://yaml.org/type/timestamp.html
+func parseTimestamp(s string) (time.Time, bool) {
+ // TODO write code to check all the formats supported by
+ // http://yaml.org/type/timestamp.html instead of using time.Parse.
+
+ // Quick check: all date formats start with YYYY-.
+ i := 0
+ for ; i < len(s); i++ {
+ if c := s[i]; c < '0' || c > '9' {
+ break
+ }
+ }
+ if i != 4 || i == len(s) || s[i] != '-' {
+ return time.Time{}, false
+ }
+ for _, format := range allowedTimestampFormats {
+ if t, err := time.Parse(format, s); err == nil {
+ return t, true
+ }
+ }
+ return time.Time{}, false
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go
new file mode 100644
index 000000000..0b9bb6030
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/scannerc.go
@@ -0,0 +1,2711 @@
+package yaml
+
+import (
+ "bytes"
+ "fmt"
+)
+
+// Introduction
+// ************
+//
+// The following notes assume that you are familiar with the YAML specification
+// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in
+// some cases we are less restrictive that it requires.
+//
+// The process of transforming a YAML stream into a sequence of events is
+// divided on two steps: Scanning and Parsing.
+//
+// The Scanner transforms the input stream into a sequence of tokens, while the
+// parser transform the sequence of tokens produced by the Scanner into a
+// sequence of parsing events.
+//
+// The Scanner is rather clever and complicated. The Parser, on the contrary,
+// is a straightforward implementation of a recursive-descendant parser (or,
+// LL(1) parser, as it is usually called).
+//
+// Actually there are two issues of Scanning that might be called "clever", the
+// rest is quite straightforward. The issues are "block collection start" and
+// "simple keys". Both issues are explained below in details.
+//
+// Here the Scanning step is explained and implemented. We start with the list
+// of all the tokens produced by the Scanner together with short descriptions.
+//
+// Now, tokens:
+//
+// STREAM-START(encoding) # The stream start.
+// STREAM-END # The stream end.
+// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive.
+// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive.
+// DOCUMENT-START # '---'
+// DOCUMENT-END # '...'
+// BLOCK-SEQUENCE-START # Indentation increase denoting a block
+// BLOCK-MAPPING-START # sequence or a block mapping.
+// BLOCK-END # Indentation decrease.
+// FLOW-SEQUENCE-START # '['
+// FLOW-SEQUENCE-END # ']'
+// BLOCK-SEQUENCE-START # '{'
+// BLOCK-SEQUENCE-END # '}'
+// BLOCK-ENTRY # '-'
+// FLOW-ENTRY # ','
+// KEY # '?' or nothing (simple keys).
+// VALUE # ':'
+// ALIAS(anchor) # '*anchor'
+// ANCHOR(anchor) # '&anchor'
+// TAG(handle,suffix) # '!handle!suffix'
+// SCALAR(value,style) # A scalar.
+//
+// The following two tokens are "virtual" tokens denoting the beginning and the
+// end of the stream:
+//
+// STREAM-START(encoding)
+// STREAM-END
+//
+// We pass the information about the input stream encoding with the
+// STREAM-START token.
+//
+// The next two tokens are responsible for tags:
+//
+// VERSION-DIRECTIVE(major,minor)
+// TAG-DIRECTIVE(handle,prefix)
+//
+// Example:
+//
+// %YAML 1.1
+// %TAG ! !foo
+// %TAG !yaml! tag:yaml.org,2002:
+// ---
+//
+// The correspoding sequence of tokens:
+//
+// STREAM-START(utf-8)
+// VERSION-DIRECTIVE(1,1)
+// TAG-DIRECTIVE("!","!foo")
+// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:")
+// DOCUMENT-START
+// STREAM-END
+//
+// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole
+// line.
+//
+// The document start and end indicators are represented by:
+//
+// DOCUMENT-START
+// DOCUMENT-END
+//
+// Note that if a YAML stream contains an implicit document (without '---'
+// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be
+// produced.
+//
+// In the following examples, we present whole documents together with the
+// produced tokens.
+//
+// 1. An implicit document:
+//
+// 'a scalar'
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// SCALAR("a scalar",single-quoted)
+// STREAM-END
+//
+// 2. An explicit document:
+//
+// ---
+// 'a scalar'
+// ...
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// DOCUMENT-START
+// SCALAR("a scalar",single-quoted)
+// DOCUMENT-END
+// STREAM-END
+//
+// 3. Several documents in a stream:
+//
+// 'a scalar'
+// ---
+// 'another scalar'
+// ---
+// 'yet another scalar'
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// SCALAR("a scalar",single-quoted)
+// DOCUMENT-START
+// SCALAR("another scalar",single-quoted)
+// DOCUMENT-START
+// SCALAR("yet another scalar",single-quoted)
+// STREAM-END
+//
+// We have already introduced the SCALAR token above. The following tokens are
+// used to describe aliases, anchors, tag, and scalars:
+//
+// ALIAS(anchor)
+// ANCHOR(anchor)
+// TAG(handle,suffix)
+// SCALAR(value,style)
+//
+// The following series of examples illustrate the usage of these tokens:
+//
+// 1. A recursive sequence:
+//
+// &A [ *A ]
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// ANCHOR("A")
+// FLOW-SEQUENCE-START
+// ALIAS("A")
+// FLOW-SEQUENCE-END
+// STREAM-END
+//
+// 2. A tagged scalar:
+//
+// !!float "3.14" # A good approximation.
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// TAG("!!","float")
+// SCALAR("3.14",double-quoted)
+// STREAM-END
+//
+// 3. Various scalar styles:
+//
+// --- # Implicit empty plain scalars do not produce tokens.
+// --- a plain scalar
+// --- 'a single-quoted scalar'
+// --- "a double-quoted scalar"
+// --- |-
+// a literal scalar
+// --- >-
+// a folded
+// scalar
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// DOCUMENT-START
+// DOCUMENT-START
+// SCALAR("a plain scalar",plain)
+// DOCUMENT-START
+// SCALAR("a single-quoted scalar",single-quoted)
+// DOCUMENT-START
+// SCALAR("a double-quoted scalar",double-quoted)
+// DOCUMENT-START
+// SCALAR("a literal scalar",literal)
+// DOCUMENT-START
+// SCALAR("a folded scalar",folded)
+// STREAM-END
+//
+// Now it's time to review collection-related tokens. We will start with
+// flow collections:
+//
+// FLOW-SEQUENCE-START
+// FLOW-SEQUENCE-END
+// FLOW-MAPPING-START
+// FLOW-MAPPING-END
+// FLOW-ENTRY
+// KEY
+// VALUE
+//
+// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and
+// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}'
+// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the
+// indicators '?' and ':', which are used for denoting mapping keys and values,
+// are represented by the KEY and VALUE tokens.
+//
+// The following examples show flow collections:
+//
+// 1. A flow sequence:
+//
+// [item 1, item 2, item 3]
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// FLOW-SEQUENCE-START
+// SCALAR("item 1",plain)
+// FLOW-ENTRY
+// SCALAR("item 2",plain)
+// FLOW-ENTRY
+// SCALAR("item 3",plain)
+// FLOW-SEQUENCE-END
+// STREAM-END
+//
+// 2. A flow mapping:
+//
+// {
+// a simple key: a value, # Note that the KEY token is produced.
+// ? a complex key: another value,
+// }
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// FLOW-MAPPING-START
+// KEY
+// SCALAR("a simple key",plain)
+// VALUE
+// SCALAR("a value",plain)
+// FLOW-ENTRY
+// KEY
+// SCALAR("a complex key",plain)
+// VALUE
+// SCALAR("another value",plain)
+// FLOW-ENTRY
+// FLOW-MAPPING-END
+// STREAM-END
+//
+// A simple key is a key which is not denoted by the '?' indicator. Note that
+// the Scanner still produce the KEY token whenever it encounters a simple key.
+//
+// For scanning block collections, the following tokens are used (note that we
+// repeat KEY and VALUE here):
+//
+// BLOCK-SEQUENCE-START
+// BLOCK-MAPPING-START
+// BLOCK-END
+// BLOCK-ENTRY
+// KEY
+// VALUE
+//
+// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation
+// increase that precedes a block collection (cf. the INDENT token in Python).
+// The token BLOCK-END denote indentation decrease that ends a block collection
+// (cf. the DEDENT token in Python). However YAML has some syntax pecularities
+// that makes detections of these tokens more complex.
+//
+// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators
+// '-', '?', and ':' correspondingly.
+//
+// The following examples show how the tokens BLOCK-SEQUENCE-START,
+// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner:
+//
+// 1. Block sequences:
+//
+// - item 1
+// - item 2
+// -
+// - item 3.1
+// - item 3.2
+// -
+// key 1: value 1
+// key 2: value 2
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-ENTRY
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 3.1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 3.2",plain)
+// BLOCK-END
+// BLOCK-ENTRY
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key 1",plain)
+// VALUE
+// SCALAR("value 1",plain)
+// KEY
+// SCALAR("key 2",plain)
+// VALUE
+// SCALAR("value 2",plain)
+// BLOCK-END
+// BLOCK-END
+// STREAM-END
+//
+// 2. Block mappings:
+//
+// a simple key: a value # The KEY token is produced here.
+// ? a complex key
+// : another value
+// a mapping:
+// key 1: value 1
+// key 2: value 2
+// a sequence:
+// - item 1
+// - item 2
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("a simple key",plain)
+// VALUE
+// SCALAR("a value",plain)
+// KEY
+// SCALAR("a complex key",plain)
+// VALUE
+// SCALAR("another value",plain)
+// KEY
+// SCALAR("a mapping",plain)
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key 1",plain)
+// VALUE
+// SCALAR("value 1",plain)
+// KEY
+// SCALAR("key 2",plain)
+// VALUE
+// SCALAR("value 2",plain)
+// BLOCK-END
+// KEY
+// SCALAR("a sequence",plain)
+// VALUE
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-END
+// BLOCK-END
+// STREAM-END
+//
+// YAML does not always require to start a new block collection from a new
+// line. If the current line contains only '-', '?', and ':' indicators, a new
+// block collection may start at the current line. The following examples
+// illustrate this case:
+//
+// 1. Collections in a sequence:
+//
+// - - item 1
+// - item 2
+// - key 1: value 1
+// key 2: value 2
+// - ? complex key
+// : complex value
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-END
+// BLOCK-ENTRY
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key 1",plain)
+// VALUE
+// SCALAR("value 1",plain)
+// KEY
+// SCALAR("key 2",plain)
+// VALUE
+// SCALAR("value 2",plain)
+// BLOCK-END
+// BLOCK-ENTRY
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("complex key")
+// VALUE
+// SCALAR("complex value")
+// BLOCK-END
+// BLOCK-END
+// STREAM-END
+//
+// 2. Collections in a mapping:
+//
+// ? a sequence
+// : - item 1
+// - item 2
+// ? a mapping
+// : key 1: value 1
+// key 2: value 2
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("a sequence",plain)
+// VALUE
+// BLOCK-SEQUENCE-START
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-END
+// KEY
+// SCALAR("a mapping",plain)
+// VALUE
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key 1",plain)
+// VALUE
+// SCALAR("value 1",plain)
+// KEY
+// SCALAR("key 2",plain)
+// VALUE
+// SCALAR("value 2",plain)
+// BLOCK-END
+// BLOCK-END
+// STREAM-END
+//
+// YAML also permits non-indented sequences if they are included into a block
+// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced:
+//
+// key:
+// - item 1 # BLOCK-SEQUENCE-START is NOT produced here.
+// - item 2
+//
+// Tokens:
+//
+// STREAM-START(utf-8)
+// BLOCK-MAPPING-START
+// KEY
+// SCALAR("key",plain)
+// VALUE
+// BLOCK-ENTRY
+// SCALAR("item 1",plain)
+// BLOCK-ENTRY
+// SCALAR("item 2",plain)
+// BLOCK-END
+//
+
+// Ensure that the buffer contains the required number of characters.
+// Return true on success, false on failure (reader error or memory error).
+func cache(parser *yaml_parser_t, length int) bool {
+ // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B)
+ return parser.unread >= length || yaml_parser_update_buffer(parser, length)
+}
+
+// Advance the buffer pointer.
+func skip(parser *yaml_parser_t) {
+ parser.mark.index++
+ parser.mark.column++
+ parser.unread--
+ parser.buffer_pos += width(parser.buffer[parser.buffer_pos])
+}
+
+func skip_line(parser *yaml_parser_t) {
+ if is_crlf(parser.buffer, parser.buffer_pos) {
+ parser.mark.index += 2
+ parser.mark.column = 0
+ parser.mark.line++
+ parser.unread -= 2
+ parser.buffer_pos += 2
+ } else if is_break(parser.buffer, parser.buffer_pos) {
+ parser.mark.index++
+ parser.mark.column = 0
+ parser.mark.line++
+ parser.unread--
+ parser.buffer_pos += width(parser.buffer[parser.buffer_pos])
+ }
+}
+
+// Copy a character to a string buffer and advance pointers.
+func read(parser *yaml_parser_t, s []byte) []byte {
+ w := width(parser.buffer[parser.buffer_pos])
+ if w == 0 {
+ panic("invalid character sequence")
+ }
+ if len(s) == 0 {
+ s = make([]byte, 0, 32)
+ }
+ if w == 1 && len(s)+w <= cap(s) {
+ s = s[:len(s)+1]
+ s[len(s)-1] = parser.buffer[parser.buffer_pos]
+ parser.buffer_pos++
+ } else {
+ s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...)
+ parser.buffer_pos += w
+ }
+ parser.mark.index++
+ parser.mark.column++
+ parser.unread--
+ return s
+}
+
+// Copy a line break character to a string buffer and advance pointers.
+func read_line(parser *yaml_parser_t, s []byte) []byte {
+ buf := parser.buffer
+ pos := parser.buffer_pos
+ switch {
+ case buf[pos] == '\r' && buf[pos+1] == '\n':
+ // CR LF . LF
+ s = append(s, '\n')
+ parser.buffer_pos += 2
+ parser.mark.index++
+ parser.unread--
+ case buf[pos] == '\r' || buf[pos] == '\n':
+ // CR|LF . LF
+ s = append(s, '\n')
+ parser.buffer_pos += 1
+ case buf[pos] == '\xC2' && buf[pos+1] == '\x85':
+ // NEL . LF
+ s = append(s, '\n')
+ parser.buffer_pos += 2
+ case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'):
+ // LS|PS . LS|PS
+ s = append(s, buf[parser.buffer_pos:pos+3]...)
+ parser.buffer_pos += 3
+ default:
+ return s
+ }
+ parser.mark.index++
+ parser.mark.column = 0
+ parser.mark.line++
+ parser.unread--
+ return s
+}
+
+// Get the next token.
+func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool {
+ // Erase the token object.
+ *token = yaml_token_t{} // [Go] Is this necessary?
+
+ // No tokens after STREAM-END or error.
+ if parser.stream_end_produced || parser.error != yaml_NO_ERROR {
+ return true
+ }
+
+ // Ensure that the tokens queue contains enough tokens.
+ if !parser.token_available {
+ if !yaml_parser_fetch_more_tokens(parser) {
+ return false
+ }
+ }
+
+ // Fetch the next token from the queue.
+ *token = parser.tokens[parser.tokens_head]
+ parser.tokens_head++
+ parser.tokens_parsed++
+ parser.token_available = false
+
+ if token.typ == yaml_STREAM_END_TOKEN {
+ parser.stream_end_produced = true
+ }
+ return true
+}
+
+// Set the scanner error and return false.
+func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool {
+ parser.error = yaml_SCANNER_ERROR
+ parser.context = context
+ parser.context_mark = context_mark
+ parser.problem = problem
+ parser.problem_mark = parser.mark
+ return false
+}
+
+func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool {
+ context := "while parsing a tag"
+ if directive {
+ context = "while parsing a %TAG directive"
+ }
+ return yaml_parser_set_scanner_error(parser, context, context_mark, problem)
+}
+
+func trace(args ...interface{}) func() {
+ pargs := append([]interface{}{"+++"}, args...)
+ fmt.Println(pargs...)
+ pargs = append([]interface{}{"---"}, args...)
+ return func() { fmt.Println(pargs...) }
+}
+
+// Ensure that the tokens queue contains at least one token which can be
+// returned to the Parser.
+func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool {
+ // While we need more tokens to fetch, do it.
+ for {
+ if parser.tokens_head != len(parser.tokens) {
+ // If queue is non-empty, check if any potential simple key may
+ // occupy the head position.
+ head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed]
+ if !ok {
+ break
+ } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok {
+ return false
+ } else if !valid {
+ break
+ }
+ }
+ // Fetch the next token.
+ if !yaml_parser_fetch_next_token(parser) {
+ return false
+ }
+ }
+
+ parser.token_available = true
+ return true
+}
+
+// The dispatcher for token fetchers.
+func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool {
+ // Ensure that the buffer is initialized.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ // Check if we just started scanning. Fetch STREAM-START then.
+ if !parser.stream_start_produced {
+ return yaml_parser_fetch_stream_start(parser)
+ }
+
+ // Eat whitespaces and comments until we reach the next token.
+ if !yaml_parser_scan_to_next_token(parser) {
+ return false
+ }
+
+ // Check the indentation level against the current column.
+ if !yaml_parser_unroll_indent(parser, parser.mark.column) {
+ return false
+ }
+
+ // Ensure that the buffer contains at least 4 characters. 4 is the length
+ // of the longest indicators ('--- ' and '... ').
+ if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) {
+ return false
+ }
+
+ // Is it the end of the stream?
+ if is_z(parser.buffer, parser.buffer_pos) {
+ return yaml_parser_fetch_stream_end(parser)
+ }
+
+ // Is it a directive?
+ if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' {
+ return yaml_parser_fetch_directive(parser)
+ }
+
+ buf := parser.buffer
+ pos := parser.buffer_pos
+
+ // Is it the document start indicator?
+ if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) {
+ return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN)
+ }
+
+ // Is it the document end indicator?
+ if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) {
+ return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN)
+ }
+
+ // Is it the flow sequence start indicator?
+ if buf[pos] == '[' {
+ return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN)
+ }
+
+ // Is it the flow mapping start indicator?
+ if parser.buffer[parser.buffer_pos] == '{' {
+ return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN)
+ }
+
+ // Is it the flow sequence end indicator?
+ if parser.buffer[parser.buffer_pos] == ']' {
+ return yaml_parser_fetch_flow_collection_end(parser,
+ yaml_FLOW_SEQUENCE_END_TOKEN)
+ }
+
+ // Is it the flow mapping end indicator?
+ if parser.buffer[parser.buffer_pos] == '}' {
+ return yaml_parser_fetch_flow_collection_end(parser,
+ yaml_FLOW_MAPPING_END_TOKEN)
+ }
+
+ // Is it the flow entry indicator?
+ if parser.buffer[parser.buffer_pos] == ',' {
+ return yaml_parser_fetch_flow_entry(parser)
+ }
+
+ // Is it the block entry indicator?
+ if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) {
+ return yaml_parser_fetch_block_entry(parser)
+ }
+
+ // Is it the key indicator?
+ if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) {
+ return yaml_parser_fetch_key(parser)
+ }
+
+ // Is it the value indicator?
+ if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) {
+ return yaml_parser_fetch_value(parser)
+ }
+
+ // Is it an alias?
+ if parser.buffer[parser.buffer_pos] == '*' {
+ return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN)
+ }
+
+ // Is it an anchor?
+ if parser.buffer[parser.buffer_pos] == '&' {
+ return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN)
+ }
+
+ // Is it a tag?
+ if parser.buffer[parser.buffer_pos] == '!' {
+ return yaml_parser_fetch_tag(parser)
+ }
+
+ // Is it a literal scalar?
+ if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 {
+ return yaml_parser_fetch_block_scalar(parser, true)
+ }
+
+ // Is it a folded scalar?
+ if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 {
+ return yaml_parser_fetch_block_scalar(parser, false)
+ }
+
+ // Is it a single-quoted scalar?
+ if parser.buffer[parser.buffer_pos] == '\'' {
+ return yaml_parser_fetch_flow_scalar(parser, true)
+ }
+
+ // Is it a double-quoted scalar?
+ if parser.buffer[parser.buffer_pos] == '"' {
+ return yaml_parser_fetch_flow_scalar(parser, false)
+ }
+
+ // Is it a plain scalar?
+ //
+ // A plain scalar may start with any non-blank characters except
+ //
+ // '-', '?', ':', ',', '[', ']', '{', '}',
+ // '#', '&', '*', '!', '|', '>', '\'', '\"',
+ // '%', '@', '`'.
+ //
+ // In the block context (and, for the '-' indicator, in the flow context
+ // too), it may also start with the characters
+ //
+ // '-', '?', ':'
+ //
+ // if it is followed by a non-space character.
+ //
+ // The last rule is more restrictive than the specification requires.
+ // [Go] Make this logic more reasonable.
+ //switch parser.buffer[parser.buffer_pos] {
+ //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`':
+ //}
+ if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' ||
+ parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' ||
+ parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' ||
+ parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' ||
+ parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' ||
+ parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' ||
+ parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' ||
+ parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' ||
+ parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' ||
+ parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') ||
+ (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) ||
+ (parser.flow_level == 0 &&
+ (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') &&
+ !is_blankz(parser.buffer, parser.buffer_pos+1)) {
+ return yaml_parser_fetch_plain_scalar(parser)
+ }
+
+ // If we don't determine the token type so far, it is an error.
+ return yaml_parser_set_scanner_error(parser,
+ "while scanning for the next token", parser.mark,
+ "found character that cannot start any token")
+}
+
+func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) {
+ if !simple_key.possible {
+ return false, true
+ }
+
+ // The 1.2 specification says:
+ //
+ // "If the ? indicator is omitted, parsing needs to see past the
+ // implicit key to recognize it as such. To limit the amount of
+ // lookahead required, the “:” indicator must appear at most 1024
+ // Unicode characters beyond the start of the key. In addition, the key
+ // is restricted to a single line."
+ //
+ if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index {
+ // Check if the potential simple key to be removed is required.
+ if simple_key.required {
+ return false, yaml_parser_set_scanner_error(parser,
+ "while scanning a simple key", simple_key.mark,
+ "could not find expected ':'")
+ }
+ simple_key.possible = false
+ return false, true
+ }
+ return true, true
+}
+
+// Check if a simple key may start at the current position and add it if
+// needed.
+func yaml_parser_save_simple_key(parser *yaml_parser_t) bool {
+ // A simple key is required at the current position if the scanner is in
+ // the block context and the current column coincides with the indentation
+ // level.
+
+ required := parser.flow_level == 0 && parser.indent == parser.mark.column
+
+ //
+ // If the current position may start a simple key, save it.
+ //
+ if parser.simple_key_allowed {
+ simple_key := yaml_simple_key_t{
+ possible: true,
+ required: required,
+ token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head),
+ mark: parser.mark,
+ }
+
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+ parser.simple_keys[len(parser.simple_keys)-1] = simple_key
+ parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1
+ }
+ return true
+}
+
+// Remove a potential simple key at the current flow level.
+func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool {
+ i := len(parser.simple_keys) - 1
+ if parser.simple_keys[i].possible {
+ // If the key is required, it is an error.
+ if parser.simple_keys[i].required {
+ return yaml_parser_set_scanner_error(parser,
+ "while scanning a simple key", parser.simple_keys[i].mark,
+ "could not find expected ':'")
+ }
+ // Remove the key from the stack.
+ parser.simple_keys[i].possible = false
+ delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number)
+ }
+ return true
+}
+
+// max_flow_level limits the flow_level
+const max_flow_level = 10000
+
+// Increase the flow level and resize the simple key list if needed.
+func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool {
+ // Reset the simple key on the next level.
+ parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{
+ possible: false,
+ required: false,
+ token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head),
+ mark: parser.mark,
+ })
+
+ // Increase the flow level.
+ parser.flow_level++
+ if parser.flow_level > max_flow_level {
+ return yaml_parser_set_scanner_error(parser,
+ "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark,
+ fmt.Sprintf("exceeded max depth of %d", max_flow_level))
+ }
+ return true
+}
+
+// Decrease the flow level.
+func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool {
+ if parser.flow_level > 0 {
+ parser.flow_level--
+ last := len(parser.simple_keys) - 1
+ delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number)
+ parser.simple_keys = parser.simple_keys[:last]
+ }
+ return true
+}
+
+// max_indents limits the indents stack size
+const max_indents = 10000
+
+// Push the current indentation level to the stack and set the new level
+// the current column is greater than the indentation level. In this case,
+// append or insert the specified token into the token queue.
+func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool {
+ // In the flow context, do nothing.
+ if parser.flow_level > 0 {
+ return true
+ }
+
+ if parser.indent < column {
+ // Push the current indentation level to the stack and set the new
+ // indentation level.
+ parser.indents = append(parser.indents, parser.indent)
+ parser.indent = column
+ if len(parser.indents) > max_indents {
+ return yaml_parser_set_scanner_error(parser,
+ "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark,
+ fmt.Sprintf("exceeded max depth of %d", max_indents))
+ }
+
+ // Create a token and insert it into the queue.
+ token := yaml_token_t{
+ typ: typ,
+ start_mark: mark,
+ end_mark: mark,
+ }
+ if number > -1 {
+ number -= parser.tokens_parsed
+ }
+ yaml_insert_token(parser, number, &token)
+ }
+ return true
+}
+
+// Pop indentation levels from the indents stack until the current level
+// becomes less or equal to the column. For each indentation level, append
+// the BLOCK-END token.
+func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool {
+ // In the flow context, do nothing.
+ if parser.flow_level > 0 {
+ return true
+ }
+
+ // Loop through the indentation levels in the stack.
+ for parser.indent > column {
+ // Create a token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_BLOCK_END_TOKEN,
+ start_mark: parser.mark,
+ end_mark: parser.mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+
+ // Pop the indentation level.
+ parser.indent = parser.indents[len(parser.indents)-1]
+ parser.indents = parser.indents[:len(parser.indents)-1]
+ }
+ return true
+}
+
+// Initialize the scanner and produce the STREAM-START token.
+func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool {
+
+ // Set the initial indentation.
+ parser.indent = -1
+
+ // Initialize the simple key stack.
+ parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{})
+
+ parser.simple_keys_by_tok = make(map[int]int)
+
+ // A simple key is allowed at the beginning of the stream.
+ parser.simple_key_allowed = true
+
+ // We have started.
+ parser.stream_start_produced = true
+
+ // Create the STREAM-START token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_STREAM_START_TOKEN,
+ start_mark: parser.mark,
+ end_mark: parser.mark,
+ encoding: parser.encoding,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the STREAM-END token and shut down the scanner.
+func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool {
+
+ // Force new line.
+ if parser.mark.column != 0 {
+ parser.mark.column = 0
+ parser.mark.line++
+ }
+
+ // Reset the indentation level.
+ if !yaml_parser_unroll_indent(parser, -1) {
+ return false
+ }
+
+ // Reset simple keys.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ parser.simple_key_allowed = false
+
+ // Create the STREAM-END token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_STREAM_END_TOKEN,
+ start_mark: parser.mark,
+ end_mark: parser.mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token.
+func yaml_parser_fetch_directive(parser *yaml_parser_t) bool {
+ // Reset the indentation level.
+ if !yaml_parser_unroll_indent(parser, -1) {
+ return false
+ }
+
+ // Reset simple keys.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ parser.simple_key_allowed = false
+
+ // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token.
+ token := yaml_token_t{}
+ if !yaml_parser_scan_directive(parser, &token) {
+ return false
+ }
+ // Append the token to the queue.
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the DOCUMENT-START or DOCUMENT-END token.
+func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool {
+ // Reset the indentation level.
+ if !yaml_parser_unroll_indent(parser, -1) {
+ return false
+ }
+
+ // Reset simple keys.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ parser.simple_key_allowed = false
+
+ // Consume the token.
+ start_mark := parser.mark
+
+ skip(parser)
+ skip(parser)
+ skip(parser)
+
+ end_mark := parser.mark
+
+ // Create the DOCUMENT-START or DOCUMENT-END token.
+ token := yaml_token_t{
+ typ: typ,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ // Append the token to the queue.
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token.
+func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool {
+ // The indicators '[' and '{' may start a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // Increase the flow level.
+ if !yaml_parser_increase_flow_level(parser) {
+ return false
+ }
+
+ // A simple key may follow the indicators '[' and '{'.
+ parser.simple_key_allowed = true
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token.
+ token := yaml_token_t{
+ typ: typ,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ // Append the token to the queue.
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token.
+func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool {
+ // Reset any potential simple key on the current flow level.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // Decrease the flow level.
+ if !yaml_parser_decrease_flow_level(parser) {
+ return false
+ }
+
+ // No simple keys after the indicators ']' and '}'.
+ parser.simple_key_allowed = false
+
+ // Consume the token.
+
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token.
+ token := yaml_token_t{
+ typ: typ,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ // Append the token to the queue.
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the FLOW-ENTRY token.
+func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool {
+ // Reset any potential simple keys on the current flow level.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // Simple keys are allowed after ','.
+ parser.simple_key_allowed = true
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the FLOW-ENTRY token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_FLOW_ENTRY_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the BLOCK-ENTRY token.
+func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool {
+ // Check if the scanner is in the block context.
+ if parser.flow_level == 0 {
+ // Check if we are allowed to start a new entry.
+ if !parser.simple_key_allowed {
+ return yaml_parser_set_scanner_error(parser, "", parser.mark,
+ "block sequence entries are not allowed in this context")
+ }
+ // Add the BLOCK-SEQUENCE-START token if needed.
+ if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) {
+ return false
+ }
+ } else {
+ // It is an error for the '-' indicator to occur in the flow context,
+ // but we let the Parser detect and report about it because the Parser
+ // is able to point to the context.
+ }
+
+ // Reset any potential simple keys on the current flow level.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // Simple keys are allowed after '-'.
+ parser.simple_key_allowed = true
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the BLOCK-ENTRY token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_BLOCK_ENTRY_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the KEY token.
+func yaml_parser_fetch_key(parser *yaml_parser_t) bool {
+
+ // In the block context, additional checks are required.
+ if parser.flow_level == 0 {
+ // Check if we are allowed to start a new key (not nessesary simple).
+ if !parser.simple_key_allowed {
+ return yaml_parser_set_scanner_error(parser, "", parser.mark,
+ "mapping keys are not allowed in this context")
+ }
+ // Add the BLOCK-MAPPING-START token if needed.
+ if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) {
+ return false
+ }
+ }
+
+ // Reset any potential simple keys on the current flow level.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // Simple keys are allowed after '?' in the block context.
+ parser.simple_key_allowed = parser.flow_level == 0
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the KEY token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_KEY_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the VALUE token.
+func yaml_parser_fetch_value(parser *yaml_parser_t) bool {
+
+ simple_key := &parser.simple_keys[len(parser.simple_keys)-1]
+
+ // Have we found a simple key?
+ if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok {
+ return false
+
+ } else if valid {
+
+ // Create the KEY token and insert it into the queue.
+ token := yaml_token_t{
+ typ: yaml_KEY_TOKEN,
+ start_mark: simple_key.mark,
+ end_mark: simple_key.mark,
+ }
+ yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token)
+
+ // In the block context, we may need to add the BLOCK-MAPPING-START token.
+ if !yaml_parser_roll_indent(parser, simple_key.mark.column,
+ simple_key.token_number,
+ yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) {
+ return false
+ }
+
+ // Remove the simple key.
+ simple_key.possible = false
+ delete(parser.simple_keys_by_tok, simple_key.token_number)
+
+ // A simple key cannot follow another simple key.
+ parser.simple_key_allowed = false
+
+ } else {
+ // The ':' indicator follows a complex key.
+
+ // In the block context, extra checks are required.
+ if parser.flow_level == 0 {
+
+ // Check if we are allowed to start a complex value.
+ if !parser.simple_key_allowed {
+ return yaml_parser_set_scanner_error(parser, "", parser.mark,
+ "mapping values are not allowed in this context")
+ }
+
+ // Add the BLOCK-MAPPING-START token if needed.
+ if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) {
+ return false
+ }
+ }
+
+ // Simple keys after ':' are allowed in the block context.
+ parser.simple_key_allowed = parser.flow_level == 0
+ }
+
+ // Consume the token.
+ start_mark := parser.mark
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create the VALUE token and append it to the queue.
+ token := yaml_token_t{
+ typ: yaml_VALUE_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the ALIAS or ANCHOR token.
+func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool {
+ // An anchor or an alias could be a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // A simple key cannot follow an anchor or an alias.
+ parser.simple_key_allowed = false
+
+ // Create the ALIAS or ANCHOR token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_anchor(parser, &token, typ) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the TAG token.
+func yaml_parser_fetch_tag(parser *yaml_parser_t) bool {
+ // A tag could be a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // A simple key cannot follow a tag.
+ parser.simple_key_allowed = false
+
+ // Create the TAG token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_tag(parser, &token) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens.
+func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool {
+ // Remove any potential simple keys.
+ if !yaml_parser_remove_simple_key(parser) {
+ return false
+ }
+
+ // A simple key may follow a block scalar.
+ parser.simple_key_allowed = true
+
+ // Create the SCALAR token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_block_scalar(parser, &token, literal) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens.
+func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool {
+ // A plain scalar could be a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // A simple key cannot follow a flow scalar.
+ parser.simple_key_allowed = false
+
+ // Create the SCALAR token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_flow_scalar(parser, &token, single) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Produce the SCALAR(...,plain) token.
+func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool {
+ // A plain scalar could be a simple key.
+ if !yaml_parser_save_simple_key(parser) {
+ return false
+ }
+
+ // A simple key cannot follow a flow scalar.
+ parser.simple_key_allowed = false
+
+ // Create the SCALAR token and append it to the queue.
+ var token yaml_token_t
+ if !yaml_parser_scan_plain_scalar(parser, &token) {
+ return false
+ }
+ yaml_insert_token(parser, -1, &token)
+ return true
+}
+
+// Eat whitespaces and comments until the next token is found.
+func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool {
+
+ // Until the next token is not found.
+ for {
+ // Allow the BOM mark to start a line.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ }
+
+ // Eat whitespaces.
+ // Tabs are allowed:
+ // - in the flow context
+ // - in the block context, but not at the beginning of the line or
+ // after '-', '?', or ':' (complex value).
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Eat a comment until a line break.
+ if parser.buffer[parser.buffer_pos] == '#' {
+ for !is_breakz(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ }
+
+ // If it is a line break, eat it.
+ if is_break(parser.buffer, parser.buffer_pos) {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ skip_line(parser)
+
+ // In the block context, a new line may start a simple key.
+ if parser.flow_level == 0 {
+ parser.simple_key_allowed = true
+ }
+ } else {
+ break // We have found a token.
+ }
+ }
+
+ return true
+}
+
+// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token.
+//
+// Scope:
+// %YAML 1.1 # a comment \n
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+// %TAG !yaml! tag:yaml.org,2002: \n
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool {
+ // Eat '%'.
+ start_mark := parser.mark
+ skip(parser)
+
+ // Scan the directive name.
+ var name []byte
+ if !yaml_parser_scan_directive_name(parser, start_mark, &name) {
+ return false
+ }
+
+ // Is it a YAML directive?
+ if bytes.Equal(name, []byte("YAML")) {
+ // Scan the VERSION directive value.
+ var major, minor int8
+ if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) {
+ return false
+ }
+ end_mark := parser.mark
+
+ // Create a VERSION-DIRECTIVE token.
+ *token = yaml_token_t{
+ typ: yaml_VERSION_DIRECTIVE_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ major: major,
+ minor: minor,
+ }
+
+ // Is it a TAG directive?
+ } else if bytes.Equal(name, []byte("TAG")) {
+ // Scan the TAG directive value.
+ var handle, prefix []byte
+ if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) {
+ return false
+ }
+ end_mark := parser.mark
+
+ // Create a TAG-DIRECTIVE token.
+ *token = yaml_token_t{
+ typ: yaml_TAG_DIRECTIVE_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: handle,
+ prefix: prefix,
+ }
+
+ // Unknown directive.
+ } else {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "found unknown directive name")
+ return false
+ }
+
+ // Eat the rest of the line including any comments.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ if parser.buffer[parser.buffer_pos] == '#' {
+ for !is_breakz(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ }
+
+ // Check if we are at the end of the line.
+ if !is_breakz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "did not find expected comment or line break")
+ return false
+ }
+
+ // Eat a line break.
+ if is_break(parser.buffer, parser.buffer_pos) {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ skip_line(parser)
+ }
+
+ return true
+}
+
+// Scan the directive name.
+//
+// Scope:
+// %YAML 1.1 # a comment \n
+// ^^^^
+// %TAG !yaml! tag:yaml.org,2002: \n
+// ^^^
+//
+func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool {
+ // Consume the directive name.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ var s []byte
+ for is_alpha(parser.buffer, parser.buffer_pos) {
+ s = read(parser, s)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Check if the name is empty.
+ if len(s) == 0 {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "could not find expected directive name")
+ return false
+ }
+
+ // Check for an blank character after the name.
+ if !is_blankz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a directive",
+ start_mark, "found unexpected non-alphabetical character")
+ return false
+ }
+ *name = s
+ return true
+}
+
+// Scan the value of VERSION-DIRECTIVE.
+//
+// Scope:
+// %YAML 1.1 # a comment \n
+// ^^^^^^
+func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool {
+ // Eat whitespaces.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Consume the major version number.
+ if !yaml_parser_scan_version_directive_number(parser, start_mark, major) {
+ return false
+ }
+
+ // Eat '.'.
+ if parser.buffer[parser.buffer_pos] != '.' {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "did not find expected digit or '.' character")
+ }
+
+ skip(parser)
+
+ // Consume the minor version number.
+ if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) {
+ return false
+ }
+ return true
+}
+
+const max_number_length = 2
+
+// Scan the version number of VERSION-DIRECTIVE.
+//
+// Scope:
+// %YAML 1.1 # a comment \n
+// ^
+// %YAML 1.1 # a comment \n
+// ^
+func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool {
+
+ // Repeat while the next character is digit.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ var value, length int8
+ for is_digit(parser.buffer, parser.buffer_pos) {
+ // Check if the number is too long.
+ length++
+ if length > max_number_length {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "found extremely long version number")
+ }
+ value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos))
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Check if the number was present.
+ if length == 0 {
+ return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive",
+ start_mark, "did not find expected version number")
+ }
+ *number = value
+ return true
+}
+
+// Scan the value of a TAG-DIRECTIVE token.
+//
+// Scope:
+// %TAG !yaml! tag:yaml.org,2002: \n
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool {
+ var handle_value, prefix_value []byte
+
+ // Eat whitespaces.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Scan a handle.
+ if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) {
+ return false
+ }
+
+ // Expect a whitespace.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if !is_blank(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive",
+ start_mark, "did not find expected whitespace")
+ return false
+ }
+
+ // Eat whitespaces.
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Scan a prefix.
+ if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) {
+ return false
+ }
+
+ // Expect a whitespace or line break.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if !is_blankz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive",
+ start_mark, "did not find expected whitespace or line break")
+ return false
+ }
+
+ *handle = handle_value
+ *prefix = prefix_value
+ return true
+}
+
+func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool {
+ var s []byte
+
+ // Eat the indicator character.
+ start_mark := parser.mark
+ skip(parser)
+
+ // Consume the value.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for is_alpha(parser.buffer, parser.buffer_pos) {
+ s = read(parser, s)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ end_mark := parser.mark
+
+ /*
+ * Check if length of the anchor is greater than 0 and it is followed by
+ * a whitespace character or one of the indicators:
+ *
+ * '?', ':', ',', ']', '}', '%', '@', '`'.
+ */
+
+ if len(s) == 0 ||
+ !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' ||
+ parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' ||
+ parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' ||
+ parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' ||
+ parser.buffer[parser.buffer_pos] == '`') {
+ context := "while scanning an alias"
+ if typ == yaml_ANCHOR_TOKEN {
+ context = "while scanning an anchor"
+ }
+ yaml_parser_set_scanner_error(parser, context, start_mark,
+ "did not find expected alphabetic or numeric character")
+ return false
+ }
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: typ,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: s,
+ }
+
+ return true
+}
+
+/*
+ * Scan a TAG token.
+ */
+
+func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool {
+ var handle, suffix []byte
+
+ start_mark := parser.mark
+
+ // Check if the tag is in the canonical form.
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+
+ if parser.buffer[parser.buffer_pos+1] == '<' {
+ // Keep the handle as ''
+
+ // Eat '!<'
+ skip(parser)
+ skip(parser)
+
+ // Consume the tag value.
+ if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) {
+ return false
+ }
+
+ // Check for '>' and eat it.
+ if parser.buffer[parser.buffer_pos] != '>' {
+ yaml_parser_set_scanner_error(parser, "while scanning a tag",
+ start_mark, "did not find the expected '>'")
+ return false
+ }
+
+ skip(parser)
+ } else {
+ // The tag has either the '!suffix' or the '!handle!suffix' form.
+
+ // First, try to scan a handle.
+ if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) {
+ return false
+ }
+
+ // Check if it is, indeed, handle.
+ if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' {
+ // Scan the suffix now.
+ if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) {
+ return false
+ }
+ } else {
+ // It wasn't a handle after all. Scan the rest of the tag.
+ if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) {
+ return false
+ }
+
+ // Set the handle to '!'.
+ handle = []byte{'!'}
+
+ // A special case: the '!' tag. Set the handle to '' and the
+ // suffix to '!'.
+ if len(suffix) == 0 {
+ handle, suffix = suffix, handle
+ }
+ }
+ }
+
+ // Check the character which ends the tag.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if !is_blankz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a tag",
+ start_mark, "did not find expected whitespace or line break")
+ return false
+ }
+
+ end_mark := parser.mark
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: yaml_TAG_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: handle,
+ suffix: suffix,
+ }
+ return true
+}
+
+// Scan a tag handle.
+func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool {
+ // Check the initial '!' character.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if parser.buffer[parser.buffer_pos] != '!' {
+ yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "did not find expected '!'")
+ return false
+ }
+
+ var s []byte
+
+ // Copy the '!' character.
+ s = read(parser, s)
+
+ // Copy all subsequent alphabetical and numerical characters.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ for is_alpha(parser.buffer, parser.buffer_pos) {
+ s = read(parser, s)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Check if the trailing character is '!' and copy it.
+ if parser.buffer[parser.buffer_pos] == '!' {
+ s = read(parser, s)
+ } else {
+ // It's either the '!' tag or not really a tag handle. If it's a %TAG
+ // directive, it's an error. If it's a tag token, it must be a part of URI.
+ if directive && string(s) != "!" {
+ yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "did not find expected '!'")
+ return false
+ }
+ }
+
+ *handle = s
+ return true
+}
+
+// Scan a tag.
+func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool {
+ //size_t length = head ? strlen((char *)head) : 0
+ var s []byte
+ hasTag := len(head) > 0
+
+ // Copy the head if needed.
+ //
+ // Note that we don't copy the leading '!' character.
+ if len(head) > 1 {
+ s = append(s, head[1:]...)
+ }
+
+ // Scan the tag.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ // The set of characters that may appear in URI is as follows:
+ //
+ // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&',
+ // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']',
+ // '%'.
+ // [Go] Convert this into more reasonable logic.
+ for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' ||
+ parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' ||
+ parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' ||
+ parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' ||
+ parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' ||
+ parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' ||
+ parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' ||
+ parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' ||
+ parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' ||
+ parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' ||
+ parser.buffer[parser.buffer_pos] == '%' {
+ // Check if it is a URI-escape sequence.
+ if parser.buffer[parser.buffer_pos] == '%' {
+ if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) {
+ return false
+ }
+ } else {
+ s = read(parser, s)
+ }
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ hasTag = true
+ }
+
+ if !hasTag {
+ yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "did not find expected tag URI")
+ return false
+ }
+ *uri = s
+ return true
+}
+
+// Decode an URI-escape sequence corresponding to a single UTF-8 character.
+func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool {
+
+ // Decode the required number of characters.
+ w := 1024
+ for w > 0 {
+ // Check for a URI-escaped octet.
+ if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) {
+ return false
+ }
+
+ if !(parser.buffer[parser.buffer_pos] == '%' &&
+ is_hex(parser.buffer, parser.buffer_pos+1) &&
+ is_hex(parser.buffer, parser.buffer_pos+2)) {
+ return yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "did not find URI escaped octet")
+ }
+
+ // Get the octet.
+ octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2))
+
+ // If it is the leading octet, determine the length of the UTF-8 sequence.
+ if w == 1024 {
+ w = width(octet)
+ if w == 0 {
+ return yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "found an incorrect leading UTF-8 octet")
+ }
+ } else {
+ // Check if the trailing octet is correct.
+ if octet&0xC0 != 0x80 {
+ return yaml_parser_set_scanner_tag_error(parser, directive,
+ start_mark, "found an incorrect trailing UTF-8 octet")
+ }
+ }
+
+ // Copy the octet and move the pointers.
+ *s = append(*s, octet)
+ skip(parser)
+ skip(parser)
+ skip(parser)
+ w--
+ }
+ return true
+}
+
+// Scan a block scalar.
+func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool {
+ // Eat the indicator '|' or '>'.
+ start_mark := parser.mark
+ skip(parser)
+
+ // Scan the additional block scalar indicators.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ // Check for a chomping indicator.
+ var chomping, increment int
+ if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' {
+ // Set the chomping method and eat the indicator.
+ if parser.buffer[parser.buffer_pos] == '+' {
+ chomping = +1
+ } else {
+ chomping = -1
+ }
+ skip(parser)
+
+ // Check for an indentation indicator.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if is_digit(parser.buffer, parser.buffer_pos) {
+ // Check that the indentation is greater than 0.
+ if parser.buffer[parser.buffer_pos] == '0' {
+ yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "found an indentation indicator equal to 0")
+ return false
+ }
+
+ // Get the indentation level and eat the indicator.
+ increment = as_digit(parser.buffer, parser.buffer_pos)
+ skip(parser)
+ }
+
+ } else if is_digit(parser.buffer, parser.buffer_pos) {
+ // Do the same as above, but in the opposite order.
+
+ if parser.buffer[parser.buffer_pos] == '0' {
+ yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "found an indentation indicator equal to 0")
+ return false
+ }
+ increment = as_digit(parser.buffer, parser.buffer_pos)
+ skip(parser)
+
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' {
+ if parser.buffer[parser.buffer_pos] == '+' {
+ chomping = +1
+ } else {
+ chomping = -1
+ }
+ skip(parser)
+ }
+ }
+
+ // Eat whitespaces and comments to the end of the line.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ for is_blank(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ if parser.buffer[parser.buffer_pos] == '#' {
+ for !is_breakz(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ }
+
+ // Check if we are at the end of the line.
+ if !is_breakz(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "did not find expected comment or line break")
+ return false
+ }
+
+ // Eat a line break.
+ if is_break(parser.buffer, parser.buffer_pos) {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ skip_line(parser)
+ }
+
+ end_mark := parser.mark
+
+ // Set the indentation level if it was specified.
+ var indent int
+ if increment > 0 {
+ if parser.indent >= 0 {
+ indent = parser.indent + increment
+ } else {
+ indent = increment
+ }
+ }
+
+ // Scan the leading line breaks and determine the indentation level if needed.
+ var s, leading_break, trailing_breaks []byte
+ if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) {
+ return false
+ }
+
+ // Scan the block scalar content.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ var leading_blank, trailing_blank bool
+ for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) {
+ // We are at the beginning of a non-empty line.
+
+ // Is it a trailing whitespace?
+ trailing_blank = is_blank(parser.buffer, parser.buffer_pos)
+
+ // Check if we need to fold the leading line break.
+ if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' {
+ // Do we need to join the lines by space?
+ if len(trailing_breaks) == 0 {
+ s = append(s, ' ')
+ }
+ } else {
+ s = append(s, leading_break...)
+ }
+ leading_break = leading_break[:0]
+
+ // Append the remaining line breaks.
+ s = append(s, trailing_breaks...)
+ trailing_breaks = trailing_breaks[:0]
+
+ // Is it a leading whitespace?
+ leading_blank = is_blank(parser.buffer, parser.buffer_pos)
+
+ // Consume the current line.
+ for !is_breakz(parser.buffer, parser.buffer_pos) {
+ s = read(parser, s)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Consume the line break.
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+
+ leading_break = read_line(parser, leading_break)
+
+ // Eat the following indentation spaces and line breaks.
+ if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) {
+ return false
+ }
+ }
+
+ // Chomp the tail.
+ if chomping != -1 {
+ s = append(s, leading_break...)
+ }
+ if chomping == 1 {
+ s = append(s, trailing_breaks...)
+ }
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: yaml_SCALAR_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: s,
+ style: yaml_LITERAL_SCALAR_STYLE,
+ }
+ if !literal {
+ token.style = yaml_FOLDED_SCALAR_STYLE
+ }
+ return true
+}
+
+// Scan indentation spaces and line breaks for a block scalar. Determine the
+// indentation level if needed.
+func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool {
+ *end_mark = parser.mark
+
+ // Eat the indentation spaces and line breaks.
+ max_indent := 0
+ for {
+ // Eat the indentation spaces.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) {
+ skip(parser)
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+ if parser.mark.column > max_indent {
+ max_indent = parser.mark.column
+ }
+
+ // Check for a tab character messing the indentation.
+ if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) {
+ return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
+ start_mark, "found a tab character where an indentation space is expected")
+ }
+
+ // Have we found a non-empty line?
+ if !is_break(parser.buffer, parser.buffer_pos) {
+ break
+ }
+
+ // Consume the line break.
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ // [Go] Should really be returning breaks instead.
+ *breaks = read_line(parser, *breaks)
+ *end_mark = parser.mark
+ }
+
+ // Determine the indentation level if needed.
+ if *indent == 0 {
+ *indent = max_indent
+ if *indent < parser.indent+1 {
+ *indent = parser.indent + 1
+ }
+ if *indent < 1 {
+ *indent = 1
+ }
+ }
+ return true
+}
+
+// Scan a quoted scalar.
+func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool {
+ // Eat the left quote.
+ start_mark := parser.mark
+ skip(parser)
+
+ // Consume the content of the quoted scalar.
+ var s, leading_break, trailing_breaks, whitespaces []byte
+ for {
+ // Check that there are no document indicators at the beginning of the line.
+ if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) {
+ return false
+ }
+
+ if parser.mark.column == 0 &&
+ ((parser.buffer[parser.buffer_pos+0] == '-' &&
+ parser.buffer[parser.buffer_pos+1] == '-' &&
+ parser.buffer[parser.buffer_pos+2] == '-') ||
+ (parser.buffer[parser.buffer_pos+0] == '.' &&
+ parser.buffer[parser.buffer_pos+1] == '.' &&
+ parser.buffer[parser.buffer_pos+2] == '.')) &&
+ is_blankz(parser.buffer, parser.buffer_pos+3) {
+ yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar",
+ start_mark, "found unexpected document indicator")
+ return false
+ }
+
+ // Check for EOF.
+ if is_z(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar",
+ start_mark, "found unexpected end of stream")
+ return false
+ }
+
+ // Consume non-blank characters.
+ leading_blanks := false
+ for !is_blankz(parser.buffer, parser.buffer_pos) {
+ if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' {
+ // Is is an escaped single quote.
+ s = append(s, '\'')
+ skip(parser)
+ skip(parser)
+
+ } else if single && parser.buffer[parser.buffer_pos] == '\'' {
+ // It is a right single quote.
+ break
+ } else if !single && parser.buffer[parser.buffer_pos] == '"' {
+ // It is a right double quote.
+ break
+
+ } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) {
+ // It is an escaped line break.
+ if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) {
+ return false
+ }
+ skip(parser)
+ skip_line(parser)
+ leading_blanks = true
+ break
+
+ } else if !single && parser.buffer[parser.buffer_pos] == '\\' {
+ // It is an escape sequence.
+ code_length := 0
+
+ // Check the escape character.
+ switch parser.buffer[parser.buffer_pos+1] {
+ case '0':
+ s = append(s, 0)
+ case 'a':
+ s = append(s, '\x07')
+ case 'b':
+ s = append(s, '\x08')
+ case 't', '\t':
+ s = append(s, '\x09')
+ case 'n':
+ s = append(s, '\x0A')
+ case 'v':
+ s = append(s, '\x0B')
+ case 'f':
+ s = append(s, '\x0C')
+ case 'r':
+ s = append(s, '\x0D')
+ case 'e':
+ s = append(s, '\x1B')
+ case ' ':
+ s = append(s, '\x20')
+ case '"':
+ s = append(s, '"')
+ case '\'':
+ s = append(s, '\'')
+ case '\\':
+ s = append(s, '\\')
+ case 'N': // NEL (#x85)
+ s = append(s, '\xC2')
+ s = append(s, '\x85')
+ case '_': // #xA0
+ s = append(s, '\xC2')
+ s = append(s, '\xA0')
+ case 'L': // LS (#x2028)
+ s = append(s, '\xE2')
+ s = append(s, '\x80')
+ s = append(s, '\xA8')
+ case 'P': // PS (#x2029)
+ s = append(s, '\xE2')
+ s = append(s, '\x80')
+ s = append(s, '\xA9')
+ case 'x':
+ code_length = 2
+ case 'u':
+ code_length = 4
+ case 'U':
+ code_length = 8
+ default:
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "found unknown escape character")
+ return false
+ }
+
+ skip(parser)
+ skip(parser)
+
+ // Consume an arbitrary escape code.
+ if code_length > 0 {
+ var value int
+
+ // Scan the character value.
+ if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) {
+ return false
+ }
+ for k := 0; k < code_length; k++ {
+ if !is_hex(parser.buffer, parser.buffer_pos+k) {
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "did not find expected hexdecimal number")
+ return false
+ }
+ value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k)
+ }
+
+ // Check the value and write the character.
+ if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF {
+ yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar",
+ start_mark, "found invalid Unicode character escape code")
+ return false
+ }
+ if value <= 0x7F {
+ s = append(s, byte(value))
+ } else if value <= 0x7FF {
+ s = append(s, byte(0xC0+(value>>6)))
+ s = append(s, byte(0x80+(value&0x3F)))
+ } else if value <= 0xFFFF {
+ s = append(s, byte(0xE0+(value>>12)))
+ s = append(s, byte(0x80+((value>>6)&0x3F)))
+ s = append(s, byte(0x80+(value&0x3F)))
+ } else {
+ s = append(s, byte(0xF0+(value>>18)))
+ s = append(s, byte(0x80+((value>>12)&0x3F)))
+ s = append(s, byte(0x80+((value>>6)&0x3F)))
+ s = append(s, byte(0x80+(value&0x3F)))
+ }
+
+ // Advance the pointer.
+ for k := 0; k < code_length; k++ {
+ skip(parser)
+ }
+ }
+ } else {
+ // It is a non-escaped non-blank character.
+ s = read(parser, s)
+ }
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ }
+
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ // Check if we are at the end of the scalar.
+ if single {
+ if parser.buffer[parser.buffer_pos] == '\'' {
+ break
+ }
+ } else {
+ if parser.buffer[parser.buffer_pos] == '"' {
+ break
+ }
+ }
+
+ // Consume blank characters.
+ for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) {
+ if is_blank(parser.buffer, parser.buffer_pos) {
+ // Consume a space or a tab character.
+ if !leading_blanks {
+ whitespaces = read(parser, whitespaces)
+ } else {
+ skip(parser)
+ }
+ } else {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+
+ // Check if it is a first line break.
+ if !leading_blanks {
+ whitespaces = whitespaces[:0]
+ leading_break = read_line(parser, leading_break)
+ leading_blanks = true
+ } else {
+ trailing_breaks = read_line(parser, trailing_breaks)
+ }
+ }
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Join the whitespaces or fold line breaks.
+ if leading_blanks {
+ // Do we need to fold line breaks?
+ if len(leading_break) > 0 && leading_break[0] == '\n' {
+ if len(trailing_breaks) == 0 {
+ s = append(s, ' ')
+ } else {
+ s = append(s, trailing_breaks...)
+ }
+ } else {
+ s = append(s, leading_break...)
+ s = append(s, trailing_breaks...)
+ }
+ trailing_breaks = trailing_breaks[:0]
+ leading_break = leading_break[:0]
+ } else {
+ s = append(s, whitespaces...)
+ whitespaces = whitespaces[:0]
+ }
+ }
+
+ // Eat the right quote.
+ skip(parser)
+ end_mark := parser.mark
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: yaml_SCALAR_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: s,
+ style: yaml_SINGLE_QUOTED_SCALAR_STYLE,
+ }
+ if !single {
+ token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
+ }
+ return true
+}
+
+// Scan a plain scalar.
+func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool {
+
+ var s, leading_break, trailing_breaks, whitespaces []byte
+ var leading_blanks bool
+ var indent = parser.indent + 1
+
+ start_mark := parser.mark
+ end_mark := parser.mark
+
+ // Consume the content of the plain scalar.
+ for {
+ // Check for a document indicator.
+ if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) {
+ return false
+ }
+ if parser.mark.column == 0 &&
+ ((parser.buffer[parser.buffer_pos+0] == '-' &&
+ parser.buffer[parser.buffer_pos+1] == '-' &&
+ parser.buffer[parser.buffer_pos+2] == '-') ||
+ (parser.buffer[parser.buffer_pos+0] == '.' &&
+ parser.buffer[parser.buffer_pos+1] == '.' &&
+ parser.buffer[parser.buffer_pos+2] == '.')) &&
+ is_blankz(parser.buffer, parser.buffer_pos+3) {
+ break
+ }
+
+ // Check for a comment.
+ if parser.buffer[parser.buffer_pos] == '#' {
+ break
+ }
+
+ // Consume non-blank characters.
+ for !is_blankz(parser.buffer, parser.buffer_pos) {
+
+ // Check for indicators that may end a plain scalar.
+ if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) ||
+ (parser.flow_level > 0 &&
+ (parser.buffer[parser.buffer_pos] == ',' ||
+ parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' ||
+ parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' ||
+ parser.buffer[parser.buffer_pos] == '}')) {
+ break
+ }
+
+ // Check if we need to join whitespaces and breaks.
+ if leading_blanks || len(whitespaces) > 0 {
+ if leading_blanks {
+ // Do we need to fold line breaks?
+ if leading_break[0] == '\n' {
+ if len(trailing_breaks) == 0 {
+ s = append(s, ' ')
+ } else {
+ s = append(s, trailing_breaks...)
+ }
+ } else {
+ s = append(s, leading_break...)
+ s = append(s, trailing_breaks...)
+ }
+ trailing_breaks = trailing_breaks[:0]
+ leading_break = leading_break[:0]
+ leading_blanks = false
+ } else {
+ s = append(s, whitespaces...)
+ whitespaces = whitespaces[:0]
+ }
+ }
+
+ // Copy the character.
+ s = read(parser, s)
+
+ end_mark = parser.mark
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+ }
+
+ // Is it the end?
+ if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) {
+ break
+ }
+
+ // Consume blank characters.
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+
+ for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) {
+ if is_blank(parser.buffer, parser.buffer_pos) {
+
+ // Check for tab characters that abuse indentation.
+ if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) {
+ yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
+ start_mark, "found a tab character that violates indentation")
+ return false
+ }
+
+ // Consume a space or a tab character.
+ if !leading_blanks {
+ whitespaces = read(parser, whitespaces)
+ } else {
+ skip(parser)
+ }
+ } else {
+ if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
+ return false
+ }
+
+ // Check if it is a first line break.
+ if !leading_blanks {
+ whitespaces = whitespaces[:0]
+ leading_break = read_line(parser, leading_break)
+ leading_blanks = true
+ } else {
+ trailing_breaks = read_line(parser, trailing_breaks)
+ }
+ }
+ if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
+ return false
+ }
+ }
+
+ // Check indentation level.
+ if parser.flow_level == 0 && parser.mark.column < indent {
+ break
+ }
+ }
+
+ // Create a token.
+ *token = yaml_token_t{
+ typ: yaml_SCALAR_TOKEN,
+ start_mark: start_mark,
+ end_mark: end_mark,
+ value: s,
+ style: yaml_PLAIN_SCALAR_STYLE,
+ }
+
+ // Note that we change the 'simple_key_allowed' flag.
+ if leading_blanks {
+ parser.simple_key_allowed = true
+ }
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go
new file mode 100644
index 000000000..4c45e660a
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/sorter.go
@@ -0,0 +1,113 @@
+package yaml
+
+import (
+ "reflect"
+ "unicode"
+)
+
+type keyList []reflect.Value
+
+func (l keyList) Len() int { return len(l) }
+func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
+func (l keyList) Less(i, j int) bool {
+ a := l[i]
+ b := l[j]
+ ak := a.Kind()
+ bk := b.Kind()
+ for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() {
+ a = a.Elem()
+ ak = a.Kind()
+ }
+ for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() {
+ b = b.Elem()
+ bk = b.Kind()
+ }
+ af, aok := keyFloat(a)
+ bf, bok := keyFloat(b)
+ if aok && bok {
+ if af != bf {
+ return af < bf
+ }
+ if ak != bk {
+ return ak < bk
+ }
+ return numLess(a, b)
+ }
+ if ak != reflect.String || bk != reflect.String {
+ return ak < bk
+ }
+ ar, br := []rune(a.String()), []rune(b.String())
+ for i := 0; i < len(ar) && i < len(br); i++ {
+ if ar[i] == br[i] {
+ continue
+ }
+ al := unicode.IsLetter(ar[i])
+ bl := unicode.IsLetter(br[i])
+ if al && bl {
+ return ar[i] < br[i]
+ }
+ if al || bl {
+ return bl
+ }
+ var ai, bi int
+ var an, bn int64
+ if ar[i] == '0' || br[i] == '0' {
+ for j := i-1; j >= 0 && unicode.IsDigit(ar[j]); j-- {
+ if ar[j] != '0' {
+ an = 1
+ bn = 1
+ break
+ }
+ }
+ }
+ for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ {
+ an = an*10 + int64(ar[ai]-'0')
+ }
+ for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ {
+ bn = bn*10 + int64(br[bi]-'0')
+ }
+ if an != bn {
+ return an < bn
+ }
+ if ai != bi {
+ return ai < bi
+ }
+ return ar[i] < br[i]
+ }
+ return len(ar) < len(br)
+}
+
+// keyFloat returns a float value for v if it is a number/bool
+// and whether it is a number/bool or not.
+func keyFloat(v reflect.Value) (f float64, ok bool) {
+ switch v.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return float64(v.Int()), true
+ case reflect.Float32, reflect.Float64:
+ return v.Float(), true
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return float64(v.Uint()), true
+ case reflect.Bool:
+ if v.Bool() {
+ return 1, true
+ }
+ return 0, true
+ }
+ return 0, false
+}
+
+// numLess returns whether a < b.
+// a and b must necessarily have the same kind.
+func numLess(a, b reflect.Value) bool {
+ switch a.Kind() {
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return a.Int() < b.Int()
+ case reflect.Float32, reflect.Float64:
+ return a.Float() < b.Float()
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return a.Uint() < b.Uint()
+ case reflect.Bool:
+ return !a.Bool() && b.Bool()
+ }
+ panic("not a number")
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go
new file mode 100644
index 000000000..a2dde608c
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/writerc.go
@@ -0,0 +1,26 @@
+package yaml
+
+// Set the writer error and return false.
+func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool {
+ emitter.error = yaml_WRITER_ERROR
+ emitter.problem = problem
+ return false
+}
+
+// Flush the output buffer.
+func yaml_emitter_flush(emitter *yaml_emitter_t) bool {
+ if emitter.write_handler == nil {
+ panic("write handler not set")
+ }
+
+ // Check if the buffer is empty.
+ if emitter.buffer_pos == 0 {
+ return true
+ }
+
+ if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil {
+ return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error())
+ }
+ emitter.buffer_pos = 0
+ return true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go
new file mode 100644
index 000000000..30813884c
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yaml.go
@@ -0,0 +1,478 @@
+// Package yaml implements YAML support for the Go language.
+//
+// Source code and other details for the project are available at GitHub:
+//
+// https://github.com/go-yaml/yaml
+//
+package yaml
+
+import (
+ "errors"
+ "fmt"
+ "io"
+ "reflect"
+ "strings"
+ "sync"
+)
+
+// MapSlice encodes and decodes as a YAML map.
+// The order of keys is preserved when encoding and decoding.
+type MapSlice []MapItem
+
+// MapItem is an item in a MapSlice.
+type MapItem struct {
+ Key, Value interface{}
+}
+
+// The Unmarshaler interface may be implemented by types to customize their
+// behavior when being unmarshaled from a YAML document. The UnmarshalYAML
+// method receives a function that may be called to unmarshal the original
+// YAML value into a field or variable. It is safe to call the unmarshal
+// function parameter more than once if necessary.
+type Unmarshaler interface {
+ UnmarshalYAML(unmarshal func(interface{}) error) error
+}
+
+// The Marshaler interface may be implemented by types to customize their
+// behavior when being marshaled into a YAML document. The returned value
+// is marshaled in place of the original value implementing Marshaler.
+//
+// If an error is returned by MarshalYAML, the marshaling procedure stops
+// and returns with the provided error.
+type Marshaler interface {
+ MarshalYAML() (interface{}, error)
+}
+
+// Unmarshal decodes the first document found within the in byte slice
+// and assigns decoded values into the out value.
+//
+// Maps and pointers (to a struct, string, int, etc) are accepted as out
+// values. If an internal pointer within a struct is not initialized,
+// the yaml package will initialize it if necessary for unmarshalling
+// the provided data. The out parameter must not be nil.
+//
+// The type of the decoded values should be compatible with the respective
+// values in out. If one or more values cannot be decoded due to a type
+// mismatches, decoding continues partially until the end of the YAML
+// content, and a *yaml.TypeError is returned with details for all
+// missed values.
+//
+// Struct fields are only unmarshalled if they are exported (have an
+// upper case first letter), and are unmarshalled using the field name
+// lowercased as the default key. Custom keys may be defined via the
+// "yaml" name in the field tag: the content preceding the first comma
+// is used as the key, and the following comma-separated options are
+// used to tweak the marshalling process (see Marshal).
+// Conflicting names result in a runtime error.
+//
+// For example:
+//
+// type T struct {
+// F int `yaml:"a,omitempty"`
+// B int
+// }
+// var t T
+// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t)
+//
+// See the documentation of Marshal for the format of tags and a list of
+// supported tag options.
+//
+func Unmarshal(in []byte, out interface{}) (err error) {
+ return unmarshal(in, out, false)
+}
+
+// UnmarshalStrict is like Unmarshal except that any fields that are found
+// in the data that do not have corresponding struct members, or mapping
+// keys that are duplicates, will result in
+// an error.
+func UnmarshalStrict(in []byte, out interface{}) (err error) {
+ return unmarshal(in, out, true)
+}
+
+// A Decoder reads and decodes YAML values from an input stream.
+type Decoder struct {
+ strict bool
+ parser *parser
+}
+
+// NewDecoder returns a new decoder that reads from r.
+//
+// The decoder introduces its own buffering and may read
+// data from r beyond the YAML values requested.
+func NewDecoder(r io.Reader) *Decoder {
+ return &Decoder{
+ parser: newParserFromReader(r),
+ }
+}
+
+// SetStrict sets whether strict decoding behaviour is enabled when
+// decoding items in the data (see UnmarshalStrict). By default, decoding is not strict.
+func (dec *Decoder) SetStrict(strict bool) {
+ dec.strict = strict
+}
+
+// Decode reads the next YAML-encoded value from its input
+// and stores it in the value pointed to by v.
+//
+// See the documentation for Unmarshal for details about the
+// conversion of YAML into a Go value.
+func (dec *Decoder) Decode(v interface{}) (err error) {
+ d := newDecoder(dec.strict)
+ defer handleErr(&err)
+ node := dec.parser.parse()
+ if node == nil {
+ return io.EOF
+ }
+ out := reflect.ValueOf(v)
+ if out.Kind() == reflect.Ptr && !out.IsNil() {
+ out = out.Elem()
+ }
+ d.unmarshal(node, out)
+ if len(d.terrors) > 0 {
+ return &TypeError{d.terrors}
+ }
+ return nil
+}
+
+func unmarshal(in []byte, out interface{}, strict bool) (err error) {
+ defer handleErr(&err)
+ d := newDecoder(strict)
+ p := newParser(in)
+ defer p.destroy()
+ node := p.parse()
+ if node != nil {
+ v := reflect.ValueOf(out)
+ if v.Kind() == reflect.Ptr && !v.IsNil() {
+ v = v.Elem()
+ }
+ d.unmarshal(node, v)
+ }
+ if len(d.terrors) > 0 {
+ return &TypeError{d.terrors}
+ }
+ return nil
+}
+
+// Marshal serializes the value provided into a YAML document. The structure
+// of the generated document will reflect the structure of the value itself.
+// Maps and pointers (to struct, string, int, etc) are accepted as the in value.
+//
+// Struct fields are only marshalled if they are exported (have an upper case
+// first letter), and are marshalled using the field name lowercased as the
+// default key. Custom keys may be defined via the "yaml" name in the field
+// tag: the content preceding the first comma is used as the key, and the
+// following comma-separated options are used to tweak the marshalling process.
+// Conflicting names result in a runtime error.
+//
+// The field tag format accepted is:
+//
+// `(...) yaml:"[][,[,]]" (...)`
+//
+// The following flags are currently supported:
+//
+// omitempty Only include the field if it's not set to the zero
+// value for the type or to empty slices or maps.
+// Zero valued structs will be omitted if all their public
+// fields are zero, unless they implement an IsZero
+// method (see the IsZeroer interface type), in which
+// case the field will be excluded if IsZero returns true.
+//
+// flow Marshal using a flow style (useful for structs,
+// sequences and maps).
+//
+// inline Inline the field, which must be a struct or a map,
+// causing all of its fields or keys to be processed as if
+// they were part of the outer struct. For maps, keys must
+// not conflict with the yaml keys of other struct fields.
+//
+// In addition, if the key is "-", the field is ignored.
+//
+// For example:
+//
+// type T struct {
+// F int `yaml:"a,omitempty"`
+// B int
+// }
+// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n"
+// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n"
+//
+func Marshal(in interface{}) (out []byte, err error) {
+ defer handleErr(&err)
+ e := newEncoder()
+ defer e.destroy()
+ e.marshalDoc("", reflect.ValueOf(in))
+ e.finish()
+ out = e.out
+ return
+}
+
+// An Encoder writes YAML values to an output stream.
+type Encoder struct {
+ encoder *encoder
+}
+
+// NewEncoder returns a new encoder that writes to w.
+// The Encoder should be closed after use to flush all data
+// to w.
+func NewEncoder(w io.Writer) *Encoder {
+ return &Encoder{
+ encoder: newEncoderWithWriter(w),
+ }
+}
+
+// Encode writes the YAML encoding of v to the stream.
+// If multiple items are encoded to the stream, the
+// second and subsequent document will be preceded
+// with a "---" document separator, but the first will not.
+//
+// See the documentation for Marshal for details about the conversion of Go
+// values to YAML.
+func (e *Encoder) Encode(v interface{}) (err error) {
+ defer handleErr(&err)
+ e.encoder.marshalDoc("", reflect.ValueOf(v))
+ return nil
+}
+
+// Close closes the encoder by writing any remaining data.
+// It does not write a stream terminating string "...".
+func (e *Encoder) Close() (err error) {
+ defer handleErr(&err)
+ e.encoder.finish()
+ return nil
+}
+
+func handleErr(err *error) {
+ if v := recover(); v != nil {
+ if e, ok := v.(yamlError); ok {
+ *err = e.err
+ } else {
+ panic(v)
+ }
+ }
+}
+
+type yamlError struct {
+ err error
+}
+
+func fail(err error) {
+ panic(yamlError{err})
+}
+
+func failf(format string, args ...interface{}) {
+ panic(yamlError{fmt.Errorf("yaml: "+format, args...)})
+}
+
+// A TypeError is returned by Unmarshal when one or more fields in
+// the YAML document cannot be properly decoded into the requested
+// types. When this error is returned, the value is still
+// unmarshaled partially.
+type TypeError struct {
+ Errors []string
+}
+
+func (e *TypeError) Error() string {
+ return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n "))
+}
+
+// --------------------------------------------------------------------------
+// Maintain a mapping of keys to structure field indexes
+
+// The code in this section was copied from mgo/bson.
+
+// structInfo holds details for the serialization of fields of
+// a given struct.
+type structInfo struct {
+ FieldsMap map[string]fieldInfo
+ FieldsList []fieldInfo
+
+ // InlineMap is the number of the field in the struct that
+ // contains an ,inline map, or -1 if there's none.
+ InlineMap int
+}
+
+type fieldInfo struct {
+ Key string
+ Num int
+ OmitEmpty bool
+ Flow bool
+ // Id holds the unique field identifier, so we can cheaply
+ // check for field duplicates without maintaining an extra map.
+ Id int
+
+ // Inline holds the field index if the field is part of an inlined struct.
+ Inline []int
+}
+
+var structMap = make(map[reflect.Type]*structInfo)
+var fieldMapMutex sync.RWMutex
+
+func getStructInfo(st reflect.Type) (*structInfo, error) {
+ fieldMapMutex.RLock()
+ sinfo, found := structMap[st]
+ fieldMapMutex.RUnlock()
+ if found {
+ return sinfo, nil
+ }
+
+ n := st.NumField()
+ fieldsMap := make(map[string]fieldInfo)
+ fieldsList := make([]fieldInfo, 0, n)
+ inlineMap := -1
+ for i := 0; i != n; i++ {
+ field := st.Field(i)
+ if field.PkgPath != "" && !field.Anonymous {
+ continue // Private field
+ }
+
+ info := fieldInfo{Num: i}
+
+ tag := field.Tag.Get("yaml")
+ if tag == "" && strings.Index(string(field.Tag), ":") < 0 {
+ tag = string(field.Tag)
+ }
+ if tag == "-" {
+ continue
+ }
+
+ inline := false
+ fields := strings.Split(tag, ",")
+ if len(fields) > 1 {
+ for _, flag := range fields[1:] {
+ switch flag {
+ case "omitempty":
+ info.OmitEmpty = true
+ case "flow":
+ info.Flow = true
+ case "inline":
+ inline = true
+ default:
+ return nil, errors.New(fmt.Sprintf("Unsupported flag %q in tag %q of type %s", flag, tag, st))
+ }
+ }
+ tag = fields[0]
+ }
+
+ if inline {
+ switch field.Type.Kind() {
+ case reflect.Map:
+ if inlineMap >= 0 {
+ return nil, errors.New("Multiple ,inline maps in struct " + st.String())
+ }
+ if field.Type.Key() != reflect.TypeOf("") {
+ return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String())
+ }
+ inlineMap = info.Num
+ case reflect.Struct:
+ sinfo, err := getStructInfo(field.Type)
+ if err != nil {
+ return nil, err
+ }
+ for _, finfo := range sinfo.FieldsList {
+ if _, found := fieldsMap[finfo.Key]; found {
+ msg := "Duplicated key '" + finfo.Key + "' in struct " + st.String()
+ return nil, errors.New(msg)
+ }
+ if finfo.Inline == nil {
+ finfo.Inline = []int{i, finfo.Num}
+ } else {
+ finfo.Inline = append([]int{i}, finfo.Inline...)
+ }
+ finfo.Id = len(fieldsList)
+ fieldsMap[finfo.Key] = finfo
+ fieldsList = append(fieldsList, finfo)
+ }
+ default:
+ //return nil, errors.New("Option ,inline needs a struct value or map field")
+ return nil, errors.New("Option ,inline needs a struct value field")
+ }
+ continue
+ }
+
+ if tag != "" {
+ info.Key = tag
+ } else {
+ info.Key = strings.ToLower(field.Name)
+ }
+
+ if _, found = fieldsMap[info.Key]; found {
+ msg := "Duplicated key '" + info.Key + "' in struct " + st.String()
+ return nil, errors.New(msg)
+ }
+
+ info.Id = len(fieldsList)
+ fieldsList = append(fieldsList, info)
+ fieldsMap[info.Key] = info
+ }
+
+ sinfo = &structInfo{
+ FieldsMap: fieldsMap,
+ FieldsList: fieldsList,
+ InlineMap: inlineMap,
+ }
+
+ fieldMapMutex.Lock()
+ structMap[st] = sinfo
+ fieldMapMutex.Unlock()
+ return sinfo, nil
+}
+
+// IsZeroer is used to check whether an object is zero to
+// determine whether it should be omitted when marshaling
+// with the omitempty flag. One notable implementation
+// is time.Time.
+type IsZeroer interface {
+ IsZero() bool
+}
+
+func isZero(v reflect.Value) bool {
+ kind := v.Kind()
+ if z, ok := v.Interface().(IsZeroer); ok {
+ if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() {
+ return true
+ }
+ return z.IsZero()
+ }
+ switch kind {
+ case reflect.String:
+ return len(v.String()) == 0
+ case reflect.Interface, reflect.Ptr:
+ return v.IsNil()
+ case reflect.Slice:
+ return v.Len() == 0
+ case reflect.Map:
+ return v.Len() == 0
+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+ return v.Int() == 0
+ case reflect.Float32, reflect.Float64:
+ return v.Float() == 0
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
+ return v.Uint() == 0
+ case reflect.Bool:
+ return !v.Bool()
+ case reflect.Struct:
+ vt := v.Type()
+ for i := v.NumField() - 1; i >= 0; i-- {
+ if vt.Field(i).PkgPath != "" {
+ continue // Private field
+ }
+ if !isZero(v.Field(i)) {
+ return false
+ }
+ }
+ return true
+ }
+ return false
+}
+
+// FutureLineWrap globally disables line wrapping when encoding long strings.
+// This is a temporary and thus deprecated method introduced to faciliate
+// migration towards v3, which offers more control of line lengths on
+// individual encodings, and has a default matching the behavior introduced
+// by this function.
+//
+// The default formatting of v2 was erroneously changed in v2.3.0 and reverted
+// in v2.4.0, at which point this function was introduced to help migration.
+func FutureLineWrap() {
+ disableLineWrapping = true
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go
new file mode 100644
index 000000000..f6a9c8e34
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlh.go
@@ -0,0 +1,739 @@
+package yaml
+
+import (
+ "fmt"
+ "io"
+)
+
+// The version directive data.
+type yaml_version_directive_t struct {
+ major int8 // The major version number.
+ minor int8 // The minor version number.
+}
+
+// The tag directive data.
+type yaml_tag_directive_t struct {
+ handle []byte // The tag handle.
+ prefix []byte // The tag prefix.
+}
+
+type yaml_encoding_t int
+
+// The stream encoding.
+const (
+ // Let the parser choose the encoding.
+ yaml_ANY_ENCODING yaml_encoding_t = iota
+
+ yaml_UTF8_ENCODING // The default UTF-8 encoding.
+ yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM.
+ yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM.
+)
+
+type yaml_break_t int
+
+// Line break types.
+const (
+ // Let the parser choose the break type.
+ yaml_ANY_BREAK yaml_break_t = iota
+
+ yaml_CR_BREAK // Use CR for line breaks (Mac style).
+ yaml_LN_BREAK // Use LN for line breaks (Unix style).
+ yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style).
+)
+
+type yaml_error_type_t int
+
+// Many bad things could happen with the parser and emitter.
+const (
+ // No error is produced.
+ yaml_NO_ERROR yaml_error_type_t = iota
+
+ yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory.
+ yaml_READER_ERROR // Cannot read or decode the input stream.
+ yaml_SCANNER_ERROR // Cannot scan the input stream.
+ yaml_PARSER_ERROR // Cannot parse the input stream.
+ yaml_COMPOSER_ERROR // Cannot compose a YAML document.
+ yaml_WRITER_ERROR // Cannot write to the output stream.
+ yaml_EMITTER_ERROR // Cannot emit a YAML stream.
+)
+
+// The pointer position.
+type yaml_mark_t struct {
+ index int // The position index.
+ line int // The position line.
+ column int // The position column.
+}
+
+// Node Styles
+
+type yaml_style_t int8
+
+type yaml_scalar_style_t yaml_style_t
+
+// Scalar styles.
+const (
+ // Let the emitter choose the style.
+ yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota
+
+ yaml_PLAIN_SCALAR_STYLE // The plain scalar style.
+ yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style.
+ yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style.
+ yaml_LITERAL_SCALAR_STYLE // The literal scalar style.
+ yaml_FOLDED_SCALAR_STYLE // The folded scalar style.
+)
+
+type yaml_sequence_style_t yaml_style_t
+
+// Sequence styles.
+const (
+ // Let the emitter choose the style.
+ yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota
+
+ yaml_BLOCK_SEQUENCE_STYLE // The block sequence style.
+ yaml_FLOW_SEQUENCE_STYLE // The flow sequence style.
+)
+
+type yaml_mapping_style_t yaml_style_t
+
+// Mapping styles.
+const (
+ // Let the emitter choose the style.
+ yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota
+
+ yaml_BLOCK_MAPPING_STYLE // The block mapping style.
+ yaml_FLOW_MAPPING_STYLE // The flow mapping style.
+)
+
+// Tokens
+
+type yaml_token_type_t int
+
+// Token types.
+const (
+ // An empty token.
+ yaml_NO_TOKEN yaml_token_type_t = iota
+
+ yaml_STREAM_START_TOKEN // A STREAM-START token.
+ yaml_STREAM_END_TOKEN // A STREAM-END token.
+
+ yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token.
+ yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token.
+ yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token.
+ yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token.
+
+ yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token.
+ yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token.
+ yaml_BLOCK_END_TOKEN // A BLOCK-END token.
+
+ yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token.
+ yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token.
+ yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token.
+ yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token.
+
+ yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token.
+ yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token.
+ yaml_KEY_TOKEN // A KEY token.
+ yaml_VALUE_TOKEN // A VALUE token.
+
+ yaml_ALIAS_TOKEN // An ALIAS token.
+ yaml_ANCHOR_TOKEN // An ANCHOR token.
+ yaml_TAG_TOKEN // A TAG token.
+ yaml_SCALAR_TOKEN // A SCALAR token.
+)
+
+func (tt yaml_token_type_t) String() string {
+ switch tt {
+ case yaml_NO_TOKEN:
+ return "yaml_NO_TOKEN"
+ case yaml_STREAM_START_TOKEN:
+ return "yaml_STREAM_START_TOKEN"
+ case yaml_STREAM_END_TOKEN:
+ return "yaml_STREAM_END_TOKEN"
+ case yaml_VERSION_DIRECTIVE_TOKEN:
+ return "yaml_VERSION_DIRECTIVE_TOKEN"
+ case yaml_TAG_DIRECTIVE_TOKEN:
+ return "yaml_TAG_DIRECTIVE_TOKEN"
+ case yaml_DOCUMENT_START_TOKEN:
+ return "yaml_DOCUMENT_START_TOKEN"
+ case yaml_DOCUMENT_END_TOKEN:
+ return "yaml_DOCUMENT_END_TOKEN"
+ case yaml_BLOCK_SEQUENCE_START_TOKEN:
+ return "yaml_BLOCK_SEQUENCE_START_TOKEN"
+ case yaml_BLOCK_MAPPING_START_TOKEN:
+ return "yaml_BLOCK_MAPPING_START_TOKEN"
+ case yaml_BLOCK_END_TOKEN:
+ return "yaml_BLOCK_END_TOKEN"
+ case yaml_FLOW_SEQUENCE_START_TOKEN:
+ return "yaml_FLOW_SEQUENCE_START_TOKEN"
+ case yaml_FLOW_SEQUENCE_END_TOKEN:
+ return "yaml_FLOW_SEQUENCE_END_TOKEN"
+ case yaml_FLOW_MAPPING_START_TOKEN:
+ return "yaml_FLOW_MAPPING_START_TOKEN"
+ case yaml_FLOW_MAPPING_END_TOKEN:
+ return "yaml_FLOW_MAPPING_END_TOKEN"
+ case yaml_BLOCK_ENTRY_TOKEN:
+ return "yaml_BLOCK_ENTRY_TOKEN"
+ case yaml_FLOW_ENTRY_TOKEN:
+ return "yaml_FLOW_ENTRY_TOKEN"
+ case yaml_KEY_TOKEN:
+ return "yaml_KEY_TOKEN"
+ case yaml_VALUE_TOKEN:
+ return "yaml_VALUE_TOKEN"
+ case yaml_ALIAS_TOKEN:
+ return "yaml_ALIAS_TOKEN"
+ case yaml_ANCHOR_TOKEN:
+ return "yaml_ANCHOR_TOKEN"
+ case yaml_TAG_TOKEN:
+ return "yaml_TAG_TOKEN"
+ case yaml_SCALAR_TOKEN:
+ return "yaml_SCALAR_TOKEN"
+ }
+ return ""
+}
+
+// The token structure.
+type yaml_token_t struct {
+ // The token type.
+ typ yaml_token_type_t
+
+ // The start/end of the token.
+ start_mark, end_mark yaml_mark_t
+
+ // The stream encoding (for yaml_STREAM_START_TOKEN).
+ encoding yaml_encoding_t
+
+ // The alias/anchor/scalar value or tag/tag directive handle
+ // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN).
+ value []byte
+
+ // The tag suffix (for yaml_TAG_TOKEN).
+ suffix []byte
+
+ // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN).
+ prefix []byte
+
+ // The scalar style (for yaml_SCALAR_TOKEN).
+ style yaml_scalar_style_t
+
+ // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN).
+ major, minor int8
+}
+
+// Events
+
+type yaml_event_type_t int8
+
+// Event types.
+const (
+ // An empty event.
+ yaml_NO_EVENT yaml_event_type_t = iota
+
+ yaml_STREAM_START_EVENT // A STREAM-START event.
+ yaml_STREAM_END_EVENT // A STREAM-END event.
+ yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event.
+ yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event.
+ yaml_ALIAS_EVENT // An ALIAS event.
+ yaml_SCALAR_EVENT // A SCALAR event.
+ yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event.
+ yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event.
+ yaml_MAPPING_START_EVENT // A MAPPING-START event.
+ yaml_MAPPING_END_EVENT // A MAPPING-END event.
+)
+
+var eventStrings = []string{
+ yaml_NO_EVENT: "none",
+ yaml_STREAM_START_EVENT: "stream start",
+ yaml_STREAM_END_EVENT: "stream end",
+ yaml_DOCUMENT_START_EVENT: "document start",
+ yaml_DOCUMENT_END_EVENT: "document end",
+ yaml_ALIAS_EVENT: "alias",
+ yaml_SCALAR_EVENT: "scalar",
+ yaml_SEQUENCE_START_EVENT: "sequence start",
+ yaml_SEQUENCE_END_EVENT: "sequence end",
+ yaml_MAPPING_START_EVENT: "mapping start",
+ yaml_MAPPING_END_EVENT: "mapping end",
+}
+
+func (e yaml_event_type_t) String() string {
+ if e < 0 || int(e) >= len(eventStrings) {
+ return fmt.Sprintf("unknown event %d", e)
+ }
+ return eventStrings[e]
+}
+
+// The event structure.
+type yaml_event_t struct {
+
+ // The event type.
+ typ yaml_event_type_t
+
+ // The start and end of the event.
+ start_mark, end_mark yaml_mark_t
+
+ // The document encoding (for yaml_STREAM_START_EVENT).
+ encoding yaml_encoding_t
+
+ // The version directive (for yaml_DOCUMENT_START_EVENT).
+ version_directive *yaml_version_directive_t
+
+ // The list of tag directives (for yaml_DOCUMENT_START_EVENT).
+ tag_directives []yaml_tag_directive_t
+
+ // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT).
+ anchor []byte
+
+ // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT).
+ tag []byte
+
+ // The scalar value (for yaml_SCALAR_EVENT).
+ value []byte
+
+ // Is the document start/end indicator implicit, or the tag optional?
+ // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT).
+ implicit bool
+
+ // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT).
+ quoted_implicit bool
+
+ // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT).
+ style yaml_style_t
+}
+
+func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) }
+func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) }
+func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) }
+
+// Nodes
+
+const (
+ yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null.
+ yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false.
+ yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values.
+ yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values.
+ yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values.
+ yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values.
+
+ yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences.
+ yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping.
+
+ // Not in original libyaml.
+ yaml_BINARY_TAG = "tag:yaml.org,2002:binary"
+ yaml_MERGE_TAG = "tag:yaml.org,2002:merge"
+
+ yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str.
+ yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq.
+ yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map.
+)
+
+type yaml_node_type_t int
+
+// Node types.
+const (
+ // An empty node.
+ yaml_NO_NODE yaml_node_type_t = iota
+
+ yaml_SCALAR_NODE // A scalar node.
+ yaml_SEQUENCE_NODE // A sequence node.
+ yaml_MAPPING_NODE // A mapping node.
+)
+
+// An element of a sequence node.
+type yaml_node_item_t int
+
+// An element of a mapping node.
+type yaml_node_pair_t struct {
+ key int // The key of the element.
+ value int // The value of the element.
+}
+
+// The node structure.
+type yaml_node_t struct {
+ typ yaml_node_type_t // The node type.
+ tag []byte // The node tag.
+
+ // The node data.
+
+ // The scalar parameters (for yaml_SCALAR_NODE).
+ scalar struct {
+ value []byte // The scalar value.
+ length int // The length of the scalar value.
+ style yaml_scalar_style_t // The scalar style.
+ }
+
+ // The sequence parameters (for YAML_SEQUENCE_NODE).
+ sequence struct {
+ items_data []yaml_node_item_t // The stack of sequence items.
+ style yaml_sequence_style_t // The sequence style.
+ }
+
+ // The mapping parameters (for yaml_MAPPING_NODE).
+ mapping struct {
+ pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value).
+ pairs_start *yaml_node_pair_t // The beginning of the stack.
+ pairs_end *yaml_node_pair_t // The end of the stack.
+ pairs_top *yaml_node_pair_t // The top of the stack.
+ style yaml_mapping_style_t // The mapping style.
+ }
+
+ start_mark yaml_mark_t // The beginning of the node.
+ end_mark yaml_mark_t // The end of the node.
+
+}
+
+// The document structure.
+type yaml_document_t struct {
+
+ // The document nodes.
+ nodes []yaml_node_t
+
+ // The version directive.
+ version_directive *yaml_version_directive_t
+
+ // The list of tag directives.
+ tag_directives_data []yaml_tag_directive_t
+ tag_directives_start int // The beginning of the tag directives list.
+ tag_directives_end int // The end of the tag directives list.
+
+ start_implicit int // Is the document start indicator implicit?
+ end_implicit int // Is the document end indicator implicit?
+
+ // The start/end of the document.
+ start_mark, end_mark yaml_mark_t
+}
+
+// The prototype of a read handler.
+//
+// The read handler is called when the parser needs to read more bytes from the
+// source. The handler should write not more than size bytes to the buffer.
+// The number of written bytes should be set to the size_read variable.
+//
+// [in,out] data A pointer to an application data specified by
+// yaml_parser_set_input().
+// [out] buffer The buffer to write the data from the source.
+// [in] size The size of the buffer.
+// [out] size_read The actual number of bytes read from the source.
+//
+// On success, the handler should return 1. If the handler failed,
+// the returned value should be 0. On EOF, the handler should set the
+// size_read to 0 and return 1.
+type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error)
+
+// This structure holds information about a potential simple key.
+type yaml_simple_key_t struct {
+ possible bool // Is a simple key possible?
+ required bool // Is a simple key required?
+ token_number int // The number of the token.
+ mark yaml_mark_t // The position mark.
+}
+
+// The states of the parser.
+type yaml_parser_state_t int
+
+const (
+ yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota
+
+ yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document.
+ yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START.
+ yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document.
+ yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END.
+ yaml_PARSE_BLOCK_NODE_STATE // Expect a block node.
+ yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence.
+ yaml_PARSE_FLOW_NODE_STATE // Expect a flow node.
+ yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence.
+ yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence.
+ yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence.
+ yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping.
+ yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key.
+ yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value.
+ yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence.
+ yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence.
+ yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping.
+ yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping.
+ yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry.
+ yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping.
+ yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping.
+ yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping.
+ yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping.
+ yaml_PARSE_END_STATE // Expect nothing.
+)
+
+func (ps yaml_parser_state_t) String() string {
+ switch ps {
+ case yaml_PARSE_STREAM_START_STATE:
+ return "yaml_PARSE_STREAM_START_STATE"
+ case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE:
+ return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE"
+ case yaml_PARSE_DOCUMENT_START_STATE:
+ return "yaml_PARSE_DOCUMENT_START_STATE"
+ case yaml_PARSE_DOCUMENT_CONTENT_STATE:
+ return "yaml_PARSE_DOCUMENT_CONTENT_STATE"
+ case yaml_PARSE_DOCUMENT_END_STATE:
+ return "yaml_PARSE_DOCUMENT_END_STATE"
+ case yaml_PARSE_BLOCK_NODE_STATE:
+ return "yaml_PARSE_BLOCK_NODE_STATE"
+ case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
+ return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE"
+ case yaml_PARSE_FLOW_NODE_STATE:
+ return "yaml_PARSE_FLOW_NODE_STATE"
+ case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
+ return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE"
+ case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
+ return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE"
+ case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
+ return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE"
+ case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
+ return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE"
+ case yaml_PARSE_BLOCK_MAPPING_KEY_STATE:
+ return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE"
+ case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE:
+ return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE"
+ case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
+ return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE"
+ case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
+ return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE"
+ case yaml_PARSE_FLOW_MAPPING_KEY_STATE:
+ return "yaml_PARSE_FLOW_MAPPING_KEY_STATE"
+ case yaml_PARSE_FLOW_MAPPING_VALUE_STATE:
+ return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE"
+ case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
+ return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE"
+ case yaml_PARSE_END_STATE:
+ return "yaml_PARSE_END_STATE"
+ }
+ return ""
+}
+
+// This structure holds aliases data.
+type yaml_alias_data_t struct {
+ anchor []byte // The anchor.
+ index int // The node id.
+ mark yaml_mark_t // The anchor mark.
+}
+
+// The parser structure.
+//
+// All members are internal. Manage the structure using the
+// yaml_parser_ family of functions.
+type yaml_parser_t struct {
+
+ // Error handling
+
+ error yaml_error_type_t // Error type.
+
+ problem string // Error description.
+
+ // The byte about which the problem occurred.
+ problem_offset int
+ problem_value int
+ problem_mark yaml_mark_t
+
+ // The error context.
+ context string
+ context_mark yaml_mark_t
+
+ // Reader stuff
+
+ read_handler yaml_read_handler_t // Read handler.
+
+ input_reader io.Reader // File input data.
+ input []byte // String input data.
+ input_pos int
+
+ eof bool // EOF flag
+
+ buffer []byte // The working buffer.
+ buffer_pos int // The current position of the buffer.
+
+ unread int // The number of unread characters in the buffer.
+
+ raw_buffer []byte // The raw buffer.
+ raw_buffer_pos int // The current position of the buffer.
+
+ encoding yaml_encoding_t // The input encoding.
+
+ offset int // The offset of the current position (in bytes).
+ mark yaml_mark_t // The mark of the current position.
+
+ // Scanner stuff
+
+ stream_start_produced bool // Have we started to scan the input stream?
+ stream_end_produced bool // Have we reached the end of the input stream?
+
+ flow_level int // The number of unclosed '[' and '{' indicators.
+
+ tokens []yaml_token_t // The tokens queue.
+ tokens_head int // The head of the tokens queue.
+ tokens_parsed int // The number of tokens fetched from the queue.
+ token_available bool // Does the tokens queue contain a token ready for dequeueing.
+
+ indent int // The current indentation level.
+ indents []int // The indentation levels stack.
+
+ simple_key_allowed bool // May a simple key occur at the current position?
+ simple_keys []yaml_simple_key_t // The stack of simple keys.
+ simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number
+
+ // Parser stuff
+
+ state yaml_parser_state_t // The current parser state.
+ states []yaml_parser_state_t // The parser states stack.
+ marks []yaml_mark_t // The stack of marks.
+ tag_directives []yaml_tag_directive_t // The list of TAG directives.
+
+ // Dumper stuff
+
+ aliases []yaml_alias_data_t // The alias data.
+
+ document *yaml_document_t // The currently parsed document.
+}
+
+// Emitter Definitions
+
+// The prototype of a write handler.
+//
+// The write handler is called when the emitter needs to flush the accumulated
+// characters to the output. The handler should write @a size bytes of the
+// @a buffer to the output.
+//
+// @param[in,out] data A pointer to an application data specified by
+// yaml_emitter_set_output().
+// @param[in] buffer The buffer with bytes to be written.
+// @param[in] size The size of the buffer.
+//
+// @returns On success, the handler should return @c 1. If the handler failed,
+// the returned value should be @c 0.
+//
+type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error
+
+type yaml_emitter_state_t int
+
+// The emitter states.
+const (
+ // Expect STREAM-START.
+ yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota
+
+ yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END.
+ yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END.
+ yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document.
+ yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END.
+ yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence.
+ yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence.
+ yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping.
+ yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping.
+ yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping.
+ yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping.
+ yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence.
+ yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence.
+ yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping.
+ yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping.
+ yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping.
+ yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping.
+ yaml_EMIT_END_STATE // Expect nothing.
+)
+
+// The emitter structure.
+//
+// All members are internal. Manage the structure using the @c yaml_emitter_
+// family of functions.
+type yaml_emitter_t struct {
+
+ // Error handling
+
+ error yaml_error_type_t // Error type.
+ problem string // Error description.
+
+ // Writer stuff
+
+ write_handler yaml_write_handler_t // Write handler.
+
+ output_buffer *[]byte // String output data.
+ output_writer io.Writer // File output data.
+
+ buffer []byte // The working buffer.
+ buffer_pos int // The current position of the buffer.
+
+ raw_buffer []byte // The raw buffer.
+ raw_buffer_pos int // The current position of the buffer.
+
+ encoding yaml_encoding_t // The stream encoding.
+
+ // Emitter stuff
+
+ canonical bool // If the output is in the canonical style?
+ best_indent int // The number of indentation spaces.
+ best_width int // The preferred width of the output lines.
+ unicode bool // Allow unescaped non-ASCII characters?
+ line_break yaml_break_t // The preferred line break.
+
+ state yaml_emitter_state_t // The current emitter state.
+ states []yaml_emitter_state_t // The stack of states.
+
+ events []yaml_event_t // The event queue.
+ events_head int // The head of the event queue.
+
+ indents []int // The stack of indentation levels.
+
+ tag_directives []yaml_tag_directive_t // The list of tag directives.
+
+ indent int // The current indentation level.
+
+ flow_level int // The current flow level.
+
+ root_context bool // Is it the document root context?
+ sequence_context bool // Is it a sequence context?
+ mapping_context bool // Is it a mapping context?
+ simple_key_context bool // Is it a simple mapping key context?
+
+ line int // The current line.
+ column int // The current column.
+ whitespace bool // If the last character was a whitespace?
+ indention bool // If the last character was an indentation character (' ', '-', '?', ':')?
+ open_ended bool // If an explicit document end is required?
+
+ // Anchor analysis.
+ anchor_data struct {
+ anchor []byte // The anchor value.
+ alias bool // Is it an alias?
+ }
+
+ // Tag analysis.
+ tag_data struct {
+ handle []byte // The tag handle.
+ suffix []byte // The tag suffix.
+ }
+
+ // Scalar analysis.
+ scalar_data struct {
+ value []byte // The scalar value.
+ multiline bool // Does the scalar contain line breaks?
+ flow_plain_allowed bool // Can the scalar be expessed in the flow plain style?
+ block_plain_allowed bool // Can the scalar be expressed in the block plain style?
+ single_quoted_allowed bool // Can the scalar be expressed in the single quoted style?
+ block_allowed bool // Can the scalar be expressed in the literal or folded styles?
+ style yaml_scalar_style_t // The output style.
+ }
+
+ // Dumper stuff
+
+ opened bool // If the stream was already opened?
+ closed bool // If the stream was already closed?
+
+ // The information associated with the document nodes.
+ anchors *struct {
+ references int // The number of references.
+ anchor int // The anchor id.
+ serialized bool // If the node has been emitted?
+ }
+
+ last_anchor_id int // The last assigned anchor id.
+
+ document *yaml_document_t // The currently emitted document.
+}
diff --git a/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go
new file mode 100644
index 000000000..8110ce3c3
--- /dev/null
+++ b/vendor/sigs.k8s.io/yaml/goyaml.v2/yamlprivateh.go
@@ -0,0 +1,173 @@
+package yaml
+
+const (
+ // The size of the input raw buffer.
+ input_raw_buffer_size = 512
+
+ // The size of the input buffer.
+ // It should be possible to decode the whole raw buffer.
+ input_buffer_size = input_raw_buffer_size * 3
+
+ // The size of the output buffer.
+ output_buffer_size = 128
+
+ // The size of the output raw buffer.
+ // It should be possible to encode the whole output buffer.
+ output_raw_buffer_size = (output_buffer_size*2 + 2)
+
+ // The size of other stacks and queues.
+ initial_stack_size = 16
+ initial_queue_size = 16
+ initial_string_size = 16
+)
+
+// Check if the character at the specified position is an alphabetical
+// character, a digit, '_', or '-'.
+func is_alpha(b []byte, i int) bool {
+ return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-'
+}
+
+// Check if the character at the specified position is a digit.
+func is_digit(b []byte, i int) bool {
+ return b[i] >= '0' && b[i] <= '9'
+}
+
+// Get the value of a digit.
+func as_digit(b []byte, i int) int {
+ return int(b[i]) - '0'
+}
+
+// Check if the character at the specified position is a hex-digit.
+func is_hex(b []byte, i int) bool {
+ return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f'
+}
+
+// Get the value of a hex-digit.
+func as_hex(b []byte, i int) int {
+ bi := b[i]
+ if bi >= 'A' && bi <= 'F' {
+ return int(bi) - 'A' + 10
+ }
+ if bi >= 'a' && bi <= 'f' {
+ return int(bi) - 'a' + 10
+ }
+ return int(bi) - '0'
+}
+
+// Check if the character is ASCII.
+func is_ascii(b []byte, i int) bool {
+ return b[i] <= 0x7F
+}
+
+// Check if the character at the start of the buffer can be printed unescaped.
+func is_printable(b []byte, i int) bool {
+ return ((b[i] == 0x0A) || // . == #x0A
+ (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E
+ (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF
+ (b[i] > 0xC2 && b[i] < 0xED) ||
+ (b[i] == 0xED && b[i+1] < 0xA0) ||
+ (b[i] == 0xEE) ||
+ (b[i] == 0xEF && // #xE000 <= . <= #xFFFD
+ !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF
+ !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF))))
+}
+
+// Check if the character at the specified position is NUL.
+func is_z(b []byte, i int) bool {
+ return b[i] == 0x00
+}
+
+// Check if the beginning of the buffer is a BOM.
+func is_bom(b []byte, i int) bool {
+ return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF
+}
+
+// Check if the character at the specified position is space.
+func is_space(b []byte, i int) bool {
+ return b[i] == ' '
+}
+
+// Check if the character at the specified position is tab.
+func is_tab(b []byte, i int) bool {
+ return b[i] == '\t'
+}
+
+// Check if the character at the specified position is blank (space or tab).
+func is_blank(b []byte, i int) bool {
+ //return is_space(b, i) || is_tab(b, i)
+ return b[i] == ' ' || b[i] == '\t'
+}
+
+// Check if the character at the specified position is a line break.
+func is_break(b []byte, i int) bool {
+ return (b[i] == '\r' || // CR (#xD)
+ b[i] == '\n' || // LF (#xA)
+ b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029)
+}
+
+func is_crlf(b []byte, i int) bool {
+ return b[i] == '\r' && b[i+1] == '\n'
+}
+
+// Check if the character is a line break or NUL.
+func is_breakz(b []byte, i int) bool {
+ //return is_break(b, i) || is_z(b, i)
+ return ( // is_break:
+ b[i] == '\r' || // CR (#xD)
+ b[i] == '\n' || // LF (#xA)
+ b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
+ // is_z:
+ b[i] == 0)
+}
+
+// Check if the character is a line break, space, or NUL.
+func is_spacez(b []byte, i int) bool {
+ //return is_space(b, i) || is_breakz(b, i)
+ return ( // is_space:
+ b[i] == ' ' ||
+ // is_breakz:
+ b[i] == '\r' || // CR (#xD)
+ b[i] == '\n' || // LF (#xA)
+ b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
+ b[i] == 0)
+}
+
+// Check if the character is a line break, space, tab, or NUL.
+func is_blankz(b []byte, i int) bool {
+ //return is_blank(b, i) || is_breakz(b, i)
+ return ( // is_blank:
+ b[i] == ' ' || b[i] == '\t' ||
+ // is_breakz:
+ b[i] == '\r' || // CR (#xD)
+ b[i] == '\n' || // LF (#xA)
+ b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028)
+ b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029)
+ b[i] == 0)
+}
+
+// Determine the width of the character.
+func width(b byte) int {
+ // Don't replace these by a switch without first
+ // confirming that it is being inlined.
+ if b&0x80 == 0x00 {
+ return 1
+ }
+ if b&0xE0 == 0xC0 {
+ return 2
+ }
+ if b&0xF0 == 0xE0 {
+ return 3
+ }
+ if b&0xF8 == 0xF0 {
+ return 4
+ }
+ return 0
+
+}
diff --git a/vendor/sigs.k8s.io/yaml/yaml.go b/vendor/sigs.k8s.io/yaml/yaml.go
index efbc535d4..fc10246bd 100644
--- a/vendor/sigs.k8s.io/yaml/yaml.go
+++ b/vendor/sigs.k8s.io/yaml/yaml.go
@@ -1,3 +1,19 @@
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
package yaml
import (
@@ -8,56 +24,59 @@ import (
"reflect"
"strconv"
- "gopkg.in/yaml.v2"
+ "sigs.k8s.io/yaml/goyaml.v2"
)
-// Marshal marshals the object into JSON then converts JSON to YAML and returns the
-// YAML.
-func Marshal(o interface{}) ([]byte, error) {
- j, err := json.Marshal(o)
+// Marshal marshals obj into JSON using stdlib json.Marshal, and then converts JSON to YAML using JSONToYAML (see that method for more reference)
+func Marshal(obj interface{}) ([]byte, error) {
+ jsonBytes, err := json.Marshal(obj)
if err != nil {
- return nil, fmt.Errorf("error marshaling into JSON: %v", err)
+ return nil, fmt.Errorf("error marshaling into JSON: %w", err)
}
- y, err := JSONToYAML(j)
- if err != nil {
- return nil, fmt.Errorf("error converting JSON to YAML: %v", err)
- }
-
- return y, nil
+ return JSONToYAML(jsonBytes)
}
// JSONOpt is a decoding option for decoding from JSON format.
type JSONOpt func(*json.Decoder) *json.Decoder
-// Unmarshal converts YAML to JSON then uses JSON to unmarshal into an object,
-// optionally configuring the behavior of the JSON unmarshal.
-func Unmarshal(y []byte, o interface{}, opts ...JSONOpt) error {
- return yamlUnmarshal(y, o, false, opts...)
+// Unmarshal first converts the given YAML to JSON, and then unmarshals the JSON into obj. Options for the
+// standard library json.Decoder can be optionally specified, e.g. to decode untyped numbers into json.Number instead of float64, or to disallow unknown fields (but for that purpose, see also UnmarshalStrict). obj must be a non-nil pointer.
+//
+// Important notes about the Unmarshal logic:
+//
+// - Decoding is case-insensitive, unlike the rest of Kubernetes API machinery, as this is using the stdlib json library. This might be confusing to users.
+// - This decodes any number (although it is an integer) into a float64 if the type of obj is unknown, e.g. *map[string]interface{}, *interface{}, or *[]interface{}. This means integers above +/- 2^53 will lose precision when round-tripping. Make a JSONOpt that calls d.UseNumber() to avoid this.
+// - Duplicate fields, including in-case-sensitive matches, are ignored in an undefined order. Note that the YAML specification forbids duplicate fields, so this logic is more permissive than it needs to. See UnmarshalStrict for an alternative.
+// - Unknown fields, i.e. serialized data that do not map to a field in obj, are ignored. Use d.DisallowUnknownFields() or UnmarshalStrict to override.
+// - As per the YAML 1.1 specification, which yaml.v2 used underneath implements, literal 'yes' and 'no' strings without quotation marks will be converted to true/false implicitly.
+// - YAML non-string keys, e.g. ints, bools and floats, are converted to strings implicitly during the YAML to JSON conversion process.
+// - There are no compatibility guarantees for returned error values.
+func Unmarshal(yamlBytes []byte, obj interface{}, opts ...JSONOpt) error {
+ return unmarshal(yamlBytes, obj, yaml.Unmarshal, opts...)
}
-// UnmarshalStrict strictly converts YAML to JSON then uses JSON to unmarshal
-// into an object, optionally configuring the behavior of the JSON unmarshal.
-func UnmarshalStrict(y []byte, o interface{}, opts ...JSONOpt) error {
- return yamlUnmarshal(y, o, true, append(opts, DisallowUnknownFields)...)
+// UnmarshalStrict is similar to Unmarshal (please read its documentation for reference), with the following exceptions:
+//
+// - Duplicate fields in an object yield an error. This is according to the YAML specification.
+// - If obj, or any of its recursive children, is a struct, presence of fields in the serialized data unknown to the struct will yield an error.
+func UnmarshalStrict(yamlBytes []byte, obj interface{}, opts ...JSONOpt) error {
+ return unmarshal(yamlBytes, obj, yaml.UnmarshalStrict, append(opts, DisallowUnknownFields)...)
}
-// yamlUnmarshal unmarshals the given YAML byte stream into the given interface,
+// unmarshal unmarshals the given YAML byte stream into the given interface,
// optionally performing the unmarshalling strictly
-func yamlUnmarshal(y []byte, o interface{}, strict bool, opts ...JSONOpt) error {
- vo := reflect.ValueOf(o)
- unmarshalFn := yaml.Unmarshal
- if strict {
- unmarshalFn = yaml.UnmarshalStrict
- }
- j, err := yamlToJSON(y, &vo, unmarshalFn)
+func unmarshal(yamlBytes []byte, obj interface{}, unmarshalFn func([]byte, interface{}) error, opts ...JSONOpt) error {
+ jsonTarget := reflect.ValueOf(obj)
+
+ jsonBytes, err := yamlToJSONTarget(yamlBytes, &jsonTarget, unmarshalFn)
if err != nil {
- return fmt.Errorf("error converting YAML to JSON: %v", err)
+ return fmt.Errorf("error converting YAML to JSON: %w", err)
}
- err = jsonUnmarshal(bytes.NewReader(j), o, opts...)
+ err = jsonUnmarshal(bytes.NewReader(jsonBytes), obj, opts...)
if err != nil {
- return fmt.Errorf("error unmarshaling JSON: %v", err)
+ return fmt.Errorf("error unmarshaling JSON: %w", err)
}
return nil
@@ -67,21 +86,26 @@ func yamlUnmarshal(y []byte, o interface{}, strict bool, opts ...JSONOpt) error
// object, optionally applying decoder options prior to decoding. We are not
// using json.Unmarshal directly as we want the chance to pass in non-default
// options.
-func jsonUnmarshal(r io.Reader, o interface{}, opts ...JSONOpt) error {
- d := json.NewDecoder(r)
+func jsonUnmarshal(reader io.Reader, obj interface{}, opts ...JSONOpt) error {
+ d := json.NewDecoder(reader)
for _, opt := range opts {
d = opt(d)
}
- if err := d.Decode(&o); err != nil {
+ if err := d.Decode(&obj); err != nil {
return fmt.Errorf("while decoding JSON: %v", err)
}
return nil
}
-// JSONToYAML Converts JSON to YAML.
+// JSONToYAML converts JSON to YAML. Notable implementation details:
+//
+// - Duplicate fields, are case-sensitively ignored in an undefined order.
+// - The sequence indentation style is compact, which means that the "- " marker for a YAML sequence will be on the same indentation level as the sequence field name.
+// - Unlike Unmarshal, all integers, up to 64 bits, are preserved during this round-trip.
func JSONToYAML(j []byte) ([]byte, error) {
// Convert the JSON to an object.
var jsonObj interface{}
+
// We are using yaml.Unmarshal here (instead of json.Unmarshal) because the
// Go JSON library doesn't try to pick the right number type (int, float,
// etc.) when unmarshalling to interface{}, it just picks float64
@@ -93,35 +117,46 @@ func JSONToYAML(j []byte) ([]byte, error) {
}
// Marshal this object into YAML.
- return yaml.Marshal(jsonObj)
+ yamlBytes, err := yaml.Marshal(jsonObj)
+ if err != nil {
+ return nil, err
+ }
+
+ return yamlBytes, nil
}
// YAMLToJSON converts YAML to JSON. Since JSON is a subset of YAML,
// passing JSON through this method should be a no-op.
//
-// Things YAML can do that are not supported by JSON:
-// * In YAML you can have binary and null keys in your maps. These are invalid
-// in JSON. (int and float keys are converted to strings.)
-// * Binary data in YAML with the !!binary tag is not supported. If you want to
-// use binary data with this library, encode the data as base64 as usual but do
-// not use the !!binary tag in your YAML. This will ensure the original base64
-// encoded data makes it all the way through to the JSON.
+// Some things YAML can do that are not supported by JSON:
+// - In YAML you can have binary and null keys in your maps. These are invalid
+// in JSON, and therefore int, bool and float keys are converted to strings implicitly.
+// - Binary data in YAML with the !!binary tag is not supported. If you want to
+// use binary data with this library, encode the data as base64 as usual but do
+// not use the !!binary tag in your YAML. This will ensure the original base64
+// encoded data makes it all the way through to the JSON.
+// - And more... read the YAML specification for more details.
+//
+// Notable about the implementation:
//
-// For strict decoding of YAML, use YAMLToJSONStrict.
+// - Duplicate fields are case-sensitively ignored in an undefined order. Note that the YAML specification forbids duplicate fields, so this logic is more permissive than it needs to. See YAMLToJSONStrict for an alternative.
+// - As per the YAML 1.1 specification, which yaml.v2 used underneath implements, literal 'yes' and 'no' strings without quotation marks will be converted to true/false implicitly.
+// - Unlike Unmarshal, all integers, up to 64 bits, are preserved during this round-trip.
+// - There are no compatibility guarantees for returned error values.
func YAMLToJSON(y []byte) ([]byte, error) {
- return yamlToJSON(y, nil, yaml.Unmarshal)
+ return yamlToJSONTarget(y, nil, yaml.Unmarshal)
}
// YAMLToJSONStrict is like YAMLToJSON but enables strict YAML decoding,
// returning an error on any duplicate field names.
func YAMLToJSONStrict(y []byte) ([]byte, error) {
- return yamlToJSON(y, nil, yaml.UnmarshalStrict)
+ return yamlToJSONTarget(y, nil, yaml.UnmarshalStrict)
}
-func yamlToJSON(y []byte, jsonTarget *reflect.Value, yamlUnmarshal func([]byte, interface{}) error) ([]byte, error) {
+func yamlToJSONTarget(yamlBytes []byte, jsonTarget *reflect.Value, unmarshalFn func([]byte, interface{}) error) ([]byte, error) {
// Convert the YAML to an object.
var yamlObj interface{}
- err := yamlUnmarshal(y, &yamlObj)
+ err := unmarshalFn(yamlBytes, &yamlObj)
if err != nil {
return nil, err
}
@@ -136,7 +171,11 @@ func yamlToJSON(y []byte, jsonTarget *reflect.Value, yamlUnmarshal func([]byte,
}
// Convert this object to JSON and return the data.
- return json.Marshal(jsonObj)
+ jsonBytes, err := json.Marshal(jsonObj)
+ if err != nil {
+ return nil, err
+ }
+ return jsonBytes, nil
}
func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (interface{}, error) {
@@ -147,13 +186,13 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in
// decoding into the value, we're just checking if the ultimate target is a
// string.
if jsonTarget != nil {
- ju, tu, pv := indirect(*jsonTarget, false)
+ jsonUnmarshaler, textUnmarshaler, pointerValue := indirect(*jsonTarget, false)
// We have a JSON or Text Umarshaler at this level, so we can't be trying
// to decode into a string.
- if ju != nil || tu != nil {
+ if jsonUnmarshaler != nil || textUnmarshaler != nil {
jsonTarget = nil
} else {
- jsonTarget = &pv
+ jsonTarget = &pointerValue
}
}
@@ -205,7 +244,7 @@ func convertToJSONableObject(yamlObj interface{}, jsonTarget *reflect.Value) (in
keyString = "false"
}
default:
- return nil, fmt.Errorf("Unsupported map key of type: %s, key: %+#v, value: %+#v",
+ return nil, fmt.Errorf("unsupported map key of type: %s, key: %+#v, value: %+#v",
reflect.TypeOf(k), k, v)
}
diff --git a/vendor/sigs.k8s.io/yaml/yaml_go110.go b/vendor/sigs.k8s.io/yaml/yaml_go110.go
index ab3e06a22..94abc1719 100644
--- a/vendor/sigs.k8s.io/yaml/yaml_go110.go
+++ b/vendor/sigs.k8s.io/yaml/yaml_go110.go
@@ -1,7 +1,24 @@
// This file contains changes that are only compatible with go 1.10 and onwards.
+//go:build go1.10
// +build go1.10
+/*
+Copyright 2021 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
package yaml
import "encoding/json"