diff --git a/cmd/kn-event-sender/main.go b/cmd/kn-event-sender/main.go index 68c792dc2..b48ee0424 100644 --- a/cmd/kn-event-sender/main.go +++ b/cmd/kn-event-sender/main.go @@ -1,20 +1,23 @@ package main import ( - "fmt" + "context" "os" + "go.uber.org/zap" "knative.dev/kn-plugin-event/pkg/cli/retcode" "knative.dev/kn-plugin-event/pkg/configuration" + "knative.dev/pkg/logging" ) // ExitFunc will be used to exit Go process in case of error. var ExitFunc = os.Exit // nolint:gochecknoglobals func main() { + logger := createLogger() app := configuration.CreateIcs() if err := app.SendFromEnv(); err != nil { - _, _ = fmt.Fprint(os.Stderr, err) + logger.Error(err) ExitFunc(retcode.Calc(err)) } } @@ -24,3 +27,9 @@ func main() { func TestMain() { //nolint:deadcode main() } + +func createLogger() *zap.SugaredLogger { + return logging. + FromContext(context.TODO()). + With("env", os.Environ()) +} diff --git a/go.mod b/go.mod index 106b1104a..138a51b8f 100644 --- a/go.mod +++ b/go.mod @@ -3,28 +3,36 @@ module knative.dev/kn-plugin-event go 1.16 require ( + cloud.google.com/go v0.98.0 // indirect github.com/cloudevents/sdk-go/v2 v2.4.1 github.com/ghodss/yaml v1.0.0 + github.com/go-logr/logr v1.2.2 // indirect github.com/google/uuid v1.3.0 github.com/kelseyhightower/envconfig v1.4.0 github.com/magefile/mage v1.11.0 + github.com/openzipkin/zipkin-go v0.3.0 // indirect github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 + github.com/pkg/errors v0.9.1 + github.com/prometheus/common v0.32.1 // indirect github.com/spf13/cobra v1.2.1 github.com/thediveo/enumflag v0.10.0 github.com/wavesoftware/go-ensure v1.0.0 github.com/wavesoftware/go-magetasks v0.6.0 go.uber.org/zap v1.19.1 + golang.org/x/tools v0.1.8 // indirect + google.golang.org/grpc v1.42.0 // indirect gopkg.in/yaml.v2 v2.4.0 gotest.tools/v3 v3.0.3 k8s.io/api v0.21.4 k8s.io/apimachinery v0.22.3 k8s.io/client-go v0.21.4 + k8s.io/klog/v2 v2.40.1 // indirect knative.dev/client v0.27.0 - knative.dev/eventing v0.27.0 - knative.dev/hack v0.0.0-20211104075903-0f69979bbb7d - knative.dev/networking v0.0.0-20211104064801-6871f98f7b4d - knative.dev/pkg v0.0.0-20211104080002-e7547eabc6ee - knative.dev/serving v0.27.0 + knative.dev/eventing v0.27.2 + knative.dev/hack v0.0.0-20211122163517-fe1340f21191 + knative.dev/pkg v0.0.0-20211101212339-96c0204a70dc + knative.dev/reconciler-test v0.0.0-20211101214439-9839937c9b13 + knative.dev/serving v0.27.1 sigs.k8s.io/yaml v1.3.0 ) diff --git a/go.sum b/go.sum index 08717b328..14750b3cc 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,9 @@ cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWc cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0 h1:3DXvAyifywvq64LfkKaMOmkWPS1CikIQdMe2lY9vxU8= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0 h1:w6LozQJyDDEyhf64Uusu1LCcnLt0I1VMLiJC2kV+eXk= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -47,11 +48,13 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.18.2 h1:5NQw6tOn3eMm0oE8vTkfjau18kjL79FlMjy/CHTpmoY= cloud.google.com/go/storage v1.18.2/go.mod h1:AiIj7BWXyhO5gGVmYJ+S8tbkCx3yb0IMjua8Aw4naVM= contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d h1:LblfooH1lKOpp1hIhukktmSAxFkqMPFk9KR6iZ0MJNI= contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d/go.mod h1:IshRmMJBhDfFj5Y67nVhMYTTIze91RUeT73ipWKs/GY= contrib.go.opencensus.io/exporter/prometheus v0.4.0 h1:0QfIkj9z/iVZgK31D9H9ohjjIDApI2GOPScCKwxedbs= contrib.go.opencensus.io/exporter/prometheus v0.4.0/go.mod h1:o7cosnyfuPVK0tB8q0QmaQNhGnptITnPQB+z1+qeFB0= +contrib.go.opencensus.io/exporter/zipkin v0.1.2 h1:YqE293IZrKtqPnpwDPH/lOqTWD/s3Iwabycam74JV3g= contrib.go.opencensus.io/exporter/zipkin v0.1.2/go.mod h1:mP5xM3rrgOjpn79MM8fZbj3gsxcuytSqtH0dxSWW1RE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= @@ -200,6 +203,7 @@ github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudevents/conformance v0.2.0 h1:NvSXOKlagcsOWMEbi8U7Ex/0oQ4JZE1HQ45bnxYf2zk= github.com/cloudevents/conformance v0.2.0/go.mod h1:rHKDwylBH89Rns6U3wL9ww8bg9/4GbwRCDNuyoC6bcc= github.com/cloudevents/sdk-go/observability/opencensus/v2 v2.4.1/go.mod h1:lhEpxMrIUkeu9rVRgoAbyqZ8GR8Hd3DUy+thHUxAHoI= github.com/cloudevents/sdk-go/v2 v2.4.1 h1:rZJoz9QVLbWQmnvLPDFEmv17Czu+CfSPwMO6lhJ72xQ= @@ -207,10 +211,12 @@ github.com/cloudevents/sdk-go/v2 v2.4.1/go.mod h1:MZiMwmAh5tGj+fPFvtHv9hKurKqXtd github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 h1:hzAQntlaYRkVSFEfj9OTWlVV1H155FMD8BTKktLv0QI= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 h1:zH8ljVhhq7yC0MIeUL/IviMtY8hx2mK8cN9wEYb8ggw= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= @@ -388,7 +394,9 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021 h1:fP+fF0up6oPY49OrjPrhIJ8yQfdIM85NXMLkMg1EXVs= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -434,8 +442,9 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= -github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -492,7 +501,6 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-training/helloworld v0.0.0-20200225145412-ba5f4379d78b/go.mod h1:hGGmX3bRUkYkc9aKA6mkUxi6d+f1GmZF1je0FlVTgwU= github.com/gobuffalo/flect v0.2.3/go.mod h1:vmkQwuZYhN5Pc4ljYQZzP+1sq+NEkK+lh20jmEmX3jc= -github.com/gobuffalo/flect v0.2.4/go.mod h1:1ZyCLIbg0YD7sDkzvFdPoOydPtD8y9JQnrOROolUcM8= github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM= github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= @@ -617,6 +625,7 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ 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/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1 h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/googleapis/gnostic v0.5.3 h1:2qsuRm+bzgwSIKikigPASa2GhW8H2Dn4Qq7UxD8K/48= @@ -916,6 +925,7 @@ github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrap github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.0-beta.2 h1:f/g66OWmYXmVnYL3UAhqpM9YuWKFR2vjYfFNSDQcHPQ= github.com/pelletier/go-toml/v2 v2.0.0-beta.2/go.mod h1:+X+aW6gUj6Hda43TeYHVCIvYNG/jqY/8ZFXAeXXHl+Q= github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= @@ -1125,6 +1135,7 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= @@ -1293,9 +1304,8 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211020060615-d418f374d309 h1:A0lJIi+hcTR6aajJH4YqKWwohY4aW9RO7oRMcdv+HKI= golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211101193420-4a448f8816b3 h1:VrJZAjbekhoRn7n5FBujY31gboH+iB3pdLxn3gE9FjU= -golang.org/x/net v0.0.0-20211101193420-4a448f8816b3/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1314,8 +1324,8 @@ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5 h1:v79phzBz03tsVCUTbvTBmmC3CUXF5mKYt7DA4ZVldpM= -golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1433,8 +1443,10 @@ golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 h1:TyHqChC80pFkXWraUUf6RuB5IqFdQieMLwwCJokV2pc= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE= @@ -1526,8 +1538,9 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w= +golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1573,8 +1586,8 @@ google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqiv google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= google.golang.org/api v0.58.0/go.mod h1:cAbP2FsxoGVNwtgNAmmn3y5G1TWAiVYRmg4yku3lv+E= -google.golang.org/api v0.60.0 h1:eq/zs5WPH4J9undYM9IP1O7dSr7Yh8Y0GtSCpzGzIUk= -google.golang.org/api v0.60.0/go.mod h1:d7rl65NZAkEQ90JFzqBjcRq1TVeG5ZoGV3sSpEnnVb4= +google.golang.org/api v0.61.0 h1:TXXKS1slM3b2bZNJwD5DV/Tp6/M2cLzLOLh9PjDhrw8= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1647,9 +1660,10 @@ google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211016002631-37fc39342514/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211027162914-98a5263abeca h1:+e+aQDO4/c9KaG8PXWHTc6/+Du6kz+BKcXCSnV4SSTE= google.golang.org/genproto v0.0.0-20211027162914-98a5263abeca/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12 h1:DN5b3HU13J4sMd/QjDx34U6afpaexKTDdop+26pdjdk= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1762,6 +1776,7 @@ k8s.io/api v0.21.0/go.mod h1:+YbrhBBGgsxbF6o6Kj4KJPJnBmAKuXDeS3E18bgHNVU= k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s= k8s.io/api v0.21.4 h1:WtDkzTAuI31WZKDPeIYpEUA+WeUfXAmA7gwj6nzFfbc= k8s.io/api v0.21.4/go.mod h1:fTVGP+M4D8+00FN2cMnJqk/eb/GH53bvmNs2SVTmpFk= +k8s.io/apiextensions-apiserver v0.21.4 h1:HkajN/vmT/9HnFmUxvpXfSGkTCvH/ax4e3+j6mqWUDU= k8s.io/apiextensions-apiserver v0.21.4/go.mod h1:OoC8LhI9LnV+wKjZkXIBbLUwtnOGJiTRE33qctH5CIk= k8s.io/apimachinery v0.21.4 h1:KDq0lWZVslHkuE5I7iGAQHwpK0aDTlar1E7IWEc4CNw= k8s.io/apimachinery v0.21.4/go.mod h1:H/IM+5vH9kZRNJ4l3x/fXP/5bOPJaVP/guptnZPeCFI= @@ -1803,8 +1818,9 @@ k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= -k8s.io/klog/v2 v2.30.0 h1:bUO6drIvCIsvZ/XFgfxoGFQU/a4Qkh0iAlvUR7vlHJw= k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.40.1 h1:P4RRucWk/lFOlDdkAr3mc7iWFkgKrZY9qZMAgek06S4= +k8s.io/klog/v2 v2.40.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 h1:vEx13qjvaZ4yfObSSXW7BrMc/KQBBT/Jyee8XtLf4x0= k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= @@ -1816,23 +1832,24 @@ k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ knative.dev/caching v0.0.0-20211101215439-72577a3c0ce1/go.mod h1:hz6tnVAmRLvPoprw+0wsA9IrZC3MF5l2Hn/2JT28Yk0= knative.dev/client v0.27.0 h1:qZkdFFCjPDsQrfHQMd1vPanDxEVloEJeUrrC3a52pK4= knative.dev/client v0.27.0/go.mod h1:FmXziLwolJtqaH3Jxe8cxqWjBUHXU6LsRsMyzlMSFFM= -knative.dev/eventing v0.27.0 h1:P9rqKvsCeFb8sEhfK32WFTG7awdOAa7XO6p3umSq/wU= knative.dev/eventing v0.27.0/go.mod h1:4ppWQEQ/2B66/YFENDmV1Gjxs4meLpz6UTUgLkkINt4= +knative.dev/eventing v0.27.2 h1:Zslo5WhIxAHAztLjoSCcnW52SNO2hIumK9dMp9V/Zc8= +knative.dev/eventing v0.27.2/go.mod h1:k/Xt54hNh9YfMSYdMTkJ0TNrkwU9hL+Frn+n9zsAdaE= knative.dev/hack v0.0.0-20211101195839-11d193bf617b/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= -knative.dev/hack v0.0.0-20211102174540-b284d49386cc/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= -knative.dev/hack v0.0.0-20211104075903-0f69979bbb7d h1:osgDQ4YarclNcFctyQULF/coJhzvAMOTjyBgPHLclso= -knative.dev/hack v0.0.0-20211104075903-0f69979bbb7d/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= +knative.dev/hack v0.0.0-20211112152736-4de3924914b2/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= +knative.dev/hack v0.0.0-20211122163517-fe1340f21191 h1:yRUruaFxjk6tkubtg44Nya0phUm1idKZr5bFO30AkmE= +knative.dev/hack v0.0.0-20211122163517-fe1340f21191/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack/schema v0.0.0-20211101195839-11d193bf617b/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= +knative.dev/hack/schema v0.0.0-20211122163517-fe1340f21191/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= +knative.dev/networking v0.0.0-20211101215640-8c71a2708e7d h1:nCnuNfcLWuyAdZYgVfwSooa3+p2ebx+V+qhGXXF/FIk= knative.dev/networking v0.0.0-20211101215640-8c71a2708e7d/go.mod h1:7SKKM4MsBANrXNRZhb/zMkNjTdxYbNjwQDWgu+Fyye4= -knative.dev/networking v0.0.0-20211104064801-6871f98f7b4d h1:tUUVM7awGZgLrd0ysguiVlzGCMpPk4Zp3Ec2qQcKgx0= -knative.dev/networking v0.0.0-20211104064801-6871f98f7b4d/go.mod h1:gP1Wha/MhUkANNu5ac2nINkH+fh/TtIU54105JxmA9I= +knative.dev/pkg v0.0.0-20211101212339-96c0204a70dc h1:ldjbTpoMXUTgzw0IJsAFLdyA6/6QYRvz8IGPZOknEDg= knative.dev/pkg v0.0.0-20211101212339-96c0204a70dc/go.mod h1:SkfDk9bWIiNZD7XtILGkG7AKVyF/M6M0bGxLgl0SYL8= -knative.dev/pkg v0.0.0-20211103135647-464034912f7e/go.mod h1:a+9AWOb0zOaBVU6xoPgTvEA7vfMnLjPnK4SX3ciSHKE= -knative.dev/pkg v0.0.0-20211104080002-e7547eabc6ee h1:XEXEhaQVGWFEYyLqs74jiXMlT9waIfMKphGTSMg0pno= -knative.dev/pkg v0.0.0-20211104080002-e7547eabc6ee/go.mod h1:EKhRrRSAHrnJwQPfgUyrmHgLCam9xcRh79t+G3MJu4k= +knative.dev/reconciler-test v0.0.0-20211101214439-9839937c9b13 h1:PgMCfHECOrYopm3P9s2Xq0Hl/MeBI0RoZ/dBH0a3X2g= knative.dev/reconciler-test v0.0.0-20211101214439-9839937c9b13/go.mod h1:gTsbLk496j/M9xqMpx/liyCQ0X3bwDpRtcs2Zzws364= -knative.dev/serving v0.27.0 h1:pstGHQ8aSJsIwdofkjJV6TrmPN09u/2qN1Mgfc92LQs= knative.dev/serving v0.27.0/go.mod h1:Lcqv3K/DeDt6ZoeWTgpjxc/0teS7uMebnnU+gXIw99c= +knative.dev/serving v0.27.1 h1:d3cazLiXkvFIcqPYGlV+qvGkMdqb5yI6kiw0FovC4dc= +knative.dev/serving v0.27.1/go.mod h1:70KmpwlBztk82pHmwRUkPGasQChFmefUyZWMDOzEoKk= pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= 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= diff --git a/hack/tools.go b/hack/tools.go index 6387f7507..9da773125 100644 --- a/hack/tools.go +++ b/hack/tools.go @@ -24,4 +24,8 @@ import ( // For Mage stuff _ "github.com/magefile/mage/mage" + + // Test images + _ "knative.dev/eventing/test/test_images/wathola-forwarder" + _ "knative.dev/reconciler-test/cmd/eventshub" ) diff --git a/pkg/k8s/addressresolver_test.go b/pkg/k8s/addressresolver_test.go index ab42aaa0c..2e8f3b475 100644 --- a/pkg/k8s/addressresolver_test.go +++ b/pkg/k8s/addressresolver_test.go @@ -1,43 +1,19 @@ package k8s_test import ( - "errors" - "fmt" - "net/url" - "strings" "testing" - "gotest.tools/v3/assert" - corev1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/intstr" clienttest "knative.dev/client/lib/test" - eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" - eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" - messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" "knative.dev/kn-plugin-event/pkg/k8s" + k8stest "knative.dev/kn-plugin-event/pkg/k8s/test" "knative.dev/kn-plugin-event/pkg/tests" - netpkg "knative.dev/networking/pkg" - "knative.dev/pkg/apis" - duckv1 "knative.dev/pkg/apis/duck/v1" - "knative.dev/pkg/kmeta" - "knative.dev/pkg/tracker" - "knative.dev/serving/pkg/apis/serving" - servingv1 "knative.dev/serving/pkg/apis/serving/v1" -) - -var ( - ErrNotEqual = errors.New("not equal") - ErrDontContain = errors.New("don't contain") - ErrNotDomainLocal = errors.New("not a cluster local URL") ) func TestResolveAddress(t *testing.T) { ns := clienttest.NextNamespace() - resolveAddressTestCases(ns, func(tc resolveAddressTestCase) { - t.Run(tc.name, func(t *testing.T) { - performResolveAddressTest(t, tc, func() (k8s.Clients, func(tb testing.TB)) { + k8stest.ResolveAddressTestCases(ns, func(tc k8stest.ResolveAddressTestCase) { + t.Run(tc.Name, func(t *testing.T) { + k8stest.EnsureResolveAddress(t, tc, func() (k8s.Clients, func(tb testing.TB)) { return fakeClients(t, tc), noCleanup }) }) @@ -48,269 +24,10 @@ func noCleanup(tb testing.TB) { tb.Helper() // do nothing } -// performResolveAddressTest thelper lint skipped for greater visibility of -// failure location. -func performResolveAddressTest( //nolint:thelper - tb testing.TB, - tc resolveAddressTestCase, - clientsFn func() (k8s.Clients, func(tb testing.TB)), -) { - uri := &apis.URL{} - clients, cleanup := clientsFn() - defer cleanup(tb) - resolver := k8s.CreateAddressResolver(clients) - u, err := resolver.ResolveAddress(tc.ref, uri) - if tc.err != nil { - assert.ErrorType(tb, err, tc.err) - } else { - assert.Equal(tb, err, nil) - } - assert.NilError(tb, tc.matches(u)) -} - -func resolveAddressTestCases(namespace string, casefn func(tc resolveAddressTestCase)) { - tcs := []resolveAddressTestCase{ - k8sService(namespace), - knService(namespace, true), - knService(namespace, false), - mtBroker(namespace), - channel(namespace), - } - for _, tc := range tcs { - casefn(tc) - } -} - -func k8sService(namespace string) resolveAddressTestCase { - svc := corev1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "k8s-hello", - Namespace: namespace, - }, - Spec: corev1.ServiceSpec{ - Ports: []corev1.ServicePort{{ - Name: "http", - Port: 80, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 8080, - }, - }}, - Type: corev1.ServiceTypeClusterIP, - }, - } - svc.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind("Service")) - want := apis.HTTP(fmt.Sprintf("k8s-hello.%s.svc.cluster.local", namespace)) - return resolveAddressTestCase{ - name: "k8s-service", - matches: equals(want), - err: nil, - ref: toTrackerRef(&svc), - objects: []runtime.Object{&svc}, - } -} - -func knService(namespace string, clusterLocal bool) resolveAddressTestCase { - m := matcher{ - isClusterLocal: clusterLocal, - name: "kn-hello", - namespace: namespace, - } - labels := map[string]string{} - if clusterLocal { - m.name = fmt.Sprintf("%s-cl", m.name) - labels[netpkg.VisibilityLabelKey] = serving.VisibilityClusterLocal - } - clusterLocalURL := apis.HTTP(fmt.Sprintf( - "%s.%s.svc.cluster.local", m.name, namespace)) - m.clusterLocalURL = clusterLocalURL - publicURL := apis.HTTP(fmt.Sprintf( - "%s-%s.apps.cloud.example.org", m.name, namespace)) - serviceURL := publicURL - if clusterLocal { - serviceURL = clusterLocalURL - } - ksvc := servingv1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: m.name, Namespace: namespace, Labels: labels, - }, - Spec: ksvcSpec("gcr.io/knative-samples/helloworld-go"), - Status: servingv1.ServiceStatus{ - RouteStatusFields: servingv1.RouteStatusFields{ - URL: serviceURL, - Address: &duckv1.Addressable{ - URL: clusterLocalURL, - }, - }, - }, - } - ksvc.SetGroupVersionKind(servingv1.SchemeGroupVersion.WithKind("Service")) - return resolveAddressTestCase{ - name: m.name, - matches: m.matches, - err: nil, - ref: toTrackerRef(&ksvc), - objects: []runtime.Object{&ksvc}, - } -} - -func mtBroker(namespace string) resolveAddressTestCase { - name := "test" - u := apis.HTTP("broker-ingress.knative-eventing.svc.cluster.local") - u.Path = fmt.Sprintf("/%s/%s", namespace, name) - br := eventingv1.Broker{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, Namespace: namespace, - }, - Status: eventingv1.BrokerStatus{ - Address: duckv1.Addressable{URL: u}, - }, - } - br.SetGroupVersionKind(eventingv1.SchemeGroupVersion.WithKind("Broker")) - return resolveAddressTestCase{ - name: "mt-broker", - err: nil, - ref: toTrackerRef(&br), - matches: equals(u), - objects: []runtime.Object{&br}, - } -} - -func channel(namespace string) resolveAddressTestCase { - name := "test" - u := apis.HTTP( - fmt.Sprintf("%s-kn-channel.%s.svc.cluster.local", name, namespace)) - ch := messagingv1.Channel{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, Namespace: namespace, - }, - Status: messagingv1.ChannelStatus{ - ChannelableStatus: eventingduckv1.ChannelableStatus{ - AddressStatus: duckv1.AddressStatus{ - Address: &duckv1.Addressable{URL: u}, - }, - }, - }, - } - ch.SetGroupVersionKind(messagingv1.SchemeGroupVersion.WithKind("Channel")) - return resolveAddressTestCase{ - name: "channel", - err: nil, - ref: toTrackerRef(&ch), - matches: equals(u), - objects: []runtime.Object{&ch}, - } -} - -func toTrackerRef(accessor kmeta.Accessor) *tracker.Reference { - gvk := accessor.GroupVersionKind() - return &tracker.Reference{ - APIVersion: gvk.GroupVersion().String(), - Kind: gvk.Kind, - Namespace: accessor.GetNamespace(), - Name: accessor.GetName(), - Selector: nil, - } -} - -type matcher struct { - clusterLocalURL *apis.URL - isClusterLocal bool - name string - namespace string -} - -func (m matcher) matches(u *url.URL) error { - if m.isClusterLocal { - if u.String() != m.clusterLocalURL.String() { - return fmt.Errorf("%w: got: %v, want: %v", ErrNotEqual, u, m.clusterLocalURL) - } - return nil - } - if !strings.Contains(u.Host, m.name) { - return fmt.Errorf("%w: expect %v to contain %v", ErrDontContain, u, m.name) - } - if !strings.Contains(u.Host, m.namespace) { - return fmt.Errorf("%w: expect %v to contain %v", ErrDontContain, u, m.namespace) - } - return check(u, - m.containsName, - m.containsNamespace, - m.differsFromClusterLocalURL, - ) -} - -func (m matcher) containsName(u *url.URL) error { - return hostContains(u, m.name) -} - -func (m matcher) containsNamespace(u *url.URL) error { - return hostContains(u, m.namespace) -} - -func hostContains(u *url.URL, needle string) error { - if !strings.Contains(u.Host, needle) { - return fmt.Errorf("%w: expect %v to contain %#v", - ErrDontContain, u, needle) - } - return nil -} - -func (m matcher) differsFromClusterLocalURL(u *url.URL) error { - if u.String() == m.clusterLocalURL.String() { - return fmt.Errorf("%w: expect %v to differ from cluster local URL %v", - ErrNotDomainLocal, u, m.clusterLocalURL) - } - return nil -} - -func check(u *url.URL, fns ...func(*url.URL) error) error { - for _, fn := range fns { - err := fn(u) - if err != nil { - return err - } - } - return nil -} - -func equals(u *apis.URL) func(url *url.URL) error { - return func(url *url.URL) error { - if u.String() != url.String() { - return fmt.Errorf("%w: got %v, want %v", ErrNotEqual, url, u) - } - return nil - } -} - -func ksvcSpec(image string) servingv1.ServiceSpec { - return servingv1.ServiceSpec{ - ConfigurationSpec: servingv1.ConfigurationSpec{ - Template: servingv1.RevisionTemplateSpec{ - Spec: servingv1.RevisionSpec{ - PodSpec: corev1.PodSpec{ - Containers: []corev1.Container{{ - Image: image, - }}, - }, - }, - }, - }, - } -} - -func fakeClients(tb testing.TB, tc resolveAddressTestCase) k8s.Clients { +func fakeClients(tb testing.TB, tc k8stest.ResolveAddressTestCase) k8s.Clients { tb.Helper() return &tests.FakeClients{ - Objects: tc.objects, + Objects: tc.Objects, TB: tb, } } - -type resolveAddressTestCase struct { - name string - matches func(url *url.URL) error - err error - ref *tracker.Reference - objects []runtime.Object -} diff --git a/pkg/k8s/test/addressresolver_cases.go b/pkg/k8s/test/addressresolver_cases.go new file mode 100644 index 000000000..0eb65ebd2 --- /dev/null +++ b/pkg/k8s/test/addressresolver_cases.go @@ -0,0 +1,271 @@ +package test + +import ( + "errors" + "fmt" + "net/url" + "strings" + "testing" + + "gotest.tools/v3/assert" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/intstr" + eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" + eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" + messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" + "knative.dev/kn-plugin-event/pkg/k8s" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/kmeta" + "knative.dev/pkg/tracker" + servingv1 "knative.dev/serving/pkg/apis/serving/v1" +) + +const ( + // HTTPPort is 80. + HTTPPort = 80 + + // AlternativeHTTPPort is 8080. + AlternativeHTTPPort = 8080 +) + +var ( + ErrNotEqual = errors.New("not equal") + ErrDontContain = errors.New("don't contain") +) + +func ResolveAddressTestCases(namespace string, casefn func(tc ResolveAddressTestCase)) { + tcs := []ResolveAddressTestCase{ + k8sService(namespace), + knService(namespace), + mtBroker(namespace), + channel(namespace), + } + for _, tc := range tcs { + casefn(tc) + } +} + +// EnsureResolveAddress thelper lint skipped for greater visibility of +// failure location. +func EnsureResolveAddress( //nolint:thelper + tb testing.TB, + tc ResolveAddressTestCase, + clientsFn func() (k8s.Clients, func(tb testing.TB)), +) { + uri := &apis.URL{} + clients, cleanup := clientsFn() + defer cleanup(tb) + resolver := k8s.CreateAddressResolver(clients) + u, err := resolver.ResolveAddress(tc.ref, uri) + if tc.err != nil { + assert.ErrorType(tb, err, tc.err) + } else { + assert.Equal(tb, err, nil) + } + assert.NilError(tb, tc.matches(u)) +} + +type ResolveAddressTestCase struct { + Name string + matches func(url *url.URL) error + err error + ref *tracker.Reference + Objects []runtime.Object +} + +func k8sService(namespace string) ResolveAddressTestCase { + svc := corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: "k8s-hello", + Namespace: namespace, + }, + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{{ + Name: "http", + Port: HTTPPort, + TargetPort: intstr.IntOrString{ + Type: intstr.Int, + IntVal: AlternativeHTTPPort, + }, + }}, + Type: corev1.ServiceTypeClusterIP, + }, + } + svc.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind("Service")) + want := apis.HTTP(fmt.Sprintf("k8s-hello.%s.svc.cluster.local", namespace)) + return ResolveAddressTestCase{ + Name: "k8s-service", + matches: equals(want), + err: nil, + ref: toTrackerRef(&svc), + Objects: []runtime.Object{&svc}, + } +} + +func knService(namespace string) ResolveAddressTestCase { + m := matcher{ + name: "kn-hello", + namespace: namespace, + } + labels := map[string]string{} + clusterLocalURL := apis.HTTP(fmt.Sprintf( + "%s.%s.svc.cluster.local", m.name, namespace)) + m.url = clusterLocalURL + publicURL := apis.HTTP(fmt.Sprintf( + "%s-%s.apps.cloud.example.org", m.name, namespace)) + serviceURL := publicURL + ksvc := servingv1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: m.name, Namespace: namespace, Labels: labels, + }, + Spec: ksvcSpec("gcr.io/knative-samples/helloworld-go"), + Status: servingv1.ServiceStatus{ + RouteStatusFields: servingv1.RouteStatusFields{ + URL: serviceURL, + Address: &duckv1.Addressable{ + URL: clusterLocalURL, + }, + }, + }, + } + ksvc.SetGroupVersionKind(servingv1.SchemeGroupVersion.WithKind("Service")) + return ResolveAddressTestCase{ + Name: m.name, + matches: m.matches, + err: nil, + ref: toTrackerRef(&ksvc), + Objects: []runtime.Object{&ksvc}, + } +} + +func mtBroker(namespace string) ResolveAddressTestCase { + name := "test" + u := apis.HTTP("broker-ingress.knative-eventing.svc.cluster.local") + u.Path = fmt.Sprintf("/%s/%s", namespace, name) + br := eventingv1.Broker{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, Namespace: namespace, + }, + Status: eventingv1.BrokerStatus{ + Address: duckv1.Addressable{URL: u}, + }, + } + br.SetGroupVersionKind(eventingv1.SchemeGroupVersion.WithKind("Broker")) + return ResolveAddressTestCase{ + Name: "mt-broker", + err: nil, + ref: toTrackerRef(&br), + matches: equals(u), + Objects: []runtime.Object{&br}, + } +} + +func channel(namespace string) ResolveAddressTestCase { + name := "test" + u := apis.HTTP( + fmt.Sprintf("%s-kn-channel.%s.svc.cluster.local", name, namespace)) + ch := messagingv1.Channel{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, Namespace: namespace, + }, + Status: messagingv1.ChannelStatus{ + ChannelableStatus: eventingduckv1.ChannelableStatus{ + AddressStatus: duckv1.AddressStatus{ + Address: &duckv1.Addressable{URL: u}, + }, + }, + }, + } + ch.SetGroupVersionKind(messagingv1.SchemeGroupVersion.WithKind("Channel")) + return ResolveAddressTestCase{ + Name: "channel", + err: nil, + ref: toTrackerRef(&ch), + matches: equals(u), + Objects: []runtime.Object{&ch}, + } +} + +func toTrackerRef(accessor kmeta.Accessor) *tracker.Reference { + gvk := accessor.GroupVersionKind() + return &tracker.Reference{ + APIVersion: gvk.GroupVersion().String(), + Kind: gvk.Kind, + Namespace: accessor.GetNamespace(), + Name: accessor.GetName(), + Selector: nil, + } +} + +type matcher struct { + url *apis.URL + name string + namespace string +} + +func (m matcher) matches(u *url.URL) error { + if !strings.Contains(u.Host, m.name) { + return fmt.Errorf("%w: expect %v to contain %v", ErrDontContain, u, m.name) + } + if !strings.Contains(u.Host, m.namespace) { + return fmt.Errorf("%w: expect %v to contain %v", ErrDontContain, u, m.namespace) + } + return check(u, + m.containsName, + m.containsNamespace, + ) +} + +func (m matcher) containsName(u *url.URL) error { + return hostContains(u, m.name) +} + +func (m matcher) containsNamespace(u *url.URL) error { + return hostContains(u, m.namespace) +} + +func hostContains(u *url.URL, needle string) error { + if !strings.Contains(u.Host, needle) { + return fmt.Errorf("%w: expect %v to contain %#v", + ErrDontContain, u, needle) + } + return nil +} + +func check(u *url.URL, fns ...func(*url.URL) error) error { + for _, fn := range fns { + err := fn(u) + if err != nil { + return err + } + } + return nil +} + +func equals(u *apis.URL) func(url *url.URL) error { + return func(url *url.URL) error { + if u.String() != url.String() { + return fmt.Errorf("%w: got %v, want %v", ErrNotEqual, url, u) + } + return nil + } +} + +func ksvcSpec(image string) servingv1.ServiceSpec { + return servingv1.ServiceSpec{ + ConfigurationSpec: servingv1.ConfigurationSpec{ + Template: servingv1.RevisionTemplateSpec{ + Spec: servingv1.RevisionSpec{ + PodSpec: corev1.PodSpec{ + Containers: []corev1.Container{{ + Image: image, + }}, + }, + }, + }, + }, + } +} diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh new file mode 100755 index 000000000..bb3cd4586 --- /dev/null +++ b/test/e2e-tests.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +set -Eeo pipefail + +source "$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]:-$0}")")")/vendor/knative.dev/hack/e2e-tests.sh" + +function start_latest_knative_serving() { + local KNATIVE_NET_KOURIER_RELEASE + KNATIVE_NET_KOURIER_RELEASE="$(get_latest_knative_yaml_source "net-kourier" "kourier")" + start_knative_serving "${KNATIVE_SERVING_RELEASE_CRDS}" \ + "${KNATIVE_SERVING_RELEASE_CORE}" \ + "${KNATIVE_NET_KOURIER_RELEASE}" + + kubectl patch configmap/config-network \ + --namespace knative-serving \ + --type merge \ + --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}' +} + +function knative_setup() { + start_latest_knative_serving + start_latest_knative_eventing +} + +initialize "$@" + +set -Eeuo pipefail + +./mage publish + +go_test_e2e ./test/... + +success diff --git a/test/e2e/ics_send.go b/test/e2e/ics_send.go new file mode 100644 index 000000000..9018e1ae4 --- /dev/null +++ b/test/e2e/ics_send.go @@ -0,0 +1,141 @@ +//go:build e2e +// +build e2e + +package e2e + +import ( + "context" + "fmt" + "strings" + + cloudevents "github.com/cloudevents/sdk-go/v2" + cetest "github.com/cloudevents/sdk-go/v2/test" + "gotest.tools/v3/icmd" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/kn-plugin-event/test" + kubeclient "knative.dev/pkg/client/injection/kube/client" + "knative.dev/pkg/logging" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/eventshub/assert" + "knative.dev/reconciler-test/pkg/feature" + "sigs.k8s.io/yaml" +) + +func sendEventFeature(featureName string, opts sendEventOptions) *feature.Feature { + f := feature.NewFeatureNamed(featureName) + sinkName := feature.MakeRandomK8sName("sink") + ev := cetest.FullEvent() + ev.SetID(feature.MakeRandomK8sName("test-event")) + + f.Setup("deploy sink", eventshub.Install(sinkName, eventshub.StartReceiver)) + + f.Alpha("Event"). + Must("send", sendEvent(ev, opts.sink(sinkName))). + Must("receive", receiveEvent(ev, sinkName)) + + for _, st := range opts.steps { + f = st(f, sinkName) + } + + return f +} + +type ( + sinkProducer func(string) string + step func(*feature.Feature, string) *feature.Feature +) + +type sendEventOptions struct { + sink sinkProducer + steps []step +} + +func sinkFormat(format string) sinkProducer { + return func(sinkName string) string { + return fmt.Sprintf(format, sinkName) + } +} + +func sendEvent(ev cloudevents.Event, sink string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + log := logging.FromContext(ctx) + ns := environment.FromContext(ctx).Namespace() + args := []string{ + "send", + "--id", ev.ID(), + "--source", ev.Source(), + "--type", ev.Type(), + "--namespace", ns, + "--sender-namespace", ns, + "--field", fmt.Sprintf("data=%s", ev.Data()), + "--to", sink, + } + cmd := test.ResolveKnEventCommand(t).ToIcmd(args...) + log.Infof("Running command: %v", cmd) + result := icmd.RunCmd(cmd) + err := result.Compare(icmd.Expected{ + ExitCode: 0, + Out: fmt.Sprintf("Event (ID: %s) have been sent.", ev.ID()), + }) + handleSendErr(ctx, t, err, ev) + } +} + +func receiveEvent(ev cloudevents.Event, sinkName string) feature.StepFn { + return assert.OnStore(sinkName). + MatchEvent(cetest.HasId(ev.ID())). + Exact(1) +} + +// handleSendErr TODO: most of this code should be moved to production CLI, so +// that in case of send error, a nice, report is produced. +// See: https://github.com/knative-sandbox/kn-plugin-event/issues/129 +func handleSendErr(ctx context.Context, t feature.T, err error, ev cloudevents.Event) { + if err == nil { + return + } + kube := kubeclient.Get(ctx) + ns := environment.FromContext(ctx).Namespace() + log := logging.FromContext(ctx) + jobs := kube.BatchV1().Jobs(ns) + pods := kube.CoreV1().Pods(ns) + events := kube.CoreV1().Events(ns) + jlist, kerr := jobs.List(ctx, metav1.ListOptions{ + LabelSelector: fmt.Sprintf("event-id=%s", ev.ID()), + }) + if kerr != nil { + log.Error(kerr) + } + jobName := jlist.Items[0].Name + plist, kerr := pods.List(ctx, metav1.ListOptions{ + LabelSelector: fmt.Sprintf("job-name=%s", jobName), + }) + if kerr != nil { + log.Error(kerr) + } + podLogs := make([]string, 0, len(plist.Items)) + for _, item := range plist.Items { + var bytes []byte + bytes, kerr = pods.GetLogs(item.Name, nil).DoRaw(ctx) + if kerr != nil { + log.Error(kerr) + } + podLogs = append(podLogs, string(bytes)) + } + podsYaml, merr := yaml.Marshal(plist.Items) + if merr != nil { + log.Error(merr) + } + elist, eerr := events.List(ctx, metav1.ListOptions{}) + if eerr != nil { + log.Error(eerr) + } + eventsYaml, eerr := yaml.Marshal(elist.Items) + if eerr != nil { + log.Error(eerr) + } + t.Fatal(err, "\n\nJob logs (", len(plist.Items), "):\n", + strings.Join(podLogs, "\n---\n"), "\n\nPods:\n", + string(podsYaml), "\n\nEvents:\n", string(eventsYaml)) +} diff --git a/test/e2e/ics_send_test.go b/test/e2e/ics_send_test.go new file mode 100644 index 000000000..442e2755e --- /dev/null +++ b/test/e2e/ics_send_test.go @@ -0,0 +1,32 @@ +//go:build e2e +// +build e2e + +package e2e_test + +import ( + "testing" + + "knative.dev/kn-plugin-event/test" + "knative.dev/kn-plugin-event/test/e2e" + "knative.dev/reconciler-test/pkg/environment" + reconcilertestk8s "knative.dev/reconciler-test/pkg/k8s" + "knative.dev/reconciler-test/pkg/knative" +) + +func TestInClusterSender(t *testing.T) { + test.MaybeSkip(t) + e2e.RegisterPackages() + + t.Parallel() + + ctx, env := global.Environment( + environment.Managed(t), + reconcilertestk8s.WithEventListener, + knative.WithKnativeNamespace("knative-eventing"), + knative.WithLoggingConfig, + knative.WithTracingConfig, + ) + + env.Test(ctx, t, e2e.SendEventToKubeService()) + env.Test(ctx, t, e2e.SendEventToKnService()) +} diff --git a/test/e2e/k8s_service.go b/test/e2e/k8s_service.go new file mode 100644 index 000000000..ff62e4cbd --- /dev/null +++ b/test/e2e/k8s_service.go @@ -0,0 +1,16 @@ +//go:build e2e +// +build e2e + +package e2e + +import ( + "knative.dev/reconciler-test/pkg/feature" +) + +// SendEventToKubeService returns a feature.Feature that verifies the kn-event +// can send to Kubernetes service. +func SendEventToKubeService() *feature.Feature { + return sendEventFeature("ToKubeService", sendEventOptions{ + sink: sinkFormat("Service:v1:%s"), + }) +} diff --git a/test/e2e/kn_service.go b/test/e2e/kn_service.go new file mode 100644 index 000000000..ffb4cc4c6 --- /dev/null +++ b/test/e2e/kn_service.go @@ -0,0 +1,169 @@ +//go:build e2e +// +build e2e + +package e2e + +import ( + "bytes" + "context" + "embed" + "fmt" + "os" + "path" + "text/template" + + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/apis" + kubeclient "knative.dev/pkg/client/injection/kube/client" + "knative.dev/pkg/injection" + "knative.dev/pkg/kmeta" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/k8s" + servingv1 "knative.dev/serving/pkg/apis/serving/v1" + servingv1clientset "knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1" +) + +const watholaForwarderPackage = "knative.dev/eventing/test/test_images/wathola-forwarder" + +// RegisterPackages will register packages to be built into test images. +func RegisterPackages() { + environment.RegisterPackage(watholaForwarderPackage) +} + +// SendEventToKnService returns a feature.Feature that verifies the kn-event +// can send to Knative service. +func SendEventToKnService() *feature.Feature { + return sendEventFeature("ToKnativeService", sendEventOptions{ + sink: func(sinkName string) string { + return watholaForwarder{sinkName}.sinkSpec() + }, + steps: []step{ + func(f *feature.Feature, sinkName string) *feature.Feature { + f.Setup("deploy wathola-forwarder", + watholaForwarder{sinkName}.step) + return f + }, + }, + }) +} + +type watholaForwarder struct { + sinkName string +} + +func (wf watholaForwarder) step(ctx context.Context, t feature.T) { + wf.deployConfigMap(ctx, t) + wf.deployKnService(ctx, t) +} + +//go:embed wathola-forwarder.toml +var watholaForwarderConfigTemplate embed.FS + +func (wf watholaForwarder) deployConfigMap(ctx context.Context, t feature.T) { + env := environment.FromContext(ctx) + ns := env.Namespace() + tmpl, err := template.ParseFS(watholaForwarderConfigTemplate, + "wathola-forwarder.toml") + if err != nil { + t.Fatal(errors.WithStack(err)) + } + var buff bytes.Buffer + if err = tmpl.Execute(&buff, struct { + Sink *apis.URL + }{ + apis.HTTP(fmt.Sprintf("%s.%s.svc", wf.sinkName, ns)), + }); err != nil { + t.Fatal(errors.WithStack(err)) + } + kube := kubeclient.Get(ctx) + configMaps := kube.CoreV1().ConfigMaps(ns) + cm := &corev1.ConfigMap{ + ObjectMeta: metav1.ObjectMeta{Name: wf.name(), Namespace: ns}, + Data: map[string]string{ + path.Base(wf.configPath()): buff.String(), + }, + } + created, err := configMaps.Create(ctx, cm, metav1.CreateOptions{}) + if err != nil { + t.Fatal(errors.WithStack(err)) + } + env.Reference(kmeta.ObjectReference(created)) +} + +func (wf watholaForwarder) deployKnService(ctx context.Context, t feature.T) { + env := environment.FromContext(ctx) + ns := env.Namespace() + rest := injection.GetConfig(ctx) + ksvcs := servingv1clientset.NewForConfigOrDie(rest).Services(ns) + image := fmt.Sprintf("ko://%s", watholaForwarderPackage) + if replaced, found := env.Images()[image]; found { + image = replaced + } + const readyPath = "/healthz" + ksvc := &servingv1.Service{ + ObjectMeta: metav1.ObjectMeta{Name: wf.name(), Namespace: ns}, + Spec: servingv1.ServiceSpec{ + ConfigurationSpec: servingv1.ConfigurationSpec{ + Template: servingv1.RevisionTemplateSpec{ + Spec: servingv1.RevisionSpec{ + PodSpec: corev1.PodSpec{ + Containers: []corev1.Container{{ + Image: image, + ReadinessProbe: &corev1.Probe{ + Handler: corev1.Handler{ + HTTPGet: &corev1.HTTPGetAction{ + Path: readyPath, + }, + }, + }, + VolumeMounts: []corev1.VolumeMount{{ + Name: wf.name(), + MountPath: path.Dir(wf.configPath()), + ReadOnly: true, + }}, + }}, + Volumes: []corev1.Volume{{ + Name: wf.name(), + VolumeSource: corev1.VolumeSource{ + ConfigMap: &corev1.ConfigMapVolumeSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: wf.name(), + }, + }, + }, + }}, + }, + }, + }, + }, + }, + } + created, err := ksvcs.Create(ctx, ksvc, metav1.CreateOptions{}) + if err != nil { + t.Fatal(errors.WithStack(err)) + } + ref := kmeta.ObjectReference(created) + env.Reference(ref) + if err = k8s.WaitForServiceReady(ctx, t, wf.name(), readyPath); err != nil { + t.Fatal(errors.WithStack(err)) + } +} + +func (wf watholaForwarder) name() string { + return wf.sinkName + "-wathola-forwarder" +} + +func (wf watholaForwarder) sinkSpec() string { + return fmt.Sprintf("Service:serving.knative.dev/v1:%s", wf.name()) +} + +func (wf watholaForwarder) configPath() string { + homedir := "/home/nonroot" + if homedirEnv, ok := os.LookupEnv("KN_PLUGIN_EVENT_WATHOLA_HOMEDIR"); ok { + homedir = homedirEnv + } + return fmt.Sprintf("%s/.config/wathola/config.toml", homedir) +} diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go new file mode 100644 index 000000000..0d3588bea --- /dev/null +++ b/test/e2e/main_test.go @@ -0,0 +1,45 @@ +//go:build e2e +// +build e2e + +package e2e_test + +import ( + "flag" + "os" + "testing" + + // ref.: https://github.com/kubernetes/client-go/issues/242 + _ "k8s.io/client-go/plugin/pkg/client/auth" + "knative.dev/pkg/injection" + "knative.dev/reconciler-test/pkg/environment" +) + +// global is the singleton instance of GlobalEnvironment. It is used to parse +// the testing config for the test run. The config will specify the cluster +// config as well as the parsing level and state flags. +// nolint:gochecknoglobals +var global environment.GlobalEnvironment + +// TestMain is the first entry point for `go test`. +func TestMain(m *testing.M) { + // environment.InitFlags registers state and level filter flags. + environment.InitFlags(flag.CommandLine) + + // We get a chance to parse flags to include the framework flags for the + // framework as well as any additional flags included in the integration. + flag.Parse() + + // EnableInjectionOrDie will enable client injection, this is used by the + // testing framework for namespace management, and could be leveraged by + // features to pull Kubernetes clients or the test environment out of the + // context passed in the features. + ctx, startInformers := injection.EnableInjectionOrDie(nil, nil) // nolint + startInformers() + + // global is used to make instances of Environments, NewGlobalEnvironment + // is passing and saving the client injection enabled context for use later. + global = environment.NewGlobalEnvironment(ctx) + + // Run the tests. + os.Exit(m.Run()) +} diff --git a/test/e2e/wathola-forwarder.toml b/test/e2e/wathola-forwarder.toml new file mode 100644 index 000000000..c1e9e3180 --- /dev/null +++ b/test/e2e/wathola-forwarder.toml @@ -0,0 +1,2 @@ +[forwarder] +target = '{{- .Sink -}}' diff --git a/test/environment.go b/test/environment.go new file mode 100644 index 000000000..2b04d38e1 --- /dev/null +++ b/test/environment.go @@ -0,0 +1,69 @@ +package test + +import ( + "fmt" + "os" + "path" + "runtime" + "strings" + "testing" + + "gotest.tools/v3/icmd" +) + +// ResolveKnEventCommand will look for the kn event executable. Executable can +// be overridden by setting the environment variable: KN_PLUGIN_EVENT_EXECUTABLE +// Base args can be overridden by setting the environment variable: +// KN_PLUGIN_EVENT_EXECUTABLE_ARGS. +// +// Set: +// ``` +// KN_PLUGIN_EVENT_EXECUTABLE=/path/to/kn +// KN_PLUGIN_EVENT_EXECUTABLE_ARGS=event +// ``` +// to test kn-plugin-event as embedded in kn CLI. +func ResolveKnEventCommand(t TestingT) Command { + MaybeSkip(t) + bin := fmt.Sprintf("kn-event-%s-%s", runtime.GOOS, runtime.GOARCH) + c := Command{ + Executable: path.Join(rootDir(), "build", "_output", "bin", bin), + } + if val, ok := os.LookupEnv("KN_PLUGIN_EVENT_EXECUTABLE"); ok { + c.Executable = val + } + if val, ok := os.LookupEnv("KN_PLUGIN_EVENT_EXECUTABLE_ARGS"); ok { + c.Args = strings.Split(val, " ") + } + return c +} + +// Command represents a binary command to be executed. +type Command struct { + Executable string + Args []string +} + +// ToIcmd converts to icmd.Cmd. +func (c Command) ToIcmd(args ...string) icmd.Cmd { + args = append(c.Args, args...) + return icmd.Command(c.Executable, args...) +} + +func rootDir() string { + _, filename, _, _ := runtime.Caller(0) //nolint:dogsled + return path.Dir(path.Dir(filename)) +} + +// MaybeSkip should be called for integration tests. It will skip test if +// testing's short flag is being set. +func MaybeSkip(t TestingT) { + if testing.Short() { + t.Skipf("Short flag is set. Skipping %s.", t.Name()) + } +} + +// TestingT a subset of testing.T. +type TestingT interface { + Name() string + Skipf(format string, args ...interface{}) +} diff --git a/test/pkg/clients.go b/test/pkg/clients.go new file mode 100644 index 000000000..b8cff0bba --- /dev/null +++ b/test/pkg/clients.go @@ -0,0 +1,57 @@ +package pkg + +import ( + "errors" + "testing" + + "gotest.tools/v3/assert" + clienttest "knative.dev/client/lib/test" + "knative.dev/kn-plugin-event/pkg/event" + "knative.dev/kn-plugin-event/pkg/k8s" + plugintest "knative.dev/kn-plugin-event/test" +) + +// TestContext holds a test context. +type TestContext struct { + testing.TB + *clienttest.KnTest +} + +// ClientsContext holds a Kubernetes clients context. +type ClientsContext struct { + k8s.Clients + *TestContext +} + +// WithClients runs provided handler within a ClientsContext, so that the +// handler has access to configured k8s.Clients. +func WithClients(tb testing.TB, handler func(c ClientsContext)) { + tb.Helper() + plugintest.MaybeSkip(tb) + clients, err := k8s.CreateKubeClient(&event.Properties{}) + if err != nil && errors.Is(err, k8s.ErrNoKubernetesConnection) { + tb.Skip("AUTO-SKIP:", err) + } else { + assert.NilError(tb, err) + } + WithKnTest(tb, func(c *TestContext) { + handler(ClientsContext{ + TestContext: c, Clients: clients, + }) + }) +} + +// WithKnTest runs handler within a TestContext, so that the handler has access +// to clienttest.KnTest. +func WithKnTest(tb testing.TB, handler func(c *TestContext)) { + tb.Helper() + plugintest.MaybeSkip(tb) + it, err := clienttest.NewKnTest() + assert.NilError(tb, err) + tb.Cleanup(func() { + assert.NilError(tb, it.Teardown()) + }) + handler(&TestContext{ + TB: tb, KnTest: it, + }) +} diff --git a/pkg/k8s/addressresolver_e2e_test.go b/test/pkg/k8s/addressresolver_test.go similarity index 84% rename from pkg/k8s/addressresolver_e2e_test.go rename to test/pkg/k8s/addressresolver_test.go index c2b799d35..fd1d9dd6e 100644 --- a/pkg/k8s/addressresolver_e2e_test.go +++ b/test/pkg/k8s/addressresolver_test.go @@ -5,7 +5,6 @@ package k8s_test import ( "context" - "errors" "fmt" "testing" "time" @@ -17,53 +16,42 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/watch" - clienttest "knative.dev/client/lib/test" clienteventingv1 "knative.dev/client/pkg/eventing/v1" clientmessagingv1 "knative.dev/client/pkg/messaging/v1" clientservingv1 "knative.dev/client/pkg/serving/v1" clientwait "knative.dev/client/pkg/wait" eventingv1 "knative.dev/eventing/pkg/apis/eventing/v1" messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" - "knative.dev/kn-plugin-event/pkg/event" "knative.dev/kn-plugin-event/pkg/k8s" + k8stest "knative.dev/kn-plugin-event/pkg/k8s/test" + plugintestpkg "knative.dev/kn-plugin-event/test/pkg" "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/kmeta" servingv1 "knative.dev/serving/pkg/apis/serving/v1" ) -func TestResolveAddressE2E(t *testing.T) { - clients, err := k8s.CreateKubeClient(&event.Properties{}) - if err != nil && errors.Is(err, k8s.ErrNoKubernetesConnection) { - t.Skip("AUTO-SKIP:", err) - } else { - assert.NilError(t, err) - } - t.Parallel() - it, err := clienttest.NewKnTest() - assert.NilError(t, err) - t.Cleanup(func() { - assert.NilError(t, it.Teardown()) - }) - - resolveAddressTestCases(it.Namespace(), func(tc resolveAddressTestCase) { - t.Run(tc.name, func(t *testing.T) { - t.Parallel() - performResolveAddressTest(t, tc, func() (k8s.Clients, func(tb testing.TB)) { - deploy(t, tc, clients) - cleanup := func(tb testing.TB) { - tb.Helper() - undeploy(tb, tc, clients) - } - return clients, cleanup +func TestResolveAddress(t *testing.T) { + plugintestpkg.WithClients(t, func(c plugintestpkg.ClientsContext) { + k8stest.ResolveAddressTestCases(c.KnTest.Namespace(), func(tc k8stest.ResolveAddressTestCase) { + t.Run(tc.Name, func(t *testing.T) { + t.Parallel() + k8stest.EnsureResolveAddress(t, tc, func() (k8s.Clients, func(tb testing.TB)) { + deploy(t, tc, c.Clients) + cleanup := func(tb testing.TB) { + tb.Helper() + undeploy(tb, tc, c.Clients) + } + return c.Clients, cleanup + }) }) }) }) } -func deploy(tb testing.TB, tc resolveAddressTestCase, clients k8s.Clients) { +func deploy(tb testing.TB, tc k8stest.ResolveAddressTestCase, clients k8s.Clients) { tb.Helper() - for _, object := range tc.objects { + for _, object := range tc.Objects { switch v := object.(type) { case *servingv1.Service: deployKnService(tb, clients, *(v)) @@ -79,9 +67,9 @@ func deploy(tb testing.TB, tc resolveAddressTestCase, clients k8s.Clients) { } } -func undeploy(tb testing.TB, tc resolveAddressTestCase, clients k8s.Clients) { +func undeploy(tb testing.TB, tc k8stest.ResolveAddressTestCase, clients k8s.Clients) { tb.Helper() - for _, object := range tc.objects { + for _, object := range tc.Objects { switch v := object.(type) { case *servingv1.Service: undeployKnService(tb, clients, *(v)) diff --git a/test/presubmit-tests.sh b/test/presubmit-tests.sh index 3e9c530c6..97964150e 100755 --- a/test/presubmit-tests.sh +++ b/test/presubmit-tests.sh @@ -14,9 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# FIXME: add unset flag after fixing https://github.com/knative/hack/issues/81 -set -Eeo pipefail +set -Eeuo pipefail -source "$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")/vendor/knative.dev/hack/presubmit-tests.sh" +source "$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]:-$0}")")")/vendor/knative.dev/hack/presubmit-tests.sh" main "$@" diff --git a/third_party/VENDOR-LICENSE/github.com/openzipkin/zipkin-go/model/LICENSE b/third_party/VENDOR-LICENSE/github.com/openzipkin/zipkin-go/model/LICENSE new file mode 100644 index 000000000..2ff722463 --- /dev/null +++ b/third_party/VENDOR-LICENSE/github.com/openzipkin/zipkin-go/model/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 2017 The OpenZipkin 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. diff --git a/third_party/VENDOR-LICENSE/knative.dev/client/pkg/LICENSE b/third_party/VENDOR-LICENSE/knative.dev/client/LICENSE similarity index 100% rename from third_party/VENDOR-LICENSE/knative.dev/client/pkg/LICENSE rename to third_party/VENDOR-LICENSE/knative.dev/client/LICENSE diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go index b6e1f7b61..5dbe77cc7 100644 --- a/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ b/vendor/cloud.google.com/go/compute/metadata/metadata.go @@ -323,7 +323,7 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) { break } if reqErr != nil { - return "", "", nil + return "", "", reqErr } defer res.Body.Close() if res.StatusCode == http.StatusNotFound { diff --git a/vendor/contrib.go.opencensus.io/exporter/zipkin/.travis.yml b/vendor/contrib.go.opencensus.io/exporter/zipkin/.travis.yml new file mode 100644 index 000000000..957a893db --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/zipkin/.travis.yml @@ -0,0 +1,17 @@ +language: go + +go_import_path: contrib.go.opencensus.io + +go: + - 1.11.x + +env: + global: + GO111MODULE=on + +before_script: + - make install-tools + +script: + - make travis-ci + diff --git a/vendor/contrib.go.opencensus.io/exporter/zipkin/LICENSE b/vendor/contrib.go.opencensus.io/exporter/zipkin/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/zipkin/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/contrib.go.opencensus.io/exporter/zipkin/Makefile b/vendor/contrib.go.opencensus.io/exporter/zipkin/Makefile new file mode 100644 index 000000000..2e11d225c --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/zipkin/Makefile @@ -0,0 +1,95 @@ +# TODO: Fix this on windows. +ALL_SRC := $(shell find . -name '*.go' \ + -not -path './vendor/*' \ + -not -path '*/gen-go/*' \ + -type f | sort) +ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC)))) + +GOTEST_OPT?=-v -race -timeout 30s +GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -coverprofile=coverage.txt -covermode=atomic +GOTEST=go test +GOFMT=gofmt +GOLINT=golint +GOVET=go vet +EMBEDMD=embedmd +# TODO decide if we need to change these names. +README_FILES := $(shell find . -name '*README.md' | sort | tr '\n' ' ') + + +.DEFAULT_GOAL := fmt-lint-vet-embedmd-test + +.PHONY: fmt-lint-vet-embedmd-test +fmt-lint-vet-embedmd-test: fmt lint vet embedmd test + +# TODO enable test-with-coverage in tavis +.PHONY: travis-ci +travis-ci: fmt lint vet embedmd test test-386 + +all-pkgs: + @echo $(ALL_PKGS) | tr ' ' '\n' | sort + +all-srcs: + @echo $(ALL_SRC) | tr ' ' '\n' | sort + +.PHONY: test +test: + $(GOTEST) $(GOTEST_OPT) $(ALL_PKGS) + +.PHONY: test-386 +test-386: + GOARCH=386 $(GOTEST) -v -timeout 30s $(ALL_PKGS) + +.PHONY: test-with-coverage +test-with-coverage: + $(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(ALL_PKGS) + +.PHONY: fmt +fmt: + @FMTOUT=`$(GOFMT) -s -l $(ALL_SRC) 2>&1`; \ + if [ "$$FMTOUT" ]; then \ + echo "$(GOFMT) FAILED => gofmt the following files:\n"; \ + echo "$$FMTOUT\n"; \ + exit 1; \ + else \ + echo "Fmt finished successfully"; \ + fi + +.PHONY: lint +lint: + @LINTOUT=`$(GOLINT) $(ALL_PKGS) 2>&1`; \ + if [ "$$LINTOUT" ]; then \ + echo "$(GOLINT) FAILED => clean the following lint errors:\n"; \ + echo "$$LINTOUT\n"; \ + exit 1; \ + else \ + echo "Lint finished successfully"; \ + fi + +.PHONY: vet +vet: + # TODO: Understand why go vet downloads "github.com/google/go-cmp v0.2.0" + @VETOUT=`$(GOVET) ./... | grep -v "go: downloading" 2>&1`; \ + if [ "$$VETOUT" ]; then \ + echo "$(GOVET) FAILED => go vet the following files:\n"; \ + echo "$$VETOUT\n"; \ + exit 1; \ + else \ + echo "Vet finished successfully"; \ + fi + +.PHONY: embedmd +embedmd: + @EMBEDMDOUT=`$(EMBEDMD) -d $(README_FILES) 2>&1`; \ + if [ "$$EMBEDMDOUT" ]; then \ + echo "$(EMBEDMD) FAILED => embedmd the following files:\n"; \ + echo "$$EMBEDMDOUT\n"; \ + exit 1; \ + else \ + echo "Embedmd finished successfully"; \ + fi + +.PHONY: install-tools +install-tools: + go get -u golang.org/x/tools/cmd/cover + go get -u golang.org/x/lint/golint + go get -u github.com/rakyll/embedmd diff --git a/vendor/contrib.go.opencensus.io/exporter/zipkin/README.md b/vendor/contrib.go.opencensus.io/exporter/zipkin/README.md new file mode 100644 index 000000000..51bc3cbc5 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/zipkin/README.md @@ -0,0 +1,14 @@ +# OpenCensus Go Zipkin Exporter + +[![Build Status](https://travis-ci.org/census-ecosystem/opencensus-go-exporter-zipkin.svg?branch=master)](https://travis-ci.org/census-ecosystem/opencensus-go-exporter-zipkin) [![GoDoc][godoc-image]][godoc-url] + +Provides OpenCensus exporter support for Zipkin. + +## Installation + +``` +$ go get -u contrib.go.opencensus.io/exporter/zipkin +``` + +[godoc-image]: https://godoc.org/contrib.go.opencensus.io/exporter/zipkin?status.svg +[godoc-url]: https://godoc.org/contrib.go.opencensus.io/exporter/zipkin diff --git a/vendor/contrib.go.opencensus.io/exporter/zipkin/go.mod b/vendor/contrib.go.opencensus.io/exporter/zipkin/go.mod new file mode 100644 index 000000000..eeb6a9be4 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/zipkin/go.mod @@ -0,0 +1,7 @@ +module contrib.go.opencensus.io/exporter/zipkin + +require ( + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + github.com/openzipkin/zipkin-go v0.2.2 + go.opencensus.io v0.22.4 +) diff --git a/vendor/contrib.go.opencensus.io/exporter/zipkin/go.sum b/vendor/contrib.go.opencensus.io/exporter/zipkin/go.sum new file mode 100644 index 000000000..1a2ecef01 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/zipkin/go.sum @@ -0,0 +1,85 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/openzipkin/zipkin-go v0.2.2 h1:nY8Hti+WKaP0cRsSeQ026wU03QsM762XBeCXBb9NAWI= +github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/contrib.go.opencensus.io/exporter/zipkin/zipkin.go b/vendor/contrib.go.opencensus.io/exporter/zipkin/zipkin.go new file mode 100644 index 000000000..6bd28ff8f --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/zipkin/zipkin.go @@ -0,0 +1,197 @@ +// Copyright 2017, OpenCensus 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 zipkin contains an trace exporter for Zipkin. +package zipkin // import "contrib.go.opencensus.io/exporter/zipkin" + +import ( + "encoding/binary" + "fmt" + "strconv" + + "github.com/openzipkin/zipkin-go/model" + "github.com/openzipkin/zipkin-go/reporter" + "go.opencensus.io/trace" +) + +// Exporter is an implementation of trace.Exporter that uploads spans to a +// Zipkin server. +type Exporter struct { + reporter reporter.Reporter + localEndpoint *model.Endpoint +} + +// NewExporter returns an implementation of trace.Exporter that uploads spans +// to a Zipkin server. +// +// reporter is a Zipkin Reporter which will be used to send the spans. These +// can be created with the openzipkin library, using one of the packages under +// github.com/openzipkin/zipkin-go/reporter. +// +// localEndpoint sets the local endpoint of exported spans. It can be +// constructed with github.com/openzipkin/zipkin-go.NewEndpoint, e.g.: +// localEndpoint, err := NewEndpoint("my server", listener.Addr().String()) +// localEndpoint can be nil. +func NewExporter(reporter reporter.Reporter, localEndpoint *model.Endpoint) *Exporter { + return &Exporter{ + reporter: reporter, + localEndpoint: localEndpoint, + } +} + +// ExportSpan exports a span to a Zipkin server. +func (e *Exporter) ExportSpan(s *trace.SpanData) { + e.reporter.Send(zipkinSpan(s, e.localEndpoint)) +} + +const ( + statusCodeTagKey = "error" + statusDescriptionTagKey = "opencensus.status_description" +) + +var ( + sampledTrue = true + canonicalCodes = [...]string{ + "OK", + "CANCELLED", + "UNKNOWN", + "INVALID_ARGUMENT", + "DEADLINE_EXCEEDED", + "NOT_FOUND", + "ALREADY_EXISTS", + "PERMISSION_DENIED", + "RESOURCE_EXHAUSTED", + "FAILED_PRECONDITION", + "ABORTED", + "OUT_OF_RANGE", + "UNIMPLEMENTED", + "INTERNAL", + "UNAVAILABLE", + "DATA_LOSS", + "UNAUTHENTICATED", + } +) + +func canonicalCodeString(code int32) string { + if code < 0 || int(code) >= len(canonicalCodes) { + return "error code " + strconv.FormatInt(int64(code), 10) + } + return canonicalCodes[code] +} + +func convertTraceID(t trace.TraceID) model.TraceID { + return model.TraceID{ + High: binary.BigEndian.Uint64(t[:8]), + Low: binary.BigEndian.Uint64(t[8:]), + } +} + +func convertSpanID(s trace.SpanID) model.ID { + return model.ID(binary.BigEndian.Uint64(s[:])) +} + +func spanKind(s *trace.SpanData) model.Kind { + switch s.SpanKind { + case trace.SpanKindClient: + return model.Client + case trace.SpanKindServer: + return model.Server + } + return model.Undetermined +} + +func zipkinSpan(s *trace.SpanData, localEndpoint *model.Endpoint) model.SpanModel { + sc := s.SpanContext + z := model.SpanModel{ + SpanContext: model.SpanContext{ + TraceID: convertTraceID(sc.TraceID), + ID: convertSpanID(sc.SpanID), + Sampled: &sampledTrue, + }, + Kind: spanKind(s), + Name: s.Name, + Timestamp: s.StartTime, + Shared: false, + LocalEndpoint: localEndpoint, + } + + if s.ParentSpanID != (trace.SpanID{}) { + id := convertSpanID(s.ParentSpanID) + z.ParentID = &id + } + + if s, e := s.StartTime, s.EndTime; !s.IsZero() && !e.IsZero() { + z.Duration = e.Sub(s) + } + + // construct Tags from s.Attributes and s.Status. + if len(s.Attributes) != 0 { + m := make(map[string]string, len(s.Attributes)+2) + for key, value := range s.Attributes { + switch v := value.(type) { + case string: + m[key] = v + case bool: + if v { + m[key] = "true" + } else { + m[key] = "false" + } + case int64: + m[key] = strconv.FormatInt(v, 10) + case float64: + m[key] = strconv.FormatFloat(v, 'f', -1, 64) + } + } + z.Tags = m + } + if s.Status.Code != 0 || s.Status.Message != "" { + if z.Tags == nil { + z.Tags = make(map[string]string, 2) + } + if s.Status.Code != 0 { + z.Tags[statusCodeTagKey] = canonicalCodeString(s.Status.Code) + } + if s.Status.Message != "" { + z.Tags[statusDescriptionTagKey] = s.Status.Message + } + } + + // construct Annotations from s.Annotations and s.MessageEvents. + if len(s.Annotations) != 0 || len(s.MessageEvents) != 0 { + z.Annotations = make([]model.Annotation, 0, len(s.Annotations)+len(s.MessageEvents)) + for _, a := range s.Annotations { + z.Annotations = append(z.Annotations, model.Annotation{ + Timestamp: a.Time, + Value: a.Message, + }) + } + for _, m := range s.MessageEvents { + a := model.Annotation{ + Timestamp: m.Time, + } + switch m.EventType { + case trace.MessageEventTypeSent: + a.Value = fmt.Sprintf("Sent %d bytes", m.UncompressedByteSize) + case trace.MessageEventTypeRecv: + a.Value = fmt.Sprintf("Received %d bytes", m.UncompressedByteSize) + default: + a.Value = "" + } + z.Annotations = append(z.Annotations, a) + } + } + + return z +} diff --git a/vendor/github.com/cloudevents/conformance/LICENSE b/vendor/github.com/cloudevents/conformance/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/github.com/cloudevents/conformance/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/github.com/cloudevents/conformance/pkg/event/event.go b/vendor/github.com/cloudevents/conformance/pkg/event/event.go new file mode 100644 index 000000000..c02c97776 --- /dev/null +++ b/vendor/github.com/cloudevents/conformance/pkg/event/event.go @@ -0,0 +1,36 @@ +package event + +type MutationFn func(Event) (Event, error) + +// Mode of encoding. +const ( + DefaultMode = "" + BinaryMode = "binary" + StructuredMode = "structured" +) + +type Event struct { + Mode string `yaml:"Mode,omitempty"` + Attributes ContextAttributes `yaml:"ContextAttributes"` + TransportExtensions Extensions `yaml:"TransportExtensions,omitempty"` + Data string `yaml:"Data"` + // TODO: add support for data_base64 +} + +type ContextAttributes struct { + SpecVersion string `yaml:"specversion,omitempty"` + Type string `yaml:"type,omitempty"` + Time string `yaml:"time,omitempty"` + ID string `yaml:"id,omitempty"` + Source string `yaml:"source,omitempty"` + Subject string `yaml:"subject,omitempty"` + // SchemaURL replaced by DataSchema in 1.0 + SchemaURL string `yaml:"schemaurl,omitempty"` + DataSchema string `yaml:"dataschema,omitempty"` + // DataContentEncoding removed in 1.0 + DataContentEncoding string `yaml:"dataecontentncoding,omitempty"` + DataContentType string `yaml:"datacontenttype,omitempty"` + Extensions Extensions `yaml:"Extensions,omitempty"` +} + +type Extensions map[string]string diff --git a/vendor/github.com/cloudevents/conformance/pkg/event/read.go b/vendor/github.com/cloudevents/conformance/pkg/event/read.go new file mode 100644 index 000000000..3cfc9e6bd --- /dev/null +++ b/vendor/github.com/cloudevents/conformance/pkg/event/read.go @@ -0,0 +1,124 @@ +package event + +import ( + "gopkg.in/yaml.v2" + "io" + "io/ioutil" + "net/http" + "net/url" + "os" + "path" + "strings" +) + +func FromYaml(files string, recursive bool) ([]Event, error) { + pathNames := strings.Split(files, ",") + events := make([]Event, 0) + for _, pathName := range pathNames { + var event []Event + var err error + + switch { + case pathName == "-": + event, err = decode(os.Stdin) + case isURL(pathName): + event, err = readURL(pathName) + default: + event, err = readPath(pathName, recursive) + } + + if err != nil { + return nil, err + } + events = append(events, event...) + } + return events, nil +} + +func isURL(pathname string) bool { + if _, err := os.Lstat(pathname); err == nil { + return false + } + uri, err := url.ParseRequestURI(pathname) + return err == nil && uri.Scheme != "" +} + +func readURL(uri string) ([]Event, error) { + resp, err := http.Get(uri) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + return decode(resp.Body) +} + +func readPath(pathName string, recursive bool) ([]Event, error) { + info, err := os.Stat(pathName) + if err != nil { + return nil, err + } + + if info.IsDir() { + return readDir(pathName, recursive) + } + return readFile(pathName) +} + +func readFile(pathName string) ([]Event, error) { + file, err := os.Open(pathName) + if err != nil { + return nil, err + } + defer func() { + if err := file.Close(); err != nil { + panic(err) + } + }() + + return decode(file) +} + +func readDir(pathName string, recursive bool) ([]Event, error) { + list, err := ioutil.ReadDir(pathName) + if err != nil { + return nil, err + } + + events := make([]Event, 0) + for _, f := range list { + name := path.Join(pathName, f.Name()) + var evs []Event + + switch { + case f.IsDir() && recursive: + evs, err = readDir(name, recursive) + case !f.IsDir(): + evs, err = readFile(name) + } + + if err != nil { + return nil, err + } + events = append(events, evs...) + } + return events, nil +} + +func decode(reader io.Reader) ([]Event, error) { + decoder := yaml.NewDecoder(reader) + events := make([]Event, 0) + var err error + for { + out := Event{} + err = decoder.Decode(&out) + if err != nil { + break + } + events = append(events, out) + } + if err != io.EOF { + return nil, err + } + return events, nil +} diff --git a/vendor/github.com/cloudevents/conformance/pkg/event/write.go b/vendor/github.com/cloudevents/conformance/pkg/event/write.go new file mode 100644 index 000000000..51f548d1d --- /dev/null +++ b/vendor/github.com/cloudevents/conformance/pkg/event/write.go @@ -0,0 +1,9 @@ +package event + +import ( + "gopkg.in/yaml.v2" +) + +func ToYaml(event Event) ([]byte, error) { + return yaml.Marshal(event) +} diff --git a/vendor/github.com/cloudevents/conformance/pkg/http/http.go b/vendor/github.com/cloudevents/conformance/pkg/http/http.go new file mode 100644 index 000000000..e326463f0 --- /dev/null +++ b/vendor/github.com/cloudevents/conformance/pkg/http/http.go @@ -0,0 +1,271 @@ +package http + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "strings" + + "github.com/cloudevents/conformance/pkg/event" +) + +type ResultsFn func(*http.Request, *http.Response, error) + +func addHeader(req *http.Request, key, value string) { + value = strings.TrimSpace(value) + if value != "" { + req.Header.Add(key, value) + } +} + +func addStructured(env map[string]interface{}, key, value string) { + value = strings.TrimSpace(value) + if value != "" { + env[key] = value + } +} + +func EventToRequest(url string, in event.Event) (*http.Request, error) { + switch in.Mode { + case event.StructuredMode: + return structuredEventToRequest(url, in) + case event.DefaultMode, event.BinaryMode: + return binaryEventToRequest(url, in) + } + return nil, fmt.Errorf("unknown content mode: %q", in.Mode) +} + +func structuredEventToRequest(url string, event event.Event) (*http.Request, error) { + env := make(map[string]interface{}) + + // CloudEvents attributes. + addStructured(env, "specversion", event.Attributes.SpecVersion) + addStructured(env, "type", event.Attributes.Type) + addStructured(env, "time", event.Attributes.Time) + addStructured(env, "id", event.Attributes.ID) + addStructured(env, "source", event.Attributes.Source) + addStructured(env, "subject", event.Attributes.Subject) + addStructured(env, "schemaurl", event.Attributes.SchemaURL) + addStructured(env, "datacontenttype", event.Attributes.DataContentType) + addStructured(env, "datacontentencoding", event.Attributes.DataContentEncoding) + + // CloudEvents attribute extensions. + for k, v := range event.Attributes.Extensions { + addStructured(env, k, v) + } + + // TODO: based on datacontenttype, we should parse data and then set the result in the envelope. + if len(event.Data) > 0 { + data := json.RawMessage{} + if err := json.Unmarshal([]byte(event.Data), &data); err != nil { + return nil, err + } + env["data"] = data + } + + // To JSON. + body, err := json.Marshal(env) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", url, bytes.NewBuffer(body)) + if err != nil { + return nil, err + } + + // Transport extensions. + hasContentType := false + for k, v := range event.TransportExtensions { + if strings.EqualFold(v, "Content-Type") { + hasContentType = true + } + addHeader(req, k, v) + } + + if !hasContentType { + addHeader(req, "Content-Type", "application/cloudevents+json; charset=UTF-8") + } + + return req, nil +} + +func binaryEventToRequest(url string, event event.Event) (*http.Request, error) { + req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(event.Data))) + if err != nil { + return nil, err + } + + // CloudEvents attributes. + addHeader(req, "ce-specversion", event.Attributes.SpecVersion) + addHeader(req, "ce-type", event.Attributes.Type) + addHeader(req, "ce-time", event.Attributes.Time) + addHeader(req, "ce-id", event.Attributes.ID) + addHeader(req, "ce-source", event.Attributes.Source) + addHeader(req, "ce-subject", event.Attributes.Subject) + addHeader(req, "ce-schemaurl", event.Attributes.SchemaURL) + addHeader(req, "Content-Type", event.Attributes.DataContentType) + addHeader(req, "ce-datacontentencoding", event.Attributes.DataContentEncoding) + + // CloudEvents attribute extensions. + for k, v := range event.Attributes.Extensions { + addHeader(req, "ce-"+k, v) + } + + // Transport extensions. + for k, v := range event.TransportExtensions { + addHeader(req, k, v) + } + + return req, nil +} + +func RequestToEvent(req *http.Request) (*event.Event, error) { + if strings.HasPrefix(req.Header.Get("Content-Type"), "application/cloudevents+json") { + req.Header.Del("Content-Type") + return structuredRequestToEvent(req) + } + return binaryRequestToEvent(req) +} + +func structuredRequestToEvent(req *http.Request) (*event.Event, error) { + out := &event.Event{ + Mode: event.StructuredMode, + } + + body, err := ioutil.ReadAll(req.Body) + if err != nil { + return nil, err + } + _ = body + + env := make(map[string]json.RawMessage) + if err := json.Unmarshal(body, &env); err != nil { + return nil, err + } + + insert := func(key string, into *string) { + if _, found := env[key]; found { + if err := json.Unmarshal(env[key], into); err != nil { + *into = err.Error() + } + delete(env, key) + } + } + + // CloudEvents attributes. + insert("specversion", &out.Attributes.SpecVersion) + insert("type", &out.Attributes.Type) + insert("time", &out.Attributes.Time) + insert("id", &out.Attributes.ID) + insert("source", &out.Attributes.Source) + insert("subject", &out.Attributes.Subject) + insert("schemaurl", &out.Attributes.SchemaURL) + insert("datacontenttype", &out.Attributes.DataContentType) + insert("datacontentencoding", &out.Attributes.DataContentEncoding) + + // CloudEvents Data. + if _, found := env["data"]; found { + out.Data = string(env["data"]) + "\n" + delete(env, "data") + } + + // CloudEvents attribute extensions. + out.Attributes.Extensions = make(map[string]string) + for key, b := range env { + var into string + if err := json.Unmarshal(b, &into); err != nil { + into = err.Error() + } + out.Attributes.Extensions[key] = into + delete(env, key) + } + + // Transport extensions. + out.TransportExtensions = make(map[string]string) + for k := range req.Header { + if k == "Accept-Encoding" || k == "Content-Length" { + continue + } + out.TransportExtensions[k] = req.Header.Get(k) + req.Header.Del(k) + } + + return out, nil +} + +func binaryRequestToEvent(req *http.Request) (*event.Event, error) { + body, err := ioutil.ReadAll(req.Body) + if err != nil { + return nil, err + } + _ = body + + out := &event.Event{ + Mode: event.BinaryMode, + Data: string(body), + } + + // CloudEvents attributes. + out.Attributes.SpecVersion = req.Header.Get("ce-specversion") + req.Header.Del("ce-specversion") + out.Attributes.Type = req.Header.Get("ce-type") + req.Header.Del("ce-type") + out.Attributes.Time = req.Header.Get("ce-time") + req.Header.Del("ce-time") + out.Attributes.ID = req.Header.Get("ce-id") + req.Header.Del("ce-id") + out.Attributes.Source = req.Header.Get("ce-source") + req.Header.Del("ce-source") + out.Attributes.Subject = req.Header.Get("ce-subject") + req.Header.Del("ce-subject") + out.Attributes.SchemaURL = req.Header.Get("ce-schemaurl") + req.Header.Del("ce-schemaurl") + out.Attributes.DataContentType = req.Header.Get("Content-Type") + req.Header.Del("Content-Type") + out.Attributes.DataContentEncoding = req.Header.Get("ce-datacontentencoding") + req.Header.Del("ce-datacontentencoding") + + // CloudEvents attribute extensions. + out.Attributes.Extensions = make(map[string]string) + for k := range req.Header { + if strings.HasPrefix(strings.ToLower(k), "ce-") { + out.Attributes.Extensions[k[len("ce-"):]] = req.Header.Get(k) + req.Header.Del(k) + } + } + + // Transport extensions. + out.TransportExtensions = make(map[string]string) + for k := range req.Header { + if k == "Accept-Encoding" || k == "Content-Length" { + continue + } + out.TransportExtensions[k] = req.Header.Get(k) + req.Header.Del(k) + } + + return out, nil +} + +func Do(req *http.Request, hook ResultsFn) error { + resp, err := http.DefaultClient.Do(req) + + if hook != nil { + // Non-blocking. + go hook(req, resp, err) + } + + if err != nil { + return err + } + + if resp.StatusCode < 200 || resp.StatusCode > 299 { + return fmt.Errorf("expected 200 level response, got %s", resp.Status) + } + + // TODO might want something from resp. + return nil +} diff --git a/vendor/github.com/cloudevents/conformance/pkg/http/raw.go b/vendor/github.com/cloudevents/conformance/pkg/http/raw.go new file mode 100644 index 000000000..dd7b7f477 --- /dev/null +++ b/vendor/github.com/cloudevents/conformance/pkg/http/raw.go @@ -0,0 +1,27 @@ +package http + +import ( + "fmt" + "io" + "net/http" + "net/http/httputil" +) + +type Raw struct { + Out io.Writer + Port int `envconfig:"PORT" default:"8080"` +} + +func (raw *Raw) Do() error { + _, _ = fmt.Fprintf(raw.Out, "listening on :%d\n", raw.Port) + return http.ListenAndServe(fmt.Sprintf(":%d", raw.Port), raw) +} +func (raw *Raw) ServeHTTP(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + if reqBytes, err := httputil.DumpRequest(r, true); err == nil { + _, _ = fmt.Fprintf(raw.Out, "%+v\n", string(reqBytes)) + } else { + _, _ = fmt.Fprintf(raw.Out, "Failed to call DumpRequest: %s\n", err) + } + _, _ = fmt.Fprintln(raw.Out, "================") +} diff --git a/vendor/github.com/cloudevents/sdk-go/v2/test/doc.go b/vendor/github.com/cloudevents/sdk-go/v2/test/doc.go new file mode 100644 index 000000000..111e6f491 --- /dev/null +++ b/vendor/github.com/cloudevents/sdk-go/v2/test/doc.go @@ -0,0 +1,4 @@ +/* +Package test has utilities (asserts, mocks, ...) to use cloudevents in your tests +*/ +package test diff --git a/vendor/github.com/cloudevents/sdk-go/v2/test/event_asserts.go b/vendor/github.com/cloudevents/sdk-go/v2/test/event_asserts.go new file mode 100644 index 000000000..746977136 --- /dev/null +++ b/vendor/github.com/cloudevents/sdk-go/v2/test/event_asserts.go @@ -0,0 +1,29 @@ +package test + +import ( + "testing" + + "github.com/cloudevents/sdk-go/v2/event" +) + +// AssertEvent is a "matcher like" assertion method to test the properties of an event +func AssertEvent(t testing.TB, have event.Event, matchers ...EventMatcher) { + err := AllOf(matchers...)(have) + if err != nil { + t.Fatalf("Error while matching event: %s", err.Error()) + } +} + +// AssertEventContextEquals asserts that two event.Event contexts are equals +func AssertEventContextEquals(t testing.TB, want event.EventContext, have event.EventContext) { + if err := IsContextEqualTo(want)(event.Event{Context: have}); err != nil { + t.Fatalf("Error while matching event context: %s", err.Error()) + } +} + +// AssertEventEquals asserts that two event.Event are equals +func AssertEventEquals(t testing.TB, want event.Event, have event.Event) { + if err := IsEqualTo(want)(have); err != nil { + t.Fatalf("Error while matching event: %s", err.Error()) + } +} diff --git a/vendor/github.com/cloudevents/sdk-go/v2/test/event_matchers.go b/vendor/github.com/cloudevents/sdk-go/v2/test/event_matchers.go new file mode 100644 index 000000000..7df4a7256 --- /dev/null +++ b/vendor/github.com/cloudevents/sdk-go/v2/test/event_matchers.go @@ -0,0 +1,299 @@ +package test + +import ( + "errors" + "fmt" + "reflect" + "strings" + "time" + + "github.com/google/go-cmp/cmp" + + "github.com/cloudevents/sdk-go/v2/binding/spec" + "github.com/cloudevents/sdk-go/v2/event" +) + +type EventMatcher func(have event.Event) error + +// AllOf combines matchers together +func AllOf(matchers ...EventMatcher) EventMatcher { + return func(have event.Event) error { + for _, m := range matchers { + if err := m(have); err != nil { + return err + } + } + return nil + } +} + +// AnyOf returns a matcher which match if at least one of the provided matchers matches +func AnyOf(matchers ...EventMatcher) EventMatcher { + return func(have event.Event) error { + var errs []error + for _, m := range matchers { + if err := m(have); err == nil { + return nil + } else { + errs = append(errs, err) + } + } + var sb strings.Builder + sb.WriteString("Cannot match any of the provided matchers\n") + for i, err := range errs { + sb.WriteString(fmt.Sprintf("%d: %s\n", i+1, err)) + } + return errors.New(sb.String()) + } +} + +func HasId(id string) EventMatcher { + return HasAttributeKind(spec.ID, id) +} + +func HasType(ty string) EventMatcher { + return HasAttributeKind(spec.Type, ty) +} + +func HasSpecVersion(specVersion string) EventMatcher { + return HasAttributeKind(spec.SpecVersion, specVersion) +} + +func HasSource(source string) EventMatcher { + return HasAttributeKind(spec.Source, source) +} + +func HasDataContentType(dataContentType string) EventMatcher { + return HasAttributeKind(spec.DataContentType, dataContentType) +} + +func HasDataSchema(schema string) EventMatcher { + return HasAttributeKind(spec.DataSchema, schema) +} + +func HasSubject(subject string) EventMatcher { + return HasAttributeKind(spec.Subject, subject) +} + +func HasTime(t time.Time) EventMatcher { + return HasAttributeKind(spec.Time, t) +} + +// ContainsAttributes checks if the event contains at least the provided context attributes +func ContainsAttributes(attrs ...spec.Kind) EventMatcher { + return func(have event.Event) error { + haveVersion := spec.VS.Version(have.SpecVersion()) + for _, k := range attrs { + attr := haveVersion.AttributeFromKind(k) + if isEmpty(attr) { + return fmt.Errorf("attribute name '%s' unrecognized", k.String()) + } + if isEmpty(attr.Get(have.Context)) { + return fmt.Errorf("missing or nil/empty attribute '%s'", k.String()) + } + } + return nil + } +} + +// ContainsExtensions checks if the event contains at least the provided extension names +func ContainsExtensions(exts ...string) EventMatcher { + return func(have event.Event) error { + for _, ext := range exts { + if _, ok := have.Extensions()[ext]; !ok { + return fmt.Errorf("expecting extension '%s'", ext) + } + } + return nil + } +} + +// ContainsExactlyExtensions checks if the event contains only the provided extension names and no more +func ContainsExactlyExtensions(exts ...string) EventMatcher { + return func(have event.Event) error { + // Copy in a temporary set first + extsInEvent := map[string]struct{}{} + for k := range have.Extensions() { + extsInEvent[k] = struct{}{} + } + + for _, ext := range exts { + if _, ok := have.Extensions()[ext]; !ok { + return fmt.Errorf("expecting extension '%s'", ext) + } else { + delete(extsInEvent, ext) + } + } + + if len(extsInEvent) != 0 { + var unexpectedKeys []string + for k := range extsInEvent { + unexpectedKeys = append(unexpectedKeys, k) + } + return fmt.Errorf("not expecting extensions '%v'", unexpectedKeys) + } + return nil + } +} + +// HasExactlyAttributesEqualTo checks if the event has exactly the provided spec attributes (excluding extension attributes) +func HasExactlyAttributesEqualTo(want event.EventContext) EventMatcher { + return func(have event.Event) error { + if want.GetSpecVersion() != have.SpecVersion() { + return fmt.Errorf("not matching specversion: want = '%s', got = '%s'", want.GetSpecVersion(), have.SpecVersion()) + } + vs := spec.VS.Version(want.GetSpecVersion()) + + for _, a := range vs.Attributes() { + if !reflect.DeepEqual(a.Get(want), a.Get(have.Context)) { + return fmt.Errorf("expecting attribute '%s' equal to '%s', got '%s'", a.PrefixedName(), a.Get(want), a.Get(have.Context)) + } + } + + return nil + } +} + +// HasExactlyExtensions checks if the event contains exactly the provided extensions +func HasExactlyExtensions(ext map[string]interface{}) EventMatcher { + return func(have event.Event) error { + if diff := cmp.Diff(ext, have.Extensions()); diff != "" { + return fmt.Errorf("unexpected extensions (-want, +got) = %v", diff) + } + return nil + } +} + +// HasExtensions checks if the event contains at least the provided extensions +func HasExtensions(ext map[string]interface{}) EventMatcher { + return func(have event.Event) error { + for k, v := range ext { + if _, ok := have.Extensions()[k]; !ok { + return fmt.Errorf("expecting extension '%s'", ext) + } + if !reflect.DeepEqual(v, have.Extensions()[k]) { + return fmt.Errorf("expecting extension '%s' equal to '%s', got '%s'", k, v, have.Extensions()[k]) + } + } + return nil + } +} + +// HasExtension checks if the event contains the provided extension +func HasExtension(key string, value interface{}) EventMatcher { + return HasExtensions(map[string]interface{}{key: value}) +} + +// HasData checks if the event contains the provided data +func HasData(want []byte) EventMatcher { + return func(have event.Event) error { + if diff := cmp.Diff(string(want), string(have.Data())); diff != "" { + return fmt.Errorf("data not matching (-want, +got) = %v", diff) + } + return nil + } +} + +// DataContains matches that the data field of the event, converted to a string, contains the provided string +func DataContains(expectedContainedString string) EventMatcher { + return func(have event.Event) error { + dataAsString := string(have.Data()) + if !strings.Contains(dataAsString, expectedContainedString) { + return fmt.Errorf("data '%s' doesn't contain '%s'", dataAsString, expectedContainedString) + } + return nil + } +} + +// HasNoData checks if the event doesn't contain data +func HasNoData() EventMatcher { + return func(have event.Event) error { + if have.Data() != nil { + return fmt.Errorf("expecting nil data, got = '%v'", string(have.Data())) + } + return nil + } +} + +// IsEqualTo performs a semantic equality check of the event (like AssertEventEquals) +func IsEqualTo(want event.Event) EventMatcher { + return AllOf(IsContextEqualTo(want.Context), IsDataEqualTo(want)) +} + +// IsContextEqualTo performs a semantic equality check of the event context, including extension attributes (like AssertEventContextEquals) +func IsContextEqualTo(want event.EventContext) EventMatcher { + return AllOf(HasExactlyAttributesEqualTo(want), HasExactlyExtensions(want.GetExtensions())) +} + +// IsDataEqualTo checks if the data field matches with want +func IsDataEqualTo(want event.Event) EventMatcher { + if want.Data() == nil { + return HasNoData() + } else { + return HasData(want.Data()) + } +} + +// IsValid checks if the event is valid +func IsValid() EventMatcher { + return func(have event.Event) error { + if err := have.Validate(); err != nil { + return fmt.Errorf("expecting valid event: %s", err.Error()) + } + return nil + } +} + +// IsInvalid checks if the event is invalid +func IsInvalid() EventMatcher { + return func(have event.Event) error { + if err := have.Validate(); err == nil { + return fmt.Errorf("expecting invalid event") + } + return nil + } +} + +func HasAttributeKind(kind spec.Kind, value interface{}) EventMatcher { + return func(have event.Event) error { + haveVersion := spec.VS.Version(have.SpecVersion()) + attr := haveVersion.AttributeFromKind(kind) + if isEmpty(attr) { + return fmt.Errorf("attribute '%s' not existing in the spec version '%s' of this event", kind.String(), haveVersion.String()) + } + if !reflect.DeepEqual(value, attr.Get(have.Context)) { + return fmt.Errorf("expecting attribute '%s' equal to '%s', got '%s'", kind.String(), value, attr.Get(have.Context)) + } + return nil + } +} + +// Code took from https://github.com/stretchr/testify +// LICENSE: MIT License + +func isEmpty(object interface{}) bool { + + // get nil case out of the way + if object == nil { + return true + } + + objValue := reflect.ValueOf(object) + + switch objValue.Kind() { + // collection types are empty when they have no element + case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice: + return objValue.Len() == 0 + // pointers are empty if nil or if the value they point to is empty + case reflect.Ptr: + if objValue.IsNil() { + return true + } + deref := objValue.Elem().Interface() + return isEmpty(deref) + // for all other types, compare against the zero value + default: + zero := reflect.Zero(objValue.Type()) + return reflect.DeepEqual(object, zero.Interface()) + } +} diff --git a/vendor/github.com/cloudevents/sdk-go/v2/test/event_mocks.go b/vendor/github.com/cloudevents/sdk-go/v2/test/event_mocks.go new file mode 100644 index 000000000..05e5675b1 --- /dev/null +++ b/vendor/github.com/cloudevents/sdk-go/v2/test/event_mocks.go @@ -0,0 +1,94 @@ +// Package test contains test data and generic tests for testing bindings. +package test + +import ( + "fmt" + "net/url" + "time" + + "github.com/cloudevents/sdk-go/v2/binding" + "github.com/cloudevents/sdk-go/v2/binding/spec" + "github.com/cloudevents/sdk-go/v2/event" + "github.com/cloudevents/sdk-go/v2/types" +) + +func strptr(s string) *string { return &s } + +var ( + Source = types.URIRef{URL: url.URL{Scheme: "http", Host: "example.com", Path: "/source"}} + Timestamp = types.Timestamp{Time: time.Date(2020, 03, 21, 12, 34, 56, 780000000, time.UTC)} + Schema = types.URI{URL: url.URL{Scheme: "http", Host: "example.com", Path: "/schema"}} +) + +// FullEvent has all context attributes set and JSON string data. +func FullEvent() event.Event { + e := event.Event{ + Context: event.EventContextV1{ + Type: "com.example.FullEvent", + Source: Source, + ID: "full-event", + Time: &Timestamp, + DataSchema: &Schema, + Subject: strptr("topic"), + }.AsV1(), + } + + e.SetExtension("exbool", true) + e.SetExtension("exint", 42) + e.SetExtension("exstring", "exstring") + e.SetExtension("exbinary", []byte{0, 1, 2, 3}) + e.SetExtension("exurl", Source) + e.SetExtension("extime", Timestamp) + + if err := e.SetData("text/json", "hello"); err != nil { + panic(err) + } + return e +} + +// MinEvent has only required attributes set. +func MinEvent() event.Event { + return event.Event{ + Context: event.EventContextV1{ + Type: "com.example.MinEvent", + Source: Source, + ID: "min-event", + }.AsV1(), + } +} + +// FullMessage returns the same event of FullEvent but wrapped as Message. +func FullMessage() binding.Message { + ev := FullEvent() + return binding.ToMessage(&ev) +} + +// MinMessage returns the same event of MinEvent but wrapped as Message. +func MinMessage() binding.Message { + ev := MinEvent() + return binding.ToMessage(&ev) +} + +// AllVersions returns all versions of each event in events. +// ID gets a -number suffix so IDs are unique. +func AllVersions(events []event.Event) []event.Event { + versions := spec.New() + all := versions.Versions() + result := make([]event.Event, len(events)*len(all)) + i := 0 + for _, e := range events { + for _, v := range all { + result[i] = e + result[i].Context = v.Convert(e.Context) + result[i].SetID(fmt.Sprintf("%v-%v", e.ID(), i)) // Unique IDs + i++ + } + } + return result +} + +// Events is a set of test events that should be handled correctly by +// all event-processing code. +func Events() []event.Event { + return AllVersions([]event.Event{FullEvent(), MinEvent()}) +} diff --git a/vendor/github.com/cloudevents/sdk-go/v2/test/helpers.go b/vendor/github.com/cloudevents/sdk-go/v2/test/helpers.go new file mode 100644 index 000000000..ddb9c321a --- /dev/null +++ b/vendor/github.com/cloudevents/sdk-go/v2/test/helpers.go @@ -0,0 +1,94 @@ +package test + +import ( + "context" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cloudevents/sdk-go/v2/binding" + "github.com/cloudevents/sdk-go/v2/binding/format" + "github.com/cloudevents/sdk-go/v2/event" + "github.com/cloudevents/sdk-go/v2/types" +) + +// WithoutExtensions returns a copy of events with no Extensions. +// Use for testing where extensions are not supported. +func WithoutExtensions(events []event.Event) []event.Event { + result := make([]event.Event, len(events)) + for i, e := range events { + result[i] = e + result[i].Context = e.Context.Clone() + ctx := reflect.ValueOf(result[i].Context).Elem() + ext := ctx.FieldByName("Extensions") + ext.Set(reflect.Zero(ext.Type())) + } + return result +} + +// MustJSON marshals the event.Event to JSON structured representation or panics +func MustJSON(t testing.TB, e event.Event) []byte { + b, err := format.JSON.Marshal(&e) + require.NoError(t, err) + return b +} + +// MustToEvent converts a Message to event.Event +func MustToEvent(t testing.TB, ctx context.Context, m binding.Message) event.Event { + e, err := binding.ToEvent(ctx, m) + require.NoError(t, err) + return *e +} + +// ConvertEventExtensionsToString returns a copy of the event.Event where all extensions are converted to strings. Fails the test if conversion fails +func ConvertEventExtensionsToString(t testing.TB, e event.Event) event.Event { + out := e.Clone() + for k, v := range e.Extensions() { + var vParsed interface{} + var err error + + switch v := v.(type) { + case json.RawMessage: + err = json.Unmarshal(v, &vParsed) + require.NoError(t, err) + default: + vParsed, err = types.Format(v) + require.NoError(t, err) + } + out.SetExtension(k, vParsed) + } + return out +} + +// TestNameOf generates a string test name from x, esp. for ce.Event and ce.Message. +func TestNameOf(x interface{}) string { + switch x := x.(type) { + case event.Event: + b, err := json.Marshal(x) + if err == nil { + return fmt.Sprintf("Event%s", b) + } + case binding.Message: + return fmt.Sprintf("Message{%s}", reflect.TypeOf(x).String()) + } + return fmt.Sprintf("%T(%#v)", x, x) +} + +// EachEvent runs f as a test for each event in events +func EachEvent(t *testing.T, events []event.Event, f func(*testing.T, event.Event)) { + for _, e := range events { + in := e + t.Run(TestNameOf(in), func(t *testing.T) { f(t, in) }) + } +} + +// EachMessage runs f as a test for each message in messages +func EachMessage(t *testing.T, messages []binding.Message, f func(*testing.T, binding.Message)) { + for _, m := range messages { + in := m + t.Run(TestNameOf(in), func(t *testing.T) { f(t, in) }) + } +} diff --git a/vendor/github.com/go-logr/logr/logr.go b/vendor/github.com/go-logr/logr/logr.go index 44cd398c9..c05482a20 100644 --- a/vendor/github.com/go-logr/logr/logr.go +++ b/vendor/github.com/go-logr/logr/logr.go @@ -43,7 +43,9 @@ limitations under the License. // // Info() and Error() are very similar, but they are separate methods so that // LogSink implementations can choose to do things like attach additional -// information (such as stack traces) on calls to Error(). +// information (such as stack traces) on calls to Error(). Error() messages are +// always logged, regardless of the current verbosity. If there is no error +// instance available, passing nil is valid. // // Verbosity // @@ -53,6 +55,7 @@ limitations under the License. // Log-lines with V-levels that are not enabled (as per the LogSink) will not // be written. Level V(0) is the default, and logger.V(0).Info() has the same // meaning as logger.Info(). Negative V-levels have the same meaning as V(0). +// Error messages do not have a verbosity level and are always logged. // // Where we might have written: // if flVerbose >= 2 { @@ -253,11 +256,13 @@ func (l Logger) Info(msg string, keysAndValues ...interface{}) { // Error logs an error, with the given message and key/value pairs as context. // It functions similarly to Info, but may have unique behavior, and should be // preferred for logging errors (see the package documentations for more -// information). +// information). The log message will always be emitted, regardless of +// verbosity level. // // The msg argument should be used to add context to any underlying error, // while the err argument should be used to attach the actual error that -// triggered this log line, if present. +// triggered this log line, if present. The err parameter is optional +// and nil may be passed instead of an error instance. func (l Logger) Error(err error, msg string, keysAndValues ...interface{}) { if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { withHelper.GetCallStackHelper()() diff --git a/vendor/github.com/openzipkin/zipkin-go/.gitattributes b/vendor/github.com/openzipkin/zipkin-go/.gitattributes new file mode 100644 index 000000000..fcadb2cf9 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/.gitattributes @@ -0,0 +1 @@ +* text eol=lf diff --git a/vendor/github.com/openzipkin/zipkin-go/.gitignore b/vendor/github.com/openzipkin/zipkin-go/.gitignore new file mode 100644 index 000000000..11b90db8d --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/.gitignore @@ -0,0 +1,26 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +.idea diff --git a/vendor/github.com/openzipkin/zipkin-go/.golangci.yml b/vendor/github.com/openzipkin/zipkin-go/.golangci.yml new file mode 100644 index 000000000..3d615b8b0 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/.golangci.yml @@ -0,0 +1,31 @@ +run: + deadline: 5m + skip-dirs: + - zipkin_proto3 + +linters: + disable-all: true + enable: + - dupl + - goconst + - gocyclo + - gofmt + - revive + - govet + - ineffassign + - lll + - misspell + - nakedret + - structcheck + - unparam + - varcheck + +linters-settings: + dupl: + threshold: 400 + lll: + line-length: 170 + gocyclo: + min-complexity: 20 + golint: + min-confidence: 0.85 diff --git a/vendor/github.com/openzipkin/zipkin-go/Makefile b/vendor/github.com/openzipkin/zipkin-go/Makefile new file mode 100644 index 000000000..60f72d6c0 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/Makefile @@ -0,0 +1,43 @@ +# Copyright 2021 The OpenZipkin 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. + +.DEFAULT_GOAL := test + +.PHONY: test +test: + go test -v -race -cover ./... + +.PHONY: bench +bench: + go test -v -run - -bench . -benchmem ./... + +.PHONY: protoc +protoc: + protoc --go_out=module=github.com/openzipkin/zipkin-go:. proto/zipkin_proto3/zipkin.proto + protoc --go_out=module=github.com/openzipkin/zipkin-go:. proto/testing/service.proto + protoc --go-grpc_out=module=github.com/openzipkin/zipkin-go:. proto/testing/service.proto + +.PHONY: lint +lint: + # Ignore grep's exit code since no match returns 1. + echo 'linting...' ; golint ./... + +.PHONY: vet +vet: + go vet ./... + +.PHONY: all +all: vet lint test bench + +.PHONY: example diff --git a/vendor/github.com/openzipkin/zipkin-go/README.md b/vendor/github.com/openzipkin/zipkin-go/README.md new file mode 100644 index 000000000..347bbd813 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/README.md @@ -0,0 +1,117 @@ + + +# Zipkin Library for Go + +[![GHA](https://github.com/openzipkin/zipkin-go/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/openzipkin/zipkin-go/actions/workflows/ci.yml) +[![CircleCI](https://circleci.com/gh/openzipkin/zipkin-go.svg?style=shield)](https://circleci.com/gh/openzipkin/zipkin-go) +[![codecov](https://codecov.io/gh/openzipkin/zipkin-go/branch/master/graph/badge.svg?token=gXdWofFlsq)](https://codecov.io/gh/openzipkin/zipkin-go) +[![Go Report Card](https://goreportcard.com/badge/github.com/openzipkin/zipkin-go)](https://goreportcard.com/report/github.com/openzipkin/zipkin-go) +[![GoDoc](https://godoc.org/github.com/openzipkin/zipkin-go?status.svg)](https://godoc.org/github.com/openzipkin/zipkin-go) +[![Gitter chat](https://badges.gitter.im/openzipkin/zipkin.svg)](https://gitter.im/openzipkin/zipkin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Sourcegraph](https://sourcegraph.com/github.com/openzipkin/zipkin-go/-/badge.svg)](https://sourcegraph.com/github.com/openzipkin/zipkin-go?badge) + +Zipkin Go is the official Go Tracer implementation for Zipkin, supported by the +OpenZipkin community. + +## package organization +`zipkin-go` is built with interoperability in mind within the OpenZipkin +community and even 3rd parties, the library consists of several packages. + +The main tracing implementation can be found in the root folder of this +repository. Reusable parts not considered core implementation or deemed +beneficiary for usage by others are placed in their own packages within this +repository. + +### model +This library implements the Zipkin V2 Span Model which is available in the model +package. It contains a Go data model compatible with the Zipkin V2 API and can +automatically sanitize, parse and (de)serialize to and from the required JSON +representation as used by the official Zipkin V2 Collectors. + +### propagation +The propagation package and B3 subpackage hold the logic for propagating +SpanContext (span identifiers and sampling flags) between services participating +in traces. Currently Zipkin B3 Propagation is supported for HTTP and GRPC. + +### middleware +The middleware subpackages contain officially supported middleware handlers and +tracing wrappers. + +#### http +An easy to use http.Handler middleware for tracing server side requests is +provided. This allows one to use this middleware in applications using +standard library servers as well as most available higher level frameworks. Some +frameworks will have their own instrumentation and middleware that maps better +for their ecosystem. + +For HTTP client operations `NewTransport` can return a `http.RoundTripper` +implementation that can either wrap the standard http.Client's Transport or a +custom provided one and add per request tracing. Since HTTP Requests can have +one or multiple redirects it is advisable to always enclose HTTP Client calls +with a `Span` either around the `*http.Client` call level or parent function +level. + +For convenience `NewClient` is provided which returns a HTTP Client which embeds +`*http.Client` and provides an `application span` around the HTTP calls when +calling the `DoWithAppSpan()` method. + +#### grpc +Easy to use grpc.StatsHandler middleware are provided for tracing gRPC server and +client requests. + +For a server, pass `NewServerHandler` when calling `NewServer`, e.g., + +```go +import ( + "google.golang.org/grpc" + zipkingrpc "github.com/openzipkin/zipkin-go/middleware/grpc" +) + +server = grpc.NewServer(grpc.StatsHandler(zipkingrpc.NewServerHandler(tracer))) +``` + +For a client, pass `NewClientHandler` when calling `Dial`, e.g., + +```go +import ( + "google.golang.org/grpc" + zipkingrpc "github.com/openzipkin/zipkin-go/middleware/grpc" +) + +conn, err = grpc.Dial(addr, grpc.WithStatsHandler(zipkingrpc.NewClientHandler(tracer))) +``` + +### reporter +The reporter package holds the interface which the various Reporter +implementations use. It is exported into its own package as it can be used by +3rd parties to use these Reporter packages in their own libraries for exporting +to the Zipkin ecosystem. The `zipkin-go` tracer also uses the interface to +accept 3rd party Reporter implementations. + +#### HTTP Reporter +Most common Reporter type used by Zipkin users transporting Spans to the Zipkin +server using JSON over HTTP. The reporter holds a buffer and reports to the +backend asynchronously. + +#### Kafka Reporter +High performance Reporter transporting Spans to the Zipkin server using a Kafka +Producer digesting JSON V2 Spans. The reporter uses the +[Sarama async producer](https://godoc.org/github.com/Shopify/sarama#AsyncProducer) +underneath. + +## usage and examples +[HTTP Server Example](examples/httpserver_test.go) diff --git a/vendor/github.com/openzipkin/zipkin-go/context.go b/vendor/github.com/openzipkin/zipkin-go/context.go new file mode 100644 index 000000000..4b4e4c2d1 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/context.go @@ -0,0 +1,52 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "context" +) + +var defaultNoopSpan = &noopSpan{} + +// SpanFromContext retrieves a Zipkin Span from Go's context propagation +// mechanism if found. If not found, returns nil. +func SpanFromContext(ctx context.Context) Span { + if s, ok := ctx.Value(spanKey).(Span); ok { + return s + } + return nil +} + +// SpanOrNoopFromContext retrieves a Zipkin Span from Go's context propagation +// mechanism if found. If not found, returns a noopSpan. +// This function typically is used for modules that want to provide existing +// Zipkin spans with additional data, but can't guarantee that spans are +// properly propagated. It is preferred to use SpanFromContext() and test for +// Nil instead of using this function. +func SpanOrNoopFromContext(ctx context.Context) Span { + if s, ok := ctx.Value(spanKey).(Span); ok { + return s + } + return defaultNoopSpan +} + +// NewContext stores a Zipkin Span into Go's context propagation mechanism. +func NewContext(ctx context.Context, s Span) context.Context { + return context.WithValue(ctx, spanKey, s) +} + +type ctxKey struct{} + +var spanKey = ctxKey{} diff --git a/vendor/github.com/openzipkin/zipkin-go/doc.go b/vendor/github.com/openzipkin/zipkin-go/doc.go new file mode 100644 index 000000000..9c4a1c803 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/doc.go @@ -0,0 +1,20 @@ +// Copyright 2021 The OpenZipkin 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 zipkin implements a native Zipkin instrumentation library for Go. + +See https://zipkin.io for more information about Zipkin. +*/ +package zipkin diff --git a/vendor/github.com/openzipkin/zipkin-go/endpoint.go b/vendor/github.com/openzipkin/zipkin-go/endpoint.go new file mode 100644 index 000000000..e1209f069 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/endpoint.go @@ -0,0 +1,81 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "fmt" + "net" + "strconv" + "strings" + + "github.com/openzipkin/zipkin-go/model" +) + +// NewEndpoint creates a new endpoint given the provided serviceName and +// hostPort. +func NewEndpoint(serviceName string, hostPort string) (*model.Endpoint, error) { + e := &model.Endpoint{ + ServiceName: serviceName, + } + + if hostPort == "" || hostPort == ":0" { + if serviceName == "" { + // if all properties are empty we should not have an Endpoint object. + return nil, nil + } + return e, nil + } + + if strings.IndexByte(hostPort, ':') < 0 { + hostPort += ":0" + } + + host, port, err := net.SplitHostPort(hostPort) + if err != nil { + return nil, err + } + + p, err := strconv.ParseUint(port, 10, 16) + if err != nil { + return nil, err + } + e.Port = uint16(p) + + addrs, err := net.LookupIP(host) + if err != nil { + return nil, fmt.Errorf("host lookup failure: %w", err) + } + + for i := range addrs { + addr := addrs[i].To4() + if addr == nil { + // IPv6 - 16 bytes + if e.IPv6 == nil { + e.IPv6 = addrs[i].To16() + } + } else { + // IPv4 - 4 bytes + if e.IPv4 == nil { + e.IPv4 = addr + } + } + if e.IPv4 != nil && e.IPv6 != nil { + // Both IPv4 & IPv6 have been set, done... + break + } + } + + return e, nil +} diff --git a/vendor/github.com/openzipkin/zipkin-go/go.mod b/vendor/github.com/openzipkin/zipkin-go/go.mod new file mode 100644 index 000000000..162e9a7ec --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/go.mod @@ -0,0 +1,12 @@ +module github.com/openzipkin/zipkin-go + +require ( + github.com/Shopify/sarama v1.30.0 + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.16.0 + github.com/rabbitmq/amqp091-go v1.1.0 + google.golang.org/grpc v1.41.0 + google.golang.org/protobuf v1.27.1 +) + +go 1.14 diff --git a/vendor/github.com/openzipkin/zipkin-go/go.sum b/vendor/github.com/openzipkin/zipkin-go/go.sum new file mode 100644 index 000000000..502268339 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/go.sum @@ -0,0 +1,247 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Shopify/sarama v1.30.0 h1:TOZL6r37xJBDEMLx4yjB77jxbZYXPaDow08TSK6vIL0= +github.com/Shopify/sarama v1.30.0/go.mod h1:zujlQQx1kzHsh4jfV1USnptCQrHAEZ2Hk8fTKCulPVs= +github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae h1:ePgznFqEG1v3AjMklnK8H7BSc++FDSo7xfK9K7Af+0Y= +github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +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/eapache/go-resiliency v1.2.0 h1:v7g92e/KSN71Rq7vSThKaWIq68fL4YHvWyiUKorFR1Q= +github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +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 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +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= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8= +github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= +github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo= +github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= +github.com/jcmturner/gofork v1.0.0 h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8= +github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= +github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o= +github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= +github.com/jcmturner/gokrb5/v8 v8.4.2 h1:6ZIM6b/JJN0X8UM43ZOM6Z4SJzla+a/u7scXFJzodkA= +github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= +github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= +github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +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/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c= +github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= +github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +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/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rabbitmq/amqp091-go v1.1.0 h1:qx8cGMJha71/5t31Z+LdPLdPrkj/BvD38cqC3Bi1pNI= +github.com/rabbitmq/amqp091-go v1.1.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +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 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210920023735-84f357641f63 h1:kETrAMYZq6WVGPa8IIixL0CaEcIUNi+1WX7grUoi3y8= +golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210917221730-978cfadd31cf h1:R150MpwJIv1MpS0N/pc+NhTM8ajzvlmxlY5OYsrevXQ= +golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= +google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/github.com/openzipkin/zipkin-go/idgenerator/idgenerator.go b/vendor/github.com/openzipkin/zipkin-go/idgenerator/idgenerator.go new file mode 100644 index 000000000..ca3b3131c --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/idgenerator/idgenerator.go @@ -0,0 +1,130 @@ +// Copyright 2021 The OpenZipkin 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 idgenerator contains several Span and Trace ID generators which can be +used by the Zipkin tracer. Additional third party generators can be plugged in +if they adhere to the IDGenerator interface. +*/ +package idgenerator + +import ( + "math/rand" + "sync" + "time" + + "github.com/openzipkin/zipkin-go/model" +) + +var ( + seededIDGen = rand.New(rand.NewSource(time.Now().UnixNano())) + // NewSource returns a new pseudo-random Source seeded with the given value. + // Unlike the default Source used by top-level functions, this source is not + // safe for concurrent use by multiple goroutines. Hence the need for a mutex. + seededIDLock sync.Mutex +) + +// IDGenerator interface can be used to provide the Zipkin Tracer with custom +// implementations to generate Span and Trace IDs. +type IDGenerator interface { + SpanID(traceID model.TraceID) model.ID // Generates a new Span ID + TraceID() model.TraceID // Generates a new Trace ID +} + +// NewRandom64 returns an ID Generator which can generate 64 bit trace and span +// id's +func NewRandom64() IDGenerator { + return &randomID64{} +} + +// NewRandom128 returns an ID Generator which can generate 128 bit trace and 64 +// bit span id's +func NewRandom128() IDGenerator { + return &randomID128{} +} + +// NewRandomTimestamped generates 128 bit time sortable traceid's and 64 bit +// spanid's. +func NewRandomTimestamped() IDGenerator { + return &randomTimestamped{} +} + +// randomID64 can generate 64 bit traceid's and 64 bit spanid's. +type randomID64 struct{} + +func (r *randomID64) TraceID() (id model.TraceID) { + seededIDLock.Lock() + id = model.TraceID{ + Low: uint64(seededIDGen.Int63()), + } + seededIDLock.Unlock() + return +} + +func (r *randomID64) SpanID(traceID model.TraceID) (id model.ID) { + if !traceID.Empty() { + return model.ID(traceID.Low) + } + seededIDLock.Lock() + id = model.ID(seededIDGen.Int63()) + seededIDLock.Unlock() + return +} + +// randomID128 can generate 128 bit traceid's and 64 bit spanid's. +type randomID128 struct{} + +func (r *randomID128) TraceID() (id model.TraceID) { + seededIDLock.Lock() + id = model.TraceID{ + High: uint64(seededIDGen.Int63()), + Low: uint64(seededIDGen.Int63()), + } + seededIDLock.Unlock() + return +} + +func (r *randomID128) SpanID(traceID model.TraceID) (id model.ID) { + if !traceID.Empty() { + return model.ID(traceID.Low) + } + seededIDLock.Lock() + id = model.ID(seededIDGen.Int63()) + seededIDLock.Unlock() + return +} + +// randomTimestamped can generate 128 bit time sortable traceid's compatible +// with AWS X-Ray and 64 bit spanid's. +type randomTimestamped struct{} + +func (t *randomTimestamped) TraceID() (id model.TraceID) { + seededIDLock.Lock() + id = model.TraceID{ + High: uint64(time.Now().Unix()<<32) + uint64(seededIDGen.Int31()), + Low: uint64(seededIDGen.Int63()), + } + seededIDLock.Unlock() + return +} + +func (t *randomTimestamped) SpanID(traceID model.TraceID) (id model.ID) { + if !traceID.Empty() { + return model.ID(traceID.Low) + } + seededIDLock.Lock() + id = model.ID(seededIDGen.Int63()) + seededIDLock.Unlock() + return +} diff --git a/vendor/github.com/openzipkin/zipkin-go/noop.go b/vendor/github.com/openzipkin/zipkin-go/noop.go new file mode 100644 index 000000000..e965b23c6 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/noop.go @@ -0,0 +1,48 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "time" + + "github.com/openzipkin/zipkin-go/model" +) + +type noopSpan struct { + model.SpanContext +} + +func (n *noopSpan) Context() model.SpanContext { return n.SpanContext } + +func (n *noopSpan) SetName(string) {} + +func (*noopSpan) SetRemoteEndpoint(*model.Endpoint) {} + +func (*noopSpan) Annotate(time.Time, string) {} + +func (*noopSpan) Tag(string, string) {} + +func (*noopSpan) Finish() {} + +func (*noopSpan) FinishedWithDuration(duration time.Duration) {} + +func (*noopSpan) Flush() {} + +// IsNoop tells whether the span is noop or not. Usually used to avoid resource misusage +// when customizing a span as data won't be recorded +func IsNoop(s Span) bool { + _, ok := s.(*noopSpan) + return ok +} diff --git a/vendor/github.com/openzipkin/zipkin-go/propagation/propagation.go b/vendor/github.com/openzipkin/zipkin-go/propagation/propagation.go new file mode 100644 index 000000000..7b70557c4 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/propagation/propagation.go @@ -0,0 +1,30 @@ +// Copyright 2021 The OpenZipkin 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 propagation holds the required function signatures for Injection and +Extraction as used by the Zipkin Tracer. + +Subpackages of this package contain officially supported standard propagation +implementations. +*/ +package propagation + +import "github.com/openzipkin/zipkin-go/model" + +// Extractor function signature +type Extractor func() (*model.SpanContext, error) + +// Injector function signature +type Injector func(model.SpanContext) error diff --git a/vendor/github.com/openzipkin/zipkin-go/reporter/http/http.go b/vendor/github.com/openzipkin/zipkin-go/reporter/http/http.go new file mode 100644 index 000000000..ee58ae92c --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/reporter/http/http.go @@ -0,0 +1,275 @@ +// Copyright 2021 The OpenZipkin 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 http implements a HTTP reporter to send spans to Zipkin V2 collectors. +*/ +package http + +import ( + "bytes" + "context" + "log" + "net/http" + "os" + "sync" + "time" + + "github.com/openzipkin/zipkin-go/model" + "github.com/openzipkin/zipkin-go/reporter" +) + +// defaults +const ( + defaultTimeout = 5 * time.Second // timeout for http request in seconds + defaultBatchInterval = 1 * time.Second // BatchInterval in seconds + defaultBatchSize = 100 + defaultMaxBacklog = 1000 +) + +// HTTPDoer will do a request to the Zipkin HTTP Collector +type HTTPDoer interface { // nolint: revive // keep as is, we don't want to break dependendants + Do(req *http.Request) (*http.Response, error) +} + +// httpReporter will send spans to a Zipkin HTTP Collector using Zipkin V2 API. +type httpReporter struct { + url string + client HTTPDoer + logger *log.Logger + batchInterval time.Duration + batchSize int + maxBacklog int + batchMtx *sync.Mutex + batch []*model.SpanModel + spanC chan *model.SpanModel + sendC chan struct{} + quit chan struct{} + shutdown chan error + reqCallback RequestCallbackFn + reqTimeout time.Duration + serializer reporter.SpanSerializer +} + +// Send implements reporter +func (r *httpReporter) Send(s model.SpanModel) { + r.spanC <- &s +} + +// Close implements reporter +func (r *httpReporter) Close() error { + close(r.quit) + return <-r.shutdown +} + +func (r *httpReporter) loop() { + var ( + nextSend = time.Now().Add(r.batchInterval) + ticker = time.NewTicker(r.batchInterval / 10) + tickerChan = ticker.C + ) + defer ticker.Stop() + + for { + select { + case span := <-r.spanC: + currentBatchSize := r.append(span) + if currentBatchSize >= r.batchSize { + nextSend = time.Now().Add(r.batchInterval) + r.enqueueSend() + } + case <-tickerChan: + if time.Now().After(nextSend) { + nextSend = time.Now().Add(r.batchInterval) + r.enqueueSend() + } + case <-r.quit: + close(r.sendC) + return + } + } +} + +func (r *httpReporter) sendLoop() { + for range r.sendC { + _ = r.sendBatch() + } + r.shutdown <- r.sendBatch() +} + +func (r *httpReporter) enqueueSend() { + select { + case r.sendC <- struct{}{}: + default: + // Do nothing if there's a pending send request already + } +} + +func (r *httpReporter) append(span *model.SpanModel) (newBatchSize int) { + r.batchMtx.Lock() + + r.batch = append(r.batch, span) + if len(r.batch) > r.maxBacklog { + dispose := len(r.batch) - r.maxBacklog + r.logger.Printf("backlog too long, disposing %d spans", dispose) + r.batch = r.batch[dispose:] + } + newBatchSize = len(r.batch) + + r.batchMtx.Unlock() + return +} + +func (r *httpReporter) sendBatch() error { + // Select all current spans in the batch to be sent + r.batchMtx.Lock() + sendBatch := r.batch[:] + r.batchMtx.Unlock() + + if len(sendBatch) == 0 { + return nil + } + + body, err := r.serializer.Serialize(sendBatch) + if err != nil { + r.logger.Printf("failed when marshalling the spans batch: %s\n", err.Error()) + return err + } + + req, err := http.NewRequest("POST", r.url, bytes.NewReader(body)) + if err != nil { + r.logger.Printf("failed when creating the request: %s\n", err.Error()) + return err + } + + // By default we send b3:0 header to mitigate trace reporting amplification in + // service mesh environments where the sidecar proxies might trace the call + // we do here towards the Zipkin collector. + req.Header.Set("b3", "0") + + req.Header.Set("Content-Type", r.serializer.ContentType()) + if r.reqCallback != nil { + r.reqCallback(req) + } + + ctx, cancel := context.WithTimeout(req.Context(), r.reqTimeout) + defer cancel() + + resp, err := r.client.Do(req.WithContext(ctx)) + if err != nil { + r.logger.Printf("failed to send the request: %s\n", err.Error()) + return err + } + _ = resp.Body.Close() + if resp.StatusCode < 200 || resp.StatusCode > 299 { + r.logger.Printf("failed the request with status code %d\n", resp.StatusCode) + } + + // Remove sent spans from the batch even if they were not saved + r.batchMtx.Lock() + r.batch = r.batch[len(sendBatch):] + r.batchMtx.Unlock() + + return nil +} + +// RequestCallbackFn receives the initialized request from the Collector before +// sending it over the wire. This allows one to plug in additional headers or +// do other customization. +type RequestCallbackFn func(*http.Request) + +// ReporterOption sets a parameter for the HTTP Reporter +type ReporterOption func(r *httpReporter) + +// Timeout sets maximum timeout for the http request through its context. +func Timeout(duration time.Duration) ReporterOption { + return func(r *httpReporter) { r.reqTimeout = duration } +} + +// BatchSize sets the maximum batch size, after which a collect will be +// triggered. The default batch size is 100 traces. +func BatchSize(n int) ReporterOption { + return func(r *httpReporter) { r.batchSize = n } +} + +// MaxBacklog sets the maximum backlog size. When batch size reaches this +// threshold, spans from the beginning of the batch will be disposed. +func MaxBacklog(n int) ReporterOption { + return func(r *httpReporter) { r.maxBacklog = n } +} + +// BatchInterval sets the maximum duration we will buffer traces before +// emitting them to the collector. The default batch interval is 1 second. +func BatchInterval(d time.Duration) ReporterOption { + return func(r *httpReporter) { r.batchInterval = d } +} + +// Client sets a custom http client to use under the interface HTTPDoer +// which includes a `Do` method with same signature as the *http.Client +func Client(client HTTPDoer) ReporterOption { + return func(r *httpReporter) { r.client = client } +} + +// RequestCallback registers a callback function to adjust the reporter +// *http.Request before it sends the request to Zipkin. +func RequestCallback(rc RequestCallbackFn) ReporterOption { + return func(r *httpReporter) { r.reqCallback = rc } +} + +// Logger sets the logger used to report errors in the collection +// process. +func Logger(l *log.Logger) ReporterOption { + return func(r *httpReporter) { r.logger = l } +} + +// Serializer sets the serialization function to use for sending span data to +// Zipkin. +func Serializer(serializer reporter.SpanSerializer) ReporterOption { + return func(r *httpReporter) { + if serializer != nil { + r.serializer = serializer + } + } +} + +// NewReporter returns a new HTTP Reporter. +// url should be the endpoint to send the spans to, e.g. +// http://localhost:9411/api/v2/spans +func NewReporter(url string, opts ...ReporterOption) reporter.Reporter { + r := httpReporter{ + url: url, + logger: log.New(os.Stderr, "", log.LstdFlags), + client: &http.Client{}, + batchInterval: defaultBatchInterval, + batchSize: defaultBatchSize, + maxBacklog: defaultMaxBacklog, + batch: []*model.SpanModel{}, + spanC: make(chan *model.SpanModel), + sendC: make(chan struct{}, 1), + quit: make(chan struct{}, 1), + shutdown: make(chan error, 1), + batchMtx: &sync.Mutex{}, + serializer: reporter.JSONSerializer{}, + reqTimeout: defaultTimeout, + } + + for _, opt := range opts { + opt(&r) + } + + go r.loop() + go r.sendLoop() + + return &r +} diff --git a/vendor/github.com/openzipkin/zipkin-go/reporter/reporter.go b/vendor/github.com/openzipkin/zipkin-go/reporter/reporter.go new file mode 100644 index 000000000..ad28bf797 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/reporter/reporter.go @@ -0,0 +1,41 @@ +// Copyright 2021 The OpenZipkin 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 reporter holds the Reporter interface which is used by the Zipkin +Tracer to send finished spans. + +Subpackages of package reporter contain officially supported standard +reporter implementations. +*/ +package reporter + +import "github.com/openzipkin/zipkin-go/model" + +// Reporter interface can be used to provide the Zipkin Tracer with custom +// implementations to publish Zipkin Span data. +type Reporter interface { + Send(model.SpanModel) // Send Span data to the reporter + Close() error // Close the reporter +} + +type noopReporter struct{} + +func (r *noopReporter) Send(model.SpanModel) {} +func (r *noopReporter) Close() error { return nil } + +// NewNoopReporter returns a no-op Reporter implementation. +func NewNoopReporter() Reporter { + return &noopReporter{} +} diff --git a/vendor/github.com/openzipkin/zipkin-go/reporter/serializer.go b/vendor/github.com/openzipkin/zipkin-go/reporter/serializer.go new file mode 100644 index 000000000..5fbe39c54 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/reporter/serializer.go @@ -0,0 +1,42 @@ +// Copyright 2021 The OpenZipkin 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 reporter + +import ( + "encoding/json" + + "github.com/openzipkin/zipkin-go/model" +) + +// SpanSerializer describes the methods needed for allowing to set Span encoding +// type for the various Zipkin transports. +type SpanSerializer interface { + Serialize([]*model.SpanModel) ([]byte, error) + ContentType() string +} + +// JSONSerializer implements the default JSON encoding SpanSerializer. +type JSONSerializer struct{} + +// Serialize takes an array of Zipkin SpanModel objects and returns a JSON +// encoding of it. +func (JSONSerializer) Serialize(spans []*model.SpanModel) ([]byte, error) { + return json.Marshal(spans) +} + +// ContentType returns the ContentType needed for this encoding. +func (JSONSerializer) ContentType() string { + return "application/json" +} diff --git a/vendor/github.com/openzipkin/zipkin-go/sample.go b/vendor/github.com/openzipkin/zipkin-go/sample.go new file mode 100644 index 000000000..2928c6079 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/sample.go @@ -0,0 +1,127 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "fmt" + "math" + "math/rand" + "sync" + "time" +) + +// Sampler functions return if a Zipkin span should be sampled, based on its +// traceID. +type Sampler func(id uint64) bool + +// NeverSample will always return false. If used by a service it will not allow +// the service to start traces but will still allow the service to participate +// in traces started upstream. +func NeverSample(_ uint64) bool { return false } + +// AlwaysSample will always return true. If used by a service it will always start +// traces if no upstream trace has been propagated. If an incoming upstream trace +// is not sampled the service will adhere to this and only propagate the context. +func AlwaysSample(_ uint64) bool { return true } + +// NewModuloSampler provides a generic type Sampler. +func NewModuloSampler(mod uint64) Sampler { + if mod < 2 { + return AlwaysSample + } + return func(id uint64) bool { + return (id % mod) == 0 + } +} + +// NewBoundarySampler is appropriate for high-traffic instrumentation who +// provision random trace ids, and make the sampling decision only once. +// It defends against nodes in the cluster selecting exactly the same ids. +func NewBoundarySampler(rate float64, salt int64) (Sampler, error) { + if rate == 0.0 { + return NeverSample, nil + } + if rate == 1.0 { + return AlwaysSample, nil + } + if rate < 0.0001 || rate > 1 { + return nil, fmt.Errorf("rate should be 0.0 or between 0.0001 and 1: was %f", rate) + } + + var ( + boundary = int64(rate * 10000) + usalt = uint64(salt) + ) + return func(id uint64) bool { + return int64(math.Abs(float64(id^usalt)))%10000 < boundary + }, nil +} + +// NewCountingSampler is appropriate for low-traffic instrumentation or +// those who do not provision random trace ids. It is not appropriate for +// collectors as the sampling decision isn't idempotent (consistent based +// on trace id). +func NewCountingSampler(rate float64) (Sampler, error) { + if rate == 0.0 { + return NeverSample, nil + } + if rate == 1.0 { + return AlwaysSample, nil + } + if rate < 0.01 || rate > 1 { + return nil, fmt.Errorf("rate should be 0.0 or between 0.01 and 1: was %f", rate) + } + var ( + i = 0 + outOf100 = int(rate*100 + math.Copysign(0.5, rate*100)) // for rounding float to int conversion instead of truncation + decisions = randomBitSet(100, outOf100, rand.New(rand.NewSource(time.Now().UnixNano()))) + mtx = &sync.Mutex{} + ) + + return func(_ uint64) bool { + mtx.Lock() + result := decisions[i] + i++ + if i == 100 { + i = 0 + } + mtx.Unlock() + return result + }, nil +} + +/** + * Reservoir sampling algorithm borrowed from Stack Overflow. + * + * http://stackoverflow.com/questions/12817946/generate-a-random-bitset-with-n-1s + */ +func randomBitSet(size int, cardinality int, rnd *rand.Rand) []bool { + result := make([]bool, size) + chosen := make([]int, cardinality) + var i int + for i = 0; i < cardinality; i++ { + chosen[i] = i + result[i] = true + } + for ; i < size; i++ { + j := rnd.Intn(i + 1) + if j < cardinality { + result[chosen[j]] = false + result[i] = true + chosen[j] = i + } + } + return result +} diff --git a/vendor/github.com/openzipkin/zipkin-go/span.go b/vendor/github.com/openzipkin/zipkin-go/span.go new file mode 100644 index 000000000..79426cdca --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/span.go @@ -0,0 +1,58 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "time" + + "github.com/openzipkin/zipkin-go/model" +) + +// Span interface as returned by Tracer.StartSpan() +type Span interface { + // Context returns the Span's SpanContext. + Context() model.SpanContext + + // SetName updates the Span's name. + SetName(string) + + // SetRemoteEndpoint updates the Span's Remote Endpoint. + SetRemoteEndpoint(*model.Endpoint) + + // Annotate adds a timed event to the Span. + Annotate(time.Time, string) + + // Tag sets Tag with given key and value to the Span. If key already exists in + // the Span the value will be overridden except for error tags where the first + // value is persisted. + Tag(string, string) + + // Finish the Span and send to Reporter. If DelaySend option was used at + // Span creation time, Finish will not send the Span to the Reporter. It then + // becomes the user's responsibility to get the Span reported (by using + // span.Flush). + Finish() + + // Finish the Span with duration and send to Reporter. If DelaySend option was used at + // Span creation time, FinishedWithDuration will not send the Span to the Reporter. It then + // becomes the user's responsibility to get the Span reported (by using + // span.Flush). + FinishedWithDuration(duration time.Duration) + + // Flush the Span to the Reporter (regardless of being finished or not). + // This can be used if the DelaySend SpanOption was set or when dealing with + // one-way RPC tracing where duration might not be measured. + Flush() +} diff --git a/vendor/github.com/openzipkin/zipkin-go/span_implementation.go b/vendor/github.com/openzipkin/zipkin-go/span_implementation.go new file mode 100644 index 000000000..79992c914 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/span_implementation.go @@ -0,0 +1,101 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "sync" + "sync/atomic" + "time" + + "github.com/openzipkin/zipkin-go/model" +) + +type spanImpl struct { + mtx sync.RWMutex + model.SpanModel + tracer *Tracer + mustCollect int32 // used as atomic bool (1 = true, 0 = false) + flushOnFinish bool +} + +func (s *spanImpl) Context() model.SpanContext { + return s.SpanContext +} + +func (s *spanImpl) SetName(name string) { + s.mtx.Lock() + s.Name = name + s.mtx.Unlock() +} + +func (s *spanImpl) SetRemoteEndpoint(e *model.Endpoint) { + s.mtx.Lock() + if e == nil { + s.RemoteEndpoint = nil + } else { + s.RemoteEndpoint = &model.Endpoint{} + *s.RemoteEndpoint = *e + } + s.mtx.Unlock() +} + +func (s *spanImpl) Annotate(t time.Time, value string) { + a := model.Annotation{ + Timestamp: t, + Value: value, + } + + s.mtx.Lock() + s.Annotations = append(s.Annotations, a) + s.mtx.Unlock() +} + +func (s *spanImpl) Tag(key, value string) { + s.mtx.Lock() + + if key == string(TagError) { + if _, found := s.Tags[key]; found { + s.mtx.Unlock() + return + } + } + + s.Tags[key] = value + s.mtx.Unlock() +} + +func (s *spanImpl) Finish() { + if atomic.CompareAndSwapInt32(&s.mustCollect, 1, 0) { + s.Duration = time.Since(s.Timestamp) + if s.flushOnFinish { + s.tracer.reporter.Send(s.SpanModel) + } + } +} + +func (s *spanImpl) FinishedWithDuration(d time.Duration) { + if atomic.CompareAndSwapInt32(&s.mustCollect, 1, 0) { + s.Duration = d + if s.flushOnFinish { + s.tracer.reporter.Send(s.SpanModel) + } + } +} + +func (s *spanImpl) Flush() { + if s.SpanModel.Debug || (s.SpanModel.Sampled != nil && *s.SpanModel.Sampled) { + s.tracer.reporter.Send(s.SpanModel) + } +} diff --git a/vendor/github.com/openzipkin/zipkin-go/span_options.go b/vendor/github.com/openzipkin/zipkin-go/span_options.go new file mode 100644 index 000000000..9ffe4bc6c --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/span_options.go @@ -0,0 +1,88 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "time" + + "github.com/openzipkin/zipkin-go/model" +) + +// SpanOption allows for functional options to adjust behavior and payload of +// the Span to be created with tracer.StartSpan(). +type SpanOption func(t *Tracer, s *spanImpl) + +// Kind sets the kind of the span being created.. +func Kind(kind model.Kind) SpanOption { + return func(t *Tracer, s *spanImpl) { + s.Kind = kind + } +} + +// Parent will use provided SpanContext as parent to the span being created. +func Parent(sc model.SpanContext) SpanOption { + return func(t *Tracer, s *spanImpl) { + if sc.Err != nil { + // encountered an extraction error + switch t.extractFailurePolicy { + case ExtractFailurePolicyRestart: + case ExtractFailurePolicyError: + panic(s.SpanContext.Err) + case ExtractFailurePolicyTagAndRestart: + s.Tags["error.extract"] = sc.Err.Error() + default: + panic(ErrInvalidExtractFailurePolicy) + } + /* don't use provided SpanContext, but restart trace */ + return + } + s.SpanContext = sc + } +} + +// StartTime uses a given start time for the span being created. +func StartTime(start time.Time) SpanOption { + return func(t *Tracer, s *spanImpl) { + s.Timestamp = start + } +} + +// RemoteEndpoint sets the remote endpoint of the span being created. +func RemoteEndpoint(e *model.Endpoint) SpanOption { + return func(t *Tracer, s *spanImpl) { + s.RemoteEndpoint = e + } +} + +// Tags sets initial tags for the span being created. If default tracer tags +// are present they will be overwritten on key collisions. +func Tags(tags map[string]string) SpanOption { + return func(t *Tracer, s *spanImpl) { + for k, v := range tags { + s.Tags[k] = v + } + } +} + +// FlushOnFinish when set to false will disable span.Finish() to send the Span +// to the Reporter automatically (which is the default behavior). If set to +// false, having the Span be reported becomes the responsibility of the user. +// This is available if late tag data is expected to be only available after the +// required finish time of the Span. +func FlushOnFinish(b bool) SpanOption { + return func(t *Tracer, s *spanImpl) { + s.flushOnFinish = b + } +} diff --git a/vendor/github.com/openzipkin/zipkin-go/tags.go b/vendor/github.com/openzipkin/zipkin-go/tags.go new file mode 100644 index 000000000..2bdd7da3f --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/tags.go @@ -0,0 +1,37 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +// Tag holds available types +type Tag string + +// Common Tag values +const ( + TagHTTPMethod Tag = "http.method" + TagHTTPPath Tag = "http.path" + TagHTTPUrl Tag = "http.url" + TagHTTPRoute Tag = "http.route" + TagHTTPStatusCode Tag = "http.status_code" + TagHTTPRequestSize Tag = "http.request.size" + TagHTTPResponseSize Tag = "http.response.size" + TagGRPCStatusCode Tag = "grpc.status_code" + TagSQLQuery Tag = "sql.query" + TagError Tag = "error" +) + +// Set a standard Tag with a payload on provided Span. +func (t Tag) Set(s Span, value string) { + s.Tag(string(t), value) +} diff --git a/vendor/github.com/openzipkin/zipkin-go/tracer.go b/vendor/github.com/openzipkin/zipkin-go/tracer.go new file mode 100644 index 000000000..084cdfc80 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/tracer.go @@ -0,0 +1,187 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "context" + "sync/atomic" + "time" + + "github.com/openzipkin/zipkin-go/idgenerator" + "github.com/openzipkin/zipkin-go/model" + "github.com/openzipkin/zipkin-go/propagation" + "github.com/openzipkin/zipkin-go/reporter" +) + +// Tracer is our Zipkin tracer implementation. It should be initialized using +// the NewTracer method. +type Tracer struct { + defaultTags map[string]string + extractFailurePolicy ExtractFailurePolicy + sampler Sampler + generate idgenerator.IDGenerator + reporter reporter.Reporter + localEndpoint *model.Endpoint + noop int32 // used as atomic bool (1 = true, 0 = false) + sharedSpans bool + unsampledNoop bool +} + +// NewTracer returns a new Zipkin Tracer. +func NewTracer(rep reporter.Reporter, opts ...TracerOption) (*Tracer, error) { + // set default tracer options + t := &Tracer{ + defaultTags: make(map[string]string), + extractFailurePolicy: ExtractFailurePolicyRestart, + sampler: AlwaysSample, + generate: idgenerator.NewRandom64(), + reporter: rep, + localEndpoint: nil, + noop: 0, + sharedSpans: true, + unsampledNoop: false, + } + + // if no reporter was provided we default to noop implementation. + if t.reporter == nil { + t.reporter = reporter.NewNoopReporter() + t.noop = 1 + } + + // process functional options + for _, opt := range opts { + if err := opt(t); err != nil { + return nil, err + } + } + + return t, nil +} + +// StartSpanFromContext creates and starts a span using the span found in +// context as parent. If no parent span is found a root span is created. +func (t *Tracer) StartSpanFromContext(ctx context.Context, name string, options ...SpanOption) (Span, context.Context) { + if parentSpan := SpanFromContext(ctx); parentSpan != nil { + options = append(options, Parent(parentSpan.Context())) + } + span := t.StartSpan(name, options...) + return span, NewContext(ctx, span) +} + +// StartSpan creates and starts a span. +func (t *Tracer) StartSpan(name string, options ...SpanOption) Span { + if atomic.LoadInt32(&t.noop) == 1 { + return &noopSpan{} + } + s := &spanImpl{ + SpanModel: model.SpanModel{ + Kind: model.Undetermined, + Name: name, + LocalEndpoint: t.localEndpoint, + Annotations: make([]model.Annotation, 0), + Tags: make(map[string]string), + }, + flushOnFinish: true, + tracer: t, + } + + // add default tracer tags to span + for k, v := range t.defaultTags { + s.Tag(k, v) + } + + // handle provided functional options + for _, option := range options { + option(t, s) + } + + if s.TraceID.Empty() { + // create root span + s.SpanContext.TraceID = t.generate.TraceID() + s.SpanContext.ID = t.generate.SpanID(s.SpanContext.TraceID) + } else { + // valid parent context found + if t.sharedSpans && s.Kind == model.Server { + // join span + s.Shared = true + } else { + // regular child span + parentID := s.SpanContext.ID + s.SpanContext.ParentID = &parentID + s.SpanContext.ID = t.generate.SpanID(model.TraceID{}) + } + } + + if !s.SpanContext.Debug && s.Sampled == nil { + // deferred sampled context found, invoke sampler + sampled := t.sampler(s.SpanContext.TraceID.Low) + s.SpanContext.Sampled = &sampled + if sampled { + s.mustCollect = 1 + } + } else { + if s.SpanContext.Debug || *s.Sampled { + s.mustCollect = 1 + } + } + + if t.unsampledNoop && s.mustCollect == 0 { + // trace not being sampled and noop requested + return &noopSpan{ + SpanContext: s.SpanContext, + } + } + + // add start time + if s.Timestamp.IsZero() { + s.Timestamp = time.Now() + } + + return s +} + +// Extract extracts a SpanContext using the provided Extractor function. +func (t *Tracer) Extract(extractor propagation.Extractor) (sc model.SpanContext) { + if atomic.LoadInt32(&t.noop) == 1 { + return + } + psc, err := extractor() + if psc != nil { + sc = *psc + } + sc.Err = err + return +} + +// SetNoop allows for killswitch behavior. If set to true the tracer will return +// noopSpans and all data is dropped. This allows operators to stop tracing in +// risk scenarios. Set back to false to resume tracing. +func (t *Tracer) SetNoop(noop bool) { + if noop { + atomic.CompareAndSwapInt32(&t.noop, 0, 1) + } else { + atomic.CompareAndSwapInt32(&t.noop, 1, 0) + } +} + +// LocalEndpoint returns a copy of the currently set local endpoint of the +// tracer instance. +func (t *Tracer) LocalEndpoint() *model.Endpoint { + if t.localEndpoint == nil { + return nil + } + ep := *t.localEndpoint + return &ep +} diff --git a/vendor/github.com/openzipkin/zipkin-go/tracer_options.go b/vendor/github.com/openzipkin/zipkin-go/tracer_options.go new file mode 100644 index 000000000..3b56e2c31 --- /dev/null +++ b/vendor/github.com/openzipkin/zipkin-go/tracer_options.go @@ -0,0 +1,138 @@ +// Copyright 2021 The OpenZipkin 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 zipkin + +import ( + "errors" + + "github.com/openzipkin/zipkin-go/idgenerator" + "github.com/openzipkin/zipkin-go/model" +) + +// Tracer Option Errors +var ( + ErrInvalidEndpoint = errors.New("requires valid local endpoint") + ErrInvalidExtractFailurePolicy = errors.New("invalid extract failure policy provided") +) + +// ExtractFailurePolicy deals with Extraction errors +type ExtractFailurePolicy int + +// ExtractFailurePolicyOptions +const ( + ExtractFailurePolicyRestart ExtractFailurePolicy = iota + ExtractFailurePolicyError + ExtractFailurePolicyTagAndRestart +) + +// TracerOption allows for functional options to adjust behavior of the Tracer +// to be created with NewTracer(). +type TracerOption func(o *Tracer) error + +// WithLocalEndpoint sets the local endpoint of the tracer. +func WithLocalEndpoint(e *model.Endpoint) TracerOption { + return func(o *Tracer) error { + if e == nil { + o.localEndpoint = nil + return nil + } + ep := *e + o.localEndpoint = &ep + return nil + } +} + +// WithExtractFailurePolicy allows one to set the ExtractFailurePolicy. +func WithExtractFailurePolicy(p ExtractFailurePolicy) TracerOption { + return func(o *Tracer) error { + if p < 0 || p > ExtractFailurePolicyTagAndRestart { + return ErrInvalidExtractFailurePolicy + } + o.extractFailurePolicy = p + return nil + } +} + +// WithNoopSpan if set to true will switch to a NoopSpan implementation +// if the trace is not sampled. +func WithNoopSpan(unsampledNoop bool) TracerOption { + return func(o *Tracer) error { + o.unsampledNoop = unsampledNoop + return nil + } +} + +// WithSharedSpans allows to place client-side and server-side annotations +// for a RPC call in the same span (Zipkin V1 behavior) or different spans +// (more in line with other tracing solutions). By default this Tracer +// uses shared host spans (so client-side and server-side in the same span). +func WithSharedSpans(val bool) TracerOption { + return func(o *Tracer) error { + o.sharedSpans = val + return nil + } +} + +// WithSampler allows one to set a Sampler function +func WithSampler(sampler Sampler) TracerOption { + return func(o *Tracer) error { + o.sampler = sampler + return nil + } +} + +// WithTraceID128Bit if set to true will instruct the Tracer to start traces +// with 128 bit TraceID's. If set to false the Tracer will start traces with +// 64 bits. +func WithTraceID128Bit(val bool) TracerOption { + return func(o *Tracer) error { + if val { + o.generate = idgenerator.NewRandom128() + } else { + o.generate = idgenerator.NewRandom64() + } + return nil + } +} + +// WithIDGenerator allows one to set a custom ID Generator +func WithIDGenerator(generator idgenerator.IDGenerator) TracerOption { + return func(o *Tracer) error { + o.generate = generator + return nil + } +} + +// WithTags allows one to set default tags to be added to each created span +func WithTags(tags map[string]string) TracerOption { + return func(o *Tracer) error { + for k, v := range tags { + o.defaultTags[k] = v + } + return nil + } +} + +// WithNoopTracer allows one to start the Tracer as Noop implementation. +func WithNoopTracer(tracerNoop bool) TracerOption { + return func(o *Tracer) error { + if tracerNoop { + o.noop = 1 + } else { + o.noop = 0 + } + return nil + } +} diff --git a/vendor/github.com/pelletier/go-toml/v2/.dockerignore b/vendor/github.com/pelletier/go-toml/v2/.dockerignore new file mode 100644 index 000000000..7b5883475 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/.dockerignore @@ -0,0 +1,2 @@ +cmd/tomll/tomll +cmd/tomljson/tomljson diff --git a/vendor/github.com/pelletier/go-toml/v2/.gitignore b/vendor/github.com/pelletier/go-toml/v2/.gitignore new file mode 100644 index 000000000..e6ba63a5c --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/.gitignore @@ -0,0 +1,5 @@ +test_program/test_program_bin +fuzz/ +cmd/tomll/tomll +cmd/tomljson/tomljson +cmd/tomltestgen/tomltestgen diff --git a/vendor/github.com/pelletier/go-toml/v2/.golangci.toml b/vendor/github.com/pelletier/go-toml/v2/.golangci.toml new file mode 100644 index 000000000..fdf167b4a --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/.golangci.toml @@ -0,0 +1,84 @@ +[service] +golangci-lint-version = "1.39.0" + +[linters-settings.wsl] +allow-assign-and-anything = true + +[linters-settings.exhaustive] +default-signifies-exhaustive = true + +[linters] +disable-all = true +enable = [ + "asciicheck", + "bodyclose", + "cyclop", + "deadcode", + "depguard", + "dogsled", + "dupl", + "durationcheck", + "errcheck", + "errorlint", + "exhaustive", + # "exhaustivestruct", + "exportloopref", + "forbidigo", + # "forcetypeassert", + "funlen", + "gci", + # "gochecknoglobals", + "gochecknoinits", + "gocognit", + "goconst", + "gocritic", + "gocyclo", + "godot", + "godox", + # "goerr113", + "gofmt", + "gofumpt", + "goheader", + "goimports", + "golint", + "gomnd", + # "gomoddirectives", + "gomodguard", + "goprintffuncname", + "gosec", + "gosimple", + "govet", + # "ifshort", + "importas", + "ineffassign", + "lll", + "makezero", + "misspell", + "nakedret", + "nestif", + "nilerr", + # "nlreturn", + "noctx", + "nolintlint", + "paralleltest", + "prealloc", + "predeclared", + "revive", + "rowserrcheck", + "sqlclosecheck", + "staticcheck", + "structcheck", + "stylecheck", + # "testpackage", + "thelper", + "tparallel", + "typecheck", + "unconvert", + "unparam", + "unused", + "varcheck", + "wastedassign", + "whitespace", + # "wrapcheck", + # "wsl" +] diff --git a/vendor/github.com/pelletier/go-toml/v2/CONTRIBUTING.md b/vendor/github.com/pelletier/go-toml/v2/CONTRIBUTING.md new file mode 100644 index 000000000..59658d39d --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/CONTRIBUTING.md @@ -0,0 +1,182 @@ +# Contributing + +Thank you for your interest in go-toml! We appreciate you considering +contributing to go-toml! + +The main goal is the project is to provide an easy-to-use and efficient TOML +implementation for Go that gets the job done and gets out of your way – dealing +with TOML is probably not the central piece of your project. + +As the single maintainer of go-toml, time is scarce. All help, big or small, is +more than welcomed! + +## Ask questions + +Any question you may have, somebody else might have it too. Always feel free to +ask them on the [discussion board][discussions]. We will try to answer them as +clearly and quickly as possible, time permitting. + +Asking questions also helps us identify areas where the documentation needs +improvement, or new features that weren't envisioned before. Sometimes, a +seemingly innocent question leads to the fix of a bug. Don't hesitate and ask +away! + +[discussions]: https://github.com/pelletier/go-toml/discussions + +## Improve the documentation + +The best way to share your knowledge and experience with go-toml is to improve +the documentation. Fix a typo, clarify an interface, add an example, anything +goes! + +The documentation is present in the [README][readme] and thorough the source +code. On release, it gets updated on [pkg.go.dev][pkg.go.dev]. To make a change +to the documentation, create a pull request with your proposed changes. For +simple changes like that, the easiest way to go is probably the "Fork this +project and edit the file" button on Github, displayed at the top right of the +file. Unless it's a trivial change (for example a typo), provide a little bit of +context in your pull request description or commit message. + +## Report a bug + +Found a bug! Sorry to hear that :(. Help us and other track them down and fix by +reporting it. [File a new bug report][bug-report] on the [issues +tracker][issues-tracker]. The template should provide enough guidance on what to +include. When in doubt: add more details! By reducing ambiguity and providing +more information, it decreases back and forth and saves everyone time. + +## Code changes + +Want to contribute a patch? Very happy to hear that! + +First, some high-level rules: + +- A short proposal with some POC code is better than a lengthy piece of text + with no code. Code speaks louder than words. That being said, bigger changes + should probably start with a [discussion][discussions]. +- No backward-incompatible patch will be accepted unless discussed. Sometimes + it's hard, but we try not to break people's programs unless we absolutely have + to. +- If you are writing a new feature or extending an existing one, make sure to + write some documentation. +- Bug fixes need to be accompanied with regression tests. +- New code needs to be tested. +- Your commit messages need to explain why the change is needed, even if already + included in the PR description. + +It does sound like a lot, but those best practices are here to save time overall +and continuously improve the quality of the project, which is something everyone +benefits from. + +### Get started + +The fairly standard code contribution process looks like that: + +1. [Fork the project][fork]. +2. Make your changes, commit on any branch you like. +3. [Open up a pull request][pull-request] +4. Review, potential ask for changes. +5. Merge. + +Feel free to ask for help! You can create draft pull requests to gather +some early feedback! + +### Run the tests + +You can run tests for go-toml using Go's test tool: `go test -race ./...`. + +During the pull request process, all tests will be ran on Linux, Windows, and +MacOS on the last two versions of Go. + +However, given GitHub's new policy to _not_ run Actions on pull requests until a +maintainer clicks on button, it is highly recommended that you run them locally +as you make changes. + +### Check coverage + +We use `go tool cover` to compute test coverage. Most code editors have a way to +run and display code coverage, but at the end of the day, we do this: + +``` +go test -covermode=atomic -coverprofile=coverage.out +go tool cover -func=coverage.out +``` + +and verify that the overall percentage of tested code does not go down. This is +a requirement. As a rule of thumb, all lines of code touched by your changes +should be covered. On Unix you can use `./ci.sh coverage -d v2` to check if your +code lowers the coverage. + +### Verify performance + +Go-toml aims to stay efficient. We rely on a set of scenarios executed with Go's +builtin benchmark systems. Because of their noisy nature, containers provided by +Github Actions cannot be reliably used for benchmarking. As a result, you are +responsible for checking that your changes do not incur a performance penalty. +You can run their following to execute benchmarks: + +``` +go test ./... -bench=. -count=10 +``` + +Benchmark results should be compared against each other with +[benchstat][benchstat]. Typical flow looks like this: + +1. On the `v2` branch, run `go test ./... -bench=. -count 10` and save output to + a file (for example `old.txt`). +2. Make some code changes. +3. Run `go test ....` again, and save the output to an other file (for example + `new.txt`). +4. Run `benchstat old.txt new.txt` to check that time/op does not go up in any + test. + +On Unix you can use `./ci.sh benchmark -d v2` to verify how your code impacts +performance. + +It is highly encouraged to add the benchstat results to your pull request +description. Pull requests that lower performance will receive more scrutiny. + +[benchstat]: https://pkg.go.dev/golang.org/x/perf/cmd/benchstat + +### Style + +Try to look around and follow the same format and structure as the rest of the +code. We enforce using `go fmt` on the whole code base. + +--- + +## Maintainers-only + +### Merge pull request + +Checklist: + +- Passing CI. +- Does not introduce backward-incompatible changes (unless discussed). +- Has relevant doc changes. +- Benchstat does not show performance regression. + +1. Merge using "squash and merge". +2. Make sure to edit the commit message to keep all the useful information + nice and clean. +3. Make sure the commit title is clear and contains the PR number (#123). + +### New release + +1. Go to [releases][releases]. Click on "X commits to master since this + release". +2. Make note of all the changes. Look for backward incompatible changes, + new features, and bug fixes. +3. Pick the new version using the above and semver. +4. Create a [new release][new-release]. +5. Follow the same format as [1.1.0][release-110]. + +[issues-tracker]: https://github.com/pelletier/go-toml/issues +[bug-report]: https://github.com/pelletier/go-toml/issues/new?template=bug_report.md +[pkg.go.dev]: https://pkg.go.dev/github.com/pelletier/go-toml +[readme]: ./README.md +[fork]: https://help.github.com/articles/fork-a-repo +[pull-request]: https://help.github.com/en/articles/creating-a-pull-request +[releases]: https://github.com/pelletier/go-toml/releases +[new-release]: https://github.com/pelletier/go-toml/releases/new +[release-110]: https://github.com/pelletier/go-toml/releases/tag/v1.1.0 diff --git a/vendor/github.com/pelletier/go-toml/v2/LICENSE b/vendor/github.com/pelletier/go-toml/v2/LICENSE new file mode 100644 index 000000000..3a38ac28b --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 - 2021 Thomas Pelletier, Eric Anderton + +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/pelletier/go-toml/v2/README.md b/vendor/github.com/pelletier/go-toml/v2/README.md new file mode 100644 index 000000000..876f31e56 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/README.md @@ -0,0 +1,352 @@ +# go-toml v2 + +Go library for the [TOML](https://toml.io/en/) format. + +This library supports [TOML v1.0.0](https://toml.io/en/v1.0.0). + + +## Development status + +This is the upcoming major version of go-toml. It is currently in active +development. As of release v2.0.0-beta.1, the library has reached feature parity +with v1, and fixes a lot known bugs and performance issues along the way. + +If you do not need the advanced document editing features of v1, you are +encouraged to try out this version. + +👉 [Roadmap for v2](https://github.com/pelletier/go-toml/discussions/506). + + +## Documentation + +Full API, examples, and implementation notes are available in the Go documentation. + +[![Go Reference](https://pkg.go.dev/badge/github.com/pelletier/go-toml/v2.svg)](https://pkg.go.dev/github.com/pelletier/go-toml/v2) + + +## Import + +```go +import "github.com/pelletier/go-toml/v2" +``` + +## Features + +### Stdlib behavior + +As much as possible, this library is designed to behave similarly as the +standard library's `encoding/json`. + +### Performance + +While go-toml favors usability, it is written with performance in mind. Most +operations should not be shockingly slow. + +### Strict mode + +`Decoder` can be set to "strict mode", which makes it error when some parts of +the TOML document was not prevent in the target structure. This is a great way +to check for typos. [See example in the documentation][strict]. + +[strict]: https://pkg.go.dev/github.com/pelletier/go-toml/v2#example-Decoder.SetStrict + +### Contextualized errors + +When decoding errors occur, go-toml returns [`DecodeError`][decode-err]), which +contains a human readable contextualized version of the error. For example: + +``` +2| key1 = "value1" +3| key2 = "missing2" + | ~~~~ missing field +4| key3 = "missing3" +5| key4 = "value4" +``` + +[decode-err]: https://pkg.go.dev/github.com/pelletier/go-toml/v2#DecodeError + +### Local date and time support + +TOML supports native [local date/times][ldt]. It allows to represent a given +date, time, or date-time without relation to a timezone or offset. To support +this use-case, go-toml provides [`LocalDate`][tld], [`LocalTime`][tlt], and +[`LocalDateTime`][tldt]. Those types can be transformed to and from `time.Time`, +making them convenient yet unambiguous structures for their respective TOML +representation. + +[ldt]: https://toml.io/en/v1.0.0#local-date-time +[tld]: https://pkg.go.dev/github.com/pelletier/go-toml/v2#LocalDate +[tlt]: https://pkg.go.dev/github.com/pelletier/go-toml/v2#LocalTime +[tldt]: https://pkg.go.dev/github.com/pelletier/go-toml/v2#LocalDateTime + +## Getting started + +Given the following struct, let's see how to read it and write it as TOML: + +```go +type MyConfig struct { + Version int + Name string + Tags []string +} +``` + +### Unmarshaling + +[`Unmarshal`][unmarshal] reads a TOML document and fills a Go structure with its +content. For example: + +```go +doc := ` +version = 2 +name = "go-toml" +tags = ["go", "toml"] +` + +var cfg MyConfig +err := toml.Unmarshal([]byte(doc), &cfg) +if err != nil { + panic(err) +} +fmt.Println("version:", cfg.Version) +fmt.Println("name:", cfg.Name) +fmt.Println("tags:", cfg.Tags) + +// Output: +// version: 2 +// name: go-toml +// tags: [go toml] +``` + +[unmarshal]: https://pkg.go.dev/github.com/pelletier/go-toml/v2#Unmarshal + +### Marshaling + +[`Marshal`][marshal] is the opposite of Unmarshal: it represents a Go structure +as a TOML document: + +```go +cfg := MyConfig{ + Version: 2, + Name: "go-toml", + Tags: []string{"go", "toml"}, +} + +b, err := toml.Marshal(cfg) +if err != nil { + panic(err) +} +fmt.Println(string(b)) + +// Output: +// Version = 2 +// Name = 'go-toml' +// Tags = ['go', 'toml'] +``` + +[marshal]: https://pkg.go.dev/github.com/pelletier/go-toml/v2#Marshal + +## Migrating from v1 + +This section describes the differences between v1 and v2, with some pointers on +how to get the original behavior when possible. + +### Decoding / Unmarshal + +#### Automatic field name guessing + +When unmarshaling to a struct, if a key in the TOML document does not exactly +match the name of a struct field or any of the `toml`-tagged field, v1 tries +multiple variations of the key ([code][v1-keys]). + +V2 instead does a case-insensitive matching, like `encoding/json`. + +This could impact you if you are relying on casing to differentiate two fields, +and one of them is a not using the `toml` struct tag. The recommended solution +is to be specific about tag names for those fields using the `toml` struct tag. + +[v1-keys]: https://github.com/pelletier/go-toml/blob/a2e52561804c6cd9392ebf0048ca64fe4af67a43/marshal.go#L775-L781 + +#### Ignore preexisting value in interface + +When decoding into a non-nil `interface{}`, go-toml v1 uses the type of the +element in the interface to decode the object. For example: + +```go +type inner struct { + B interface{} +} +type doc struct { + A interface{} +} + +d := doc{ + A: inner{ + B: "Before", + }, +} + +data := ` +[A] +B = "After" +` + +toml.Unmarshal([]byte(data), &d) +fmt.Printf("toml v1: %#v\n", d) + +// toml v1: main.doc{A:main.inner{B:"After"}} +``` + +In this case, field `A` is of type `interface{}`, containing a `inner` struct. +V1 sees that type and uses it when decoding the object. + +When decoding an object into an `interface{}`, V2 instead disregards whatever +value the `interface{}` may contain and replaces it with a +`map[string]interface{}`. With the same data structure as above, here is what +the result looks like: + +```go +toml.Unmarshal([]byte(data), &d) +fmt.Printf("toml v2: %#v\n", d) + +// toml v2: main.doc{A:map[string]interface {}{"B":"After"}} +``` + +This is to match `encoding/json`'s behavior. There is no way to make the v2 +decoder behave like v1. + +#### Values out of array bounds ignored + +When decoding into an array, v1 returns an error when the number of elements +contained in the doc is superior to the capacity of the array. For example: + +```go +type doc struct { + A [2]string +} +d := doc{} +err := toml.Unmarshal([]byte(`A = ["one", "two", "many"]`), &d) +fmt.Println(err) + +// (1, 1): unmarshal: TOML array length (3) exceeds destination array length (2) +``` + +In the same situation, v2 ignores the last value: + +```go +err := toml.Unmarshal([]byte(`A = ["one", "two", "many"]`), &d) +fmt.Println("err:", err, "d:", d) +// err: d: {[one two]} +``` + +This is to match `encoding/json`'s behavior. There is no way to make the v2 +decoder behave like v1. + +#### Support for `toml.Unmarshaler` has been dropped + +This method was not widely used, poorly defined, and added a lot of complexity. +A similar effect can be achieved by implementing the `encoding.TextUnmarshaler` +interface and use strings. + +### Encoding / Marshal + +#### Default struct fields order + +V1 emits struct fields order alphabetically by default. V2 struct fields are +emitted in order they are defined. For example: + +```go +type S struct { + B string + A string +} + +data := S{ + B: "B", + A: "A", +} + +b, _ := tomlv1.Marshal(data) +fmt.Println("v1:\n" + string(b)) + +b, _ = tomlv2.Marshal(data) +fmt.Println("v2:\n" + string(b)) + +// Output: +// v1: +// A = "A" +// B = "B" + +// v2: +// B = 'B' +// A = 'A' +``` + +There is no way to make v2 encoder behave like v1. A workaround could be to +manually sort the fields alphabetically in the struct definition. + +#### No indentation by default + +V1 automatically indents content of tables by default. V2 does not. However the +same behavior can be obtained using [`Encoder.SetIndentTables`][sit]. For example: + + +```go +data := map[string]interface{}{ + "table": map[string]string{ + "key": "value", + }, +} + +b, _ := tomlv1.Marshal(data) +fmt.Println("v1:\n" + string(b)) + +b, _ = tomlv2.Marshal(data) +fmt.Println("v2:\n" + string(b)) + +buf := bytes.Buffer{} +enc := tomlv2.NewEncoder(&buf) +enc.SetIndentTables(true) +enc.Encode(data) +fmt.Println("v2 Encoder:\n" + string(buf.Bytes())) + +// Output: +// v1: +// +// [table] +// key = "value" +// +// v2: +// [table] +// key = 'value' +// +// +// v2 Encoder: +// [table] +// key = 'value' +``` + +[sit]: https://pkg.go.dev/github.com/pelletier/go-toml/v2#Encoder.SetIndentTables + +#### Keys and strings are single quoted + +V1 always uses double quotes (`"`) around strings and keys that cannot be +represented bare (unquoted). V2 uses single quotes instead by default (`'`), +unless a character cannot be represented, then falls back to double quotes. + +There is no way to make v2 encoder behave like v1. + +#### `TextMarshaler` emits as a string, not TOML + +Types that implement [`encoding.TextMarshaler`][tm] can emit arbitrary TOML in +v1. The encoder would append the result to the output directly. In v2 the result +is wrapped in a string. As a result, this interface cannot be implemented by the +root object. + +There is no way to make v2 encoder behave like v1. + +[tm]: https://golang.org/pkg/encoding/#TextMarshaler + +## License + +The MIT License (MIT). Read [LICENSE](LICENSE). diff --git a/vendor/github.com/pelletier/go-toml/v2/ci.sh b/vendor/github.com/pelletier/go-toml/v2/ci.sh new file mode 100644 index 000000000..75d7008b3 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/ci.sh @@ -0,0 +1,162 @@ +#!/usr/bin/env bash + + +stderr() { + echo "$@" 1>&2 +} + +usage() { + b=$(basename "$0") + echo $b: ERROR: "$@" 1>&2 + + cat 1>&2 < "${target_out}" + cover "HEAD" > "${head_out}" + + cat "${target_out}" + cat "${head_out}" + + echo "" + + target_pct="$(cat ${target_out} |sed -E 's/.*total.*\t([0-9.]+)%/\1/;t;d')" + head_pct="$(cat ${head_out} |sed -E 's/.*total.*\t([0-9.]+)%/\1/;t;d')" + echo "Results: ${target} ${target_pct}% HEAD ${head_pct}%" + + delta_pct=$(echo "$head_pct - $target_pct" | bc -l) + echo "Delta: ${delta_pct}" + + if [[ $delta_pct = \-* ]]; then + echo "Regression!"; + return 1 + fi + return 0 + ;; + esac + + cover "${1-HEAD}" +} + +bench() { + branch="${1}" + out="${2}" + dir="$(mktemp -d)" + + stderr "Executing benchmark for ${branch} at ${dir}" + + if [ "${branch}" = "HEAD" ]; then + cp -r . "${dir}/" + else + git worktree add "$dir" "$branch" + fi + + pushd "$dir" + go test -bench=. -count=10 ./... | tee "${out}" + popd + + if [ "${branch}" != "HEAD" ]; then + git worktree remove --force "$dir" + fi +} + +benchmark() { + case "$1" in + -d) + shift + target="${1?Need to provide a target branch argument}" + old=`mktemp` + bench "${target}" "${old}" + + new=`mktemp` + bench HEAD "${new}" + benchstat "${old}" "${new}" + return 0 + ;; + esac + + bench "${1-HEAD}" `mktemp` +} + +case "$1" in + coverage) shift; coverage $@;; + benchmark) shift; benchmark $@;; + *) usage "bad argument $1";; +esac diff --git a/vendor/github.com/pelletier/go-toml/v2/decode.go b/vendor/github.com/pelletier/go-toml/v2/decode.go new file mode 100644 index 000000000..33ac2a967 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/decode.go @@ -0,0 +1,314 @@ +package toml + +import ( + "fmt" + "math" + "strconv" + "time" +) + +func parseInteger(b []byte) (int64, error) { + if len(b) > 2 && b[0] == '0' { + switch b[1] { + case 'x': + return parseIntHex(b) + case 'b': + return parseIntBin(b) + case 'o': + return parseIntOct(b) + default: + panic(fmt.Errorf("invalid base '%c', should have been checked by scanIntOrFloat", b[1])) + } + } + + return parseIntDec(b) +} + +func parseLocalDate(b []byte) (LocalDate, error) { + // full-date = date-fullyear "-" date-month "-" date-mday + // date-fullyear = 4DIGIT + // date-month = 2DIGIT ; 01-12 + // date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year + var date LocalDate + + if len(b) != 10 || b[4] != '-' || b[7] != '-' { + return date, newDecodeError(b, "dates are expected to have the format YYYY-MM-DD") + } + + date.Year = parseDecimalDigits(b[0:4]) + + v := parseDecimalDigits(b[5:7]) + + date.Month = time.Month(v) + + date.Day = parseDecimalDigits(b[8:10]) + + return date, nil +} + +func parseDecimalDigits(b []byte) int { + v := 0 + + for _, c := range b { + v *= 10 + v += int(c - '0') + } + + return v +} + +func parseDateTime(b []byte) (time.Time, error) { + // offset-date-time = full-date time-delim full-time + // full-time = partial-time time-offset + // time-offset = "Z" / time-numoffset + // time-numoffset = ( "+" / "-" ) time-hour ":" time-minute + + dt, b, err := parseLocalDateTime(b) + if err != nil { + return time.Time{}, err + } + + var zone *time.Location + + if len(b) == 0 { + // parser should have checked that when assigning the date time node + panic("date time should have a timezone") + } + + if b[0] == 'Z' { + b = b[1:] + zone = time.UTC + } else { + const dateTimeByteLen = 6 + if len(b) != dateTimeByteLen { + return time.Time{}, newDecodeError(b, "invalid date-time timezone") + } + direction := 1 + if b[0] == '-' { + direction = -1 + } + + hours := digitsToInt(b[1:3]) + minutes := digitsToInt(b[4:6]) + seconds := direction * (hours*3600 + minutes*60) + zone = time.FixedZone("", seconds) + b = b[dateTimeByteLen:] + } + + if len(b) > 0 { + return time.Time{}, newDecodeError(b, "extra bytes at the end of the timezone") + } + + t := time.Date( + dt.Date.Year, + dt.Date.Month, + dt.Date.Day, + dt.Time.Hour, + dt.Time.Minute, + dt.Time.Second, + dt.Time.Nanosecond, + zone) + + return t, nil +} + +func parseLocalDateTime(b []byte) (LocalDateTime, []byte, error) { + var dt LocalDateTime + + const localDateTimeByteMinLen = 11 + if len(b) < localDateTimeByteMinLen { + return dt, nil, newDecodeError(b, "local datetimes are expected to have the format YYYY-MM-DDTHH:MM:SS[.NNNNNNNNN]") + } + + date, err := parseLocalDate(b[:10]) + if err != nil { + return dt, nil, err + } + dt.Date = date + + sep := b[10] + if sep != 'T' && sep != ' ' { + return dt, nil, newDecodeError(b[10:11], "datetime separator is expected to be T or a space") + } + + t, rest, err := parseLocalTime(b[11:]) + if err != nil { + return dt, nil, err + } + dt.Time = t + + return dt, rest, nil +} + +// parseLocalTime is a bit different because it also returns the remaining +// []byte that is didn't need. This is to allow parseDateTime to parse those +// remaining bytes as a timezone. +func parseLocalTime(b []byte) (LocalTime, []byte, error) { + var ( + nspow = [10]int{0, 1e8, 1e7, 1e6, 1e5, 1e4, 1e3, 1e2, 1e1, 1e0} + t LocalTime + ) + + const localTimeByteLen = 8 + if len(b) < localTimeByteLen { + return t, nil, newDecodeError(b, "times are expected to have the format HH:MM:SS[.NNNNNN]") + } + + t.Hour = parseDecimalDigits(b[0:2]) + if b[2] != ':' { + return t, nil, newDecodeError(b[2:3], "expecting colon between hours and minutes") + } + + t.Minute = parseDecimalDigits(b[3:5]) + if b[5] != ':' { + return t, nil, newDecodeError(b[5:6], "expecting colon between minutes and seconds") + } + + t.Second = parseDecimalDigits(b[6:8]) + + const minLengthWithFrac = 9 + if len(b) >= minLengthWithFrac && b[minLengthWithFrac-1] == '.' { + frac := 0 + digits := 0 + + for i, c := range b[minLengthWithFrac:] { + const maxFracPrecision = 9 + if i >= maxFracPrecision { + return t, nil, newDecodeError(b[i:i+1], "maximum precision for date time is nanosecond") + } + + frac *= 10 + frac += int(c - '0') + digits++ + } + + t.Nanosecond = frac * nspow[digits] + + return t, b[9+digits:], nil + } + + return t, b[8:], nil +} + +//nolint:cyclop +func parseFloat(b []byte) (float64, error) { + if len(b) == 4 && (b[0] == '+' || b[0] == '-') && b[1] == 'n' && b[2] == 'a' && b[3] == 'n' { + return math.NaN(), nil + } + + cleaned, err := checkAndRemoveUnderscores(b) + if err != nil { + return 0, err + } + + if cleaned[0] == '.' { + return 0, newDecodeError(b, "float cannot start with a dot") + } + + if cleaned[len(cleaned)-1] == '.' { + return 0, newDecodeError(b, "float cannot end with a dot") + } + + f, err := strconv.ParseFloat(string(cleaned), 64) + if err != nil { + return 0, newDecodeError(b, "unable to parse float: %w", err) + } + + return f, nil +} + +func parseIntHex(b []byte) (int64, error) { + cleaned, err := checkAndRemoveUnderscores(b[2:]) + if err != nil { + return 0, err + } + + i, err := strconv.ParseInt(string(cleaned), 16, 64) + if err != nil { + return 0, newDecodeError(b, "couldn't parse hexadecimal number: %w", err) + } + + return i, nil +} + +func parseIntOct(b []byte) (int64, error) { + cleaned, err := checkAndRemoveUnderscores(b[2:]) + if err != nil { + return 0, err + } + + i, err := strconv.ParseInt(string(cleaned), 8, 64) + if err != nil { + return 0, newDecodeError(b, "couldn't parse octal number: %w", err) + } + + return i, nil +} + +func parseIntBin(b []byte) (int64, error) { + cleaned, err := checkAndRemoveUnderscores(b[2:]) + if err != nil { + return 0, err + } + + i, err := strconv.ParseInt(string(cleaned), 2, 64) + if err != nil { + return 0, newDecodeError(b, "couldn't parse binary number: %w", err) + } + + return i, nil +} + +func parseIntDec(b []byte) (int64, error) { + cleaned, err := checkAndRemoveUnderscores(b) + if err != nil { + return 0, err + } + + i, err := strconv.ParseInt(string(cleaned), 10, 64) + if err != nil { + return 0, newDecodeError(b, "couldn't parse decimal number: %w", err) + } + + return i, nil +} + +func checkAndRemoveUnderscores(b []byte) ([]byte, error) { + if b[0] == '_' { + return nil, newDecodeError(b[0:1], "number cannot start with underscore") + } + + if b[len(b)-1] == '_' { + return nil, newDecodeError(b[len(b)-1:], "number cannot end with underscore") + } + + // fast path + i := 0 + for ; i < len(b); i++ { + if b[i] == '_' { + break + } + } + if i == len(b) { + return b, nil + } + + before := false + cleaned := make([]byte, i, len(b)) + copy(cleaned, b) + + for i++; i < len(b); i++ { + c := b[i] + if c == '_' { + if !before { + return nil, newDecodeError(b[i-1:i+1], "number must have at least one digit between underscores") + } + before = false + } else { + before = true + cleaned = append(cleaned, c) + } + } + + return cleaned, nil +} diff --git a/vendor/github.com/pelletier/go-toml/v2/doc.go b/vendor/github.com/pelletier/go-toml/v2/doc.go new file mode 100644 index 000000000..b7bc599bd --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/doc.go @@ -0,0 +1,2 @@ +// Package toml is a library to read and write TOML documents. +package toml diff --git a/vendor/github.com/pelletier/go-toml/v2/errors.go b/vendor/github.com/pelletier/go-toml/v2/errors.go new file mode 100644 index 000000000..712765bba --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/errors.go @@ -0,0 +1,260 @@ +package toml + +import ( + "fmt" + "strconv" + "strings" + + "github.com/pelletier/go-toml/v2/internal/unsafe" +) + +// DecodeError represents an error encountered during the parsing or decoding +// of a TOML document. +// +// In addition to the error message, it contains the position in the document +// where it happened, as well as a human-readable representation that shows +// where the error occurred in the document. +type DecodeError struct { + message string + line int + column int + key Key + + human string +} + +// StrictMissingError occurs in a TOML document that does not have a +// corresponding field in the target value. It contains all the missing fields +// in Errors. +// +// Emitted by Decoder when SetStrict(true) was called. +type StrictMissingError struct { + // One error per field that could not be found. + Errors []DecodeError +} + +// Error returns the canonical string for this error. +func (s *StrictMissingError) Error() string { + return "strict mode: fields in the document are missing in the target struct" +} + +// String returns a human readable description of all errors. +func (s *StrictMissingError) String() string { + var buf strings.Builder + + for i, e := range s.Errors { + if i > 0 { + buf.WriteString("\n---\n") + } + + buf.WriteString(e.String()) + } + + return buf.String() +} + +type Key []string + +// internal version of DecodeError that is used as the base to create a +// DecodeError with full context. +type decodeError struct { + highlight []byte + message string + key Key // optional +} + +func (de *decodeError) Error() string { + return de.message +} + +func newDecodeError(highlight []byte, format string, args ...interface{}) error { + return &decodeError{ + highlight: highlight, + message: fmt.Errorf(format, args...).Error(), + } +} + +// Error returns the error message contained in the DecodeError. +func (e *DecodeError) Error() string { + return "toml: " + e.message +} + +// String returns the human-readable contextualized error. This string is multi-line. +func (e *DecodeError) String() string { + return e.human +} + +// Position returns the (line, column) pair indicating where the error +// occurred in the document. Positions are 1-indexed. +func (e *DecodeError) Position() (row int, column int) { + return e.line, e.column +} + +// Key that was being processed when the error occurred. The key is present only +// if this DecodeError is part of a StrictMissingError. +func (e *DecodeError) Key() Key { + return e.key +} + +// decodeErrorFromHighlight creates a DecodeError referencing a highlighted +// range of bytes from document. +// +// highlight needs to be a sub-slice of document, or this function panics. +// +// The function copies all bytes used in DecodeError, so that document and +// highlight can be freely deallocated. +//nolint:funlen +func wrapDecodeError(document []byte, de *decodeError) *DecodeError { + offset := unsafe.SubsliceOffset(document, de.highlight) + + errMessage := de.Error() + errLine, errColumn := positionAtEnd(document[:offset]) + before, after := linesOfContext(document, de.highlight, offset, 3) + + var buf strings.Builder + + maxLine := errLine + len(after) - 1 + lineColumnWidth := len(strconv.Itoa(maxLine)) + + for i := len(before) - 1; i > 0; i-- { + line := errLine - i + buf.WriteString(formatLineNumber(line, lineColumnWidth)) + buf.WriteString("|") + + if len(before[i]) > 0 { + buf.WriteString(" ") + buf.Write(before[i]) + } + + buf.WriteRune('\n') + } + + buf.WriteString(formatLineNumber(errLine, lineColumnWidth)) + buf.WriteString("| ") + + if len(before) > 0 { + buf.Write(before[0]) + } + + buf.Write(de.highlight) + + if len(after) > 0 { + buf.Write(after[0]) + } + + buf.WriteRune('\n') + buf.WriteString(strings.Repeat(" ", lineColumnWidth)) + buf.WriteString("| ") + + if len(before) > 0 { + buf.WriteString(strings.Repeat(" ", len(before[0]))) + } + + buf.WriteString(strings.Repeat("~", len(de.highlight))) + + if len(errMessage) > 0 { + buf.WriteString(" ") + buf.WriteString(errMessage) + } + + for i := 1; i < len(after); i++ { + buf.WriteRune('\n') + line := errLine + i + buf.WriteString(formatLineNumber(line, lineColumnWidth)) + buf.WriteString("|") + + if len(after[i]) > 0 { + buf.WriteString(" ") + buf.Write(after[i]) + } + } + + return &DecodeError{ + message: errMessage, + line: errLine, + column: errColumn, + key: de.key, + human: buf.String(), + } +} + +func formatLineNumber(line int, width int) string { + format := "%" + strconv.Itoa(width) + "d" + + return fmt.Sprintf(format, line) +} + +func linesOfContext(document []byte, highlight []byte, offset int, linesAround int) ([][]byte, [][]byte) { + return beforeLines(document, offset, linesAround), afterLines(document, highlight, offset, linesAround) +} + +func beforeLines(document []byte, offset int, linesAround int) [][]byte { + var beforeLines [][]byte + + // Walk the document backward from the highlight to find previous lines + // of context. + rest := document[:offset] +backward: + for o := len(rest) - 1; o >= 0 && len(beforeLines) <= linesAround && len(rest) > 0; { + switch { + case rest[o] == '\n': + // handle individual lines + beforeLines = append(beforeLines, rest[o+1:]) + rest = rest[:o] + o = len(rest) - 1 + case o == 0: + // add the first line only if it's non-empty + beforeLines = append(beforeLines, rest) + + break backward + default: + o-- + } + } + + return beforeLines +} + +func afterLines(document []byte, highlight []byte, offset int, linesAround int) [][]byte { + var afterLines [][]byte + + // Walk the document forward from the highlight to find the following + // lines of context. + rest := document[offset+len(highlight):] +forward: + for o := 0; o < len(rest) && len(afterLines) <= linesAround; { + switch { + case rest[o] == '\n': + // handle individual lines + afterLines = append(afterLines, rest[:o]) + rest = rest[o+1:] + o = 0 + + case o == len(rest)-1 && o > 0: + // add last line only if it's non-empty + afterLines = append(afterLines, rest) + + break forward + default: + o++ + } + } + + return afterLines +} + +func positionAtEnd(b []byte) (row int, column int) { + row = 1 + column = 1 + + for _, c := range b { + if c == '\n' { + row++ + column = 1 + } else { + column++ + } + } + + return +} diff --git a/vendor/github.com/pelletier/go-toml/v2/go.mod b/vendor/github.com/pelletier/go-toml/v2/go.mod new file mode 100644 index 000000000..6745f0a55 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/go.mod @@ -0,0 +1,5 @@ +module github.com/pelletier/go-toml/v2 + +go 1.15 + +require github.com/stretchr/testify v1.7.0 diff --git a/vendor/github.com/pelletier/go-toml/v2/go.sum b/vendor/github.com/pelletier/go-toml/v2/go.sum new file mode 100644 index 000000000..acb88a48f --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/go.sum @@ -0,0 +1,11 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/ast/ast.go b/vendor/github.com/pelletier/go-toml/v2/internal/ast/ast.go new file mode 100644 index 000000000..ba2729e05 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/internal/ast/ast.go @@ -0,0 +1,138 @@ +package ast + +import ( + "fmt" +) + +// Iterator starts uninitialized, you need to call Next() first. +// +// For example: +// +// it := n.Children() +// for it.Next() { +// it.Node() +// } +type Iterator struct { + started bool + node Node +} + +// Next moves the iterator forward and returns true if points to a node, false +// otherwise. +func (c *Iterator) Next() bool { + if !c.started { + c.started = true + } else if c.node.Valid() { + c.node = c.node.Next() + } + return c.node.Valid() +} + +// Node returns a copy of the node pointed at by the iterator. +func (c *Iterator) Node() Node { + return c.node +} + +// Root contains a full AST. +// +// It is immutable once constructed with Builder. +type Root struct { + nodes []Node +} + +// Iterator over the top level nodes. +func (r *Root) Iterator() Iterator { + it := Iterator{} + if len(r.nodes) > 0 { + it.node = r.nodes[0] + } + return it +} + +func (r *Root) at(idx int) Node { + // TODO: unsafe to point to the node directly + return r.nodes[idx] +} + +// Arrays have one child per element in the array. +// InlineTables have one child per key-value pair in the table. +// KeyValues have at least two children. The first one is the value. The +// rest make a potentially dotted key. +// Table and Array table have one child per element of the key they +// represent (same as KeyValue, but without the last node being the value). +// children []Node +type Node struct { + Kind Kind + Data []byte // Raw bytes from the input + + // next idx (in the root array). 0 if last of the collection. + next int + // child idx (in the root array). 0 if no child. + child int + // pointer to the root array + root *Root +} + +// Next returns a copy of the next node, or an invalid Node if there is no +// next node. +func (n Node) Next() Node { + if n.next <= 0 { + return noNode + } + return n.root.at(n.next) +} + +// Child returns a copy of the first child node of this node. Other children +// can be accessed calling Next on the first child. +// Returns an invalid Node if there is none. +func (n Node) Child() Node { + if n.child <= 0 { + return noNode + } + return n.root.at(n.child) +} + +// Valid returns true if the node's kind is set (not to Invalid). +func (n Node) Valid() bool { + return n.Kind != Invalid +} + +var noNode = Node{} + +// Key returns the child nodes making the Key on a supported node. Panics +// otherwise. +// They are guaranteed to be all be of the Kind Key. A simple key would return +// just one element. +func (n *Node) Key() Iterator { + switch n.Kind { + case KeyValue: + value := n.Child() + if !value.Valid() { + panic(fmt.Errorf("KeyValue should have at least two children")) + } + return Iterator{node: value.Next()} + case Table, ArrayTable: + return Iterator{node: n.Child()} + default: + panic(fmt.Errorf("Key() is not supported on a %s", n.Kind)) + } +} + +// Value returns a pointer to the value node of a KeyValue. +// Guaranteed to be non-nil. +// Panics if not called on a KeyValue node, or if the Children are malformed. +func (n Node) Value() Node { + assertKind(KeyValue, n) + return n.Child() +} + +// Children returns an iterator over a node's children. +func (n Node) Children() Iterator { + return Iterator{node: n.Child()} +} + +func assertKind(k Kind, n Node) { + if n.Kind != k { + panic(fmt.Errorf("method was expecting a %s, not a %s", k, n.Kind)) + } +} diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/ast/builder.go b/vendor/github.com/pelletier/go-toml/v2/internal/ast/builder.go new file mode 100644 index 000000000..796b7f1d9 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/internal/ast/builder.go @@ -0,0 +1,60 @@ +package ast + +type Reference struct { + idx int + set bool +} + +func (r Reference) Valid() bool { + return r.set +} + +type Builder struct { + tree Root + lastIdx int +} + +func (b *Builder) Tree() *Root { + return &b.tree +} + +func (b *Builder) NodeAt(ref Reference) Node { + return b.tree.at(ref.idx) +} + +func (b *Builder) Reset() { + b.tree.nodes = b.tree.nodes[:0] + b.lastIdx = 0 +} + +func (b *Builder) Push(n Node) Reference { + n.root = &b.tree + b.lastIdx = len(b.tree.nodes) + b.tree.nodes = append(b.tree.nodes, n) + return Reference{ + idx: b.lastIdx, + set: true, + } +} + +func (b *Builder) PushAndChain(n Node) Reference { + n.root = &b.tree + newIdx := len(b.tree.nodes) + b.tree.nodes = append(b.tree.nodes, n) + if b.lastIdx >= 0 { + b.tree.nodes[b.lastIdx].next = newIdx + } + b.lastIdx = newIdx + return Reference{ + idx: b.lastIdx, + set: true, + } +} + +func (b *Builder) AttachChild(parent Reference, child Reference) { + b.tree.nodes[parent.idx].child = child.idx +} + +func (b *Builder) Chain(from Reference, to Reference) { + b.tree.nodes[from.idx].next = to.idx +} diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/ast/kind.go b/vendor/github.com/pelletier/go-toml/v2/internal/ast/kind.go new file mode 100644 index 000000000..bcf6c91c1 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/internal/ast/kind.go @@ -0,0 +1,69 @@ +package ast + +import "fmt" + +type Kind int + +const ( + // meta + Invalid Kind = iota + Comment + Key + + // top level structures + Table + ArrayTable + KeyValue + + // containers values + Array + InlineTable + + // values + String + Bool + Float + Integer + LocalDate + LocalDateTime + DateTime + Time +) + +func (k Kind) String() string { + switch k { + case Invalid: + return "Invalid" + case Comment: + return "Comment" + case Key: + return "Key" + case Table: + return "Table" + case ArrayTable: + return "ArrayTable" + case KeyValue: + return "KeyValue" + case Array: + return "Array" + case InlineTable: + return "InlineTable" + case String: + return "String" + case Bool: + return "Bool" + case Float: + return "Float" + case Integer: + return "Integer" + case LocalDate: + return "LocalDate" + case LocalDateTime: + return "LocalDateTime" + case DateTime: + return "DateTime" + case Time: + return "Time" + } + panic(fmt.Errorf("Kind.String() not implemented for '%d'", k)) +} diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go new file mode 100644 index 000000000..be99f7206 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/key.go @@ -0,0 +1,50 @@ +package tracker + +import ( + "github.com/pelletier/go-toml/v2/internal/ast" +) + +// KeyTracker is a tracker that keeps track of the current Key as the AST is +// walked. +type KeyTracker struct { + k []string +} + +// UpdateTable sets the state of the tracker with the AST table node. +func (t *KeyTracker) UpdateTable(node ast.Node) { + t.reset() + t.Push(node) +} + +// UpdateArrayTable sets the state of the tracker with the AST array table node. +func (t *KeyTracker) UpdateArrayTable(node ast.Node) { + t.reset() + t.Push(node) +} + +// Push the given key on the stack. +func (t *KeyTracker) Push(node ast.Node) { + it := node.Key() + for it.Next() { + t.k = append(t.k, string(it.Node().Data)) + } +} + +// Pop key from stack. +func (t *KeyTracker) Pop(node ast.Node) { + it := node.Key() + for it.Next() { + t.k = t.k[:len(t.k)-1] + } +} + +// Key returns the current key +func (t *KeyTracker) Key() []string { + k := make([]string, len(t.k)) + copy(k, t.k) + return k +} + +func (t *KeyTracker) reset() { + t.k = t.k[:0] +} diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/tracker/seen.go b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/seen.go new file mode 100644 index 000000000..e245aace2 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/seen.go @@ -0,0 +1,200 @@ +package tracker + +import ( + "fmt" + + "github.com/pelletier/go-toml/v2/internal/ast" +) + +type keyKind uint8 + +const ( + invalidKind keyKind = iota + valueKind + tableKind + arrayTableKind +) + +func (k keyKind) String() string { + switch k { + case invalidKind: + return "invalid" + case valueKind: + return "value" + case tableKind: + return "table" + case arrayTableKind: + return "array table" + } + panic("missing keyKind string mapping") +} + +// SeenTracker tracks which keys have been seen with which TOML type to flag duplicates +// and mismatches according to the spec. +type SeenTracker struct { + root *info + current *info +} + +type info struct { + parent *info + kind keyKind + children map[string]*info + explicit bool +} + +func (i *info) Clear() { + i.children = nil +} + +func (i *info) Has(k string) (*info, bool) { + c, ok := i.children[k] + return c, ok +} + +func (i *info) SetKind(kind keyKind) { + i.kind = kind +} + +func (i *info) CreateTable(k string, explicit bool) *info { + return i.createChild(k, tableKind, explicit) +} + +func (i *info) CreateArrayTable(k string, explicit bool) *info { + return i.createChild(k, arrayTableKind, explicit) +} + +func (i *info) createChild(k string, kind keyKind, explicit bool) *info { + if i.children == nil { + i.children = make(map[string]*info, 1) + } + + x := &info{ + parent: i, + kind: kind, + explicit: explicit, + } + i.children[k] = x + return x +} + +// CheckExpression takes a top-level node and checks that it does not contain keys +// that have been seen in previous calls, and validates that types are consistent. +func (s *SeenTracker) CheckExpression(node ast.Node) error { + if s.root == nil { + s.root = &info{ + kind: tableKind, + } + s.current = s.root + } + switch node.Kind { + case ast.KeyValue: + return s.checkKeyValue(s.current, node) + case ast.Table: + return s.checkTable(node) + case ast.ArrayTable: + return s.checkArrayTable(node) + default: + panic(fmt.Errorf("this should not be a top level node type: %s", node.Kind)) + } + +} +func (s *SeenTracker) checkTable(node ast.Node) error { + s.current = s.root + + it := node.Key() + // handle the first parts of the key, excluding the last one + for it.Next() { + if !it.Node().Next().Valid() { + break + } + + k := string(it.Node().Data) + child, found := s.current.Has(k) + if !found { + child = s.current.CreateTable(k, false) + } + s.current = child + } + + // handle the last part of the key + k := string(it.Node().Data) + + i, found := s.current.Has(k) + if found { + if i.kind != tableKind { + return fmt.Errorf("toml: key %s should be a table, not a %s", k, i.kind) + } + if i.explicit { + return fmt.Errorf("toml: table %s already exists", k) + } + i.explicit = true + s.current = i + } else { + s.current = s.current.CreateTable(k, true) + } + + return nil +} + +func (s *SeenTracker) checkArrayTable(node ast.Node) error { + s.current = s.root + + it := node.Key() + + // handle the first parts of the key, excluding the last one + for it.Next() { + if !it.Node().Next().Valid() { + break + } + + k := string(it.Node().Data) + child, found := s.current.Has(k) + if !found { + child = s.current.CreateTable(k, false) + } + s.current = child + } + + // handle the last part of the key + k := string(it.Node().Data) + + info, found := s.current.Has(k) + if found { + if info.kind != arrayTableKind { + return fmt.Errorf("toml: key %s already exists as a %s, but should be an array table", info.kind, k) + } + info.Clear() + } else { + info = s.current.CreateArrayTable(k, true) + } + + s.current = info + return nil +} + +func (s *SeenTracker) checkKeyValue(context *info, node ast.Node) error { + it := node.Key() + + // handle the first parts of the key, excluding the last one + for it.Next() { + k := string(it.Node().Data) + child, found := context.Has(k) + if found { + if child.kind != tableKind { + return fmt.Errorf("toml: expected %s to be a table, not a %s", k, child.kind) + } + } else { + child = context.CreateTable(k, false) + } + context = child + } + + if node.Value().Kind == ast.InlineTable { + context.SetKind(tableKind) + } else { + context.SetKind(valueKind) + } + + return nil +} diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/tracker/tracker.go b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/tracker.go new file mode 100644 index 000000000..bf0317392 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/internal/tracker/tracker.go @@ -0,0 +1 @@ +package tracker diff --git a/vendor/github.com/pelletier/go-toml/v2/internal/unsafe/unsafe.go b/vendor/github.com/pelletier/go-toml/v2/internal/unsafe/unsafe.go new file mode 100644 index 000000000..742c6ab27 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/internal/unsafe/unsafe.go @@ -0,0 +1,59 @@ +package unsafe + +import ( + "fmt" + "reflect" + "unsafe" +) + +const maxInt = uintptr(int(^uint(0) >> 1)) + +func SubsliceOffset(data []byte, subslice []byte) int { + datap := (*reflect.SliceHeader)(unsafe.Pointer(&data)) + hlp := (*reflect.SliceHeader)(unsafe.Pointer(&subslice)) + + if hlp.Data < datap.Data { + panic(fmt.Errorf("subslice address (%d) is before data address (%d)", hlp.Data, datap.Data)) + } + offset := hlp.Data - datap.Data + + if offset > maxInt { + panic(fmt.Errorf("slice offset larger than int (%d)", offset)) + } + + intoffset := int(offset) + + if intoffset > datap.Len { + panic(fmt.Errorf("slice offset (%d) is farther than data length (%d)", intoffset, datap.Len)) + } + + if intoffset+hlp.Len > datap.Len { + panic(fmt.Errorf("slice ends (%d+%d) is farther than data length (%d)", intoffset, hlp.Len, datap.Len)) + } + + return intoffset +} + +func BytesRange(start []byte, end []byte) []byte { + if start == nil || end == nil { + panic("cannot call BytesRange with nil") + } + startp := (*reflect.SliceHeader)(unsafe.Pointer(&start)) + endp := (*reflect.SliceHeader)(unsafe.Pointer(&end)) + + if startp.Data > endp.Data { + panic(fmt.Errorf("start pointer address (%d) is after end pointer address (%d)", startp.Data, endp.Data)) + } + + l := startp.Len + endLen := int(endp.Data-startp.Data) + endp.Len + if endLen > l { + l = endLen + } + + if l > startp.Cap { + panic(fmt.Errorf("range length is larger than capacity")) + } + + return start[:l] +} diff --git a/vendor/github.com/pelletier/go-toml/v2/localtime.go b/vendor/github.com/pelletier/go-toml/v2/localtime.go new file mode 100644 index 000000000..a947044ac --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/localtime.go @@ -0,0 +1,300 @@ +// Implementation of TOML's local date/time. +// Copied over from https://github.com/googleapis/google-cloud-go/blob/master/civil/civil.go +// to avoid pulling all the Google dependencies. +// +// Copyright 2016 Google LLC +// +// 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 civil implements types for civil time, a time-zone-independent +// representation of time that follows the rules of the proleptic +// Gregorian calendar with exactly 24-hour days, 60-minute hours, and 60-second +// minutes. +// +// Because they lack location information, these types do not represent unique +// moments or intervals of time. Use time.Time for that purpose. + +package toml + +import ( + "fmt" + "time" +) + +// A LocalDate represents a date (year, month, day). +// +// This type does not include location information, and therefore does not +// describe a unique 24-hour timespan. +type LocalDate struct { + Year int // Year (e.g., 2014). + Month time.Month // Month of the year (January = 1, ...). + Day int // Day of the month, starting at 1. +} + +// LocalDateOf returns the LocalDate in which a time occurs in that time's location. +func LocalDateOf(t time.Time) LocalDate { + var d LocalDate + d.Year, d.Month, d.Day = t.Date() + + return d +} + +// ParseLocalDate parses a string in RFC3339 full-date format and returns the date value it represents. +func ParseLocalDate(s string) (LocalDate, error) { + t, err := time.Parse("2006-01-02", s) + if err != nil { + return LocalDate{}, err + } + + return LocalDateOf(t), nil +} + +// String returns the date in RFC3339 full-date format. +func (d LocalDate) String() string { + return fmt.Sprintf("%04d-%02d-%02d", d.Year, d.Month, d.Day) +} + +// IsValid reports whether the date is valid. +func (d LocalDate) IsValid() bool { + return LocalDateOf(d.In(time.UTC)) == d +} + +// In returns the time corresponding to time 00:00:00 of the date in the location. +// +// In is always consistent with time.LocalDate, even when time.LocalDate returns a time +// on a different day. For example, if loc is America/Indiana/Vincennes, then both +// time.LocalDate(1955, time.May, 1, 0, 0, 0, 0, loc) +// and +// civil.LocalDate{Year: 1955, Month: time.May, Day: 1}.In(loc) +// return 23:00:00 on April 30, 1955. +// +// In panics if loc is nil. +func (d LocalDate) In(loc *time.Location) time.Time { + return time.Date(d.Year, d.Month, d.Day, 0, 0, 0, 0, loc) +} + +// AddDays returns the date that is n days in the future. +// n can also be negative to go into the past. +func (d LocalDate) AddDays(n int) LocalDate { + return LocalDateOf(d.In(time.UTC).AddDate(0, 0, n)) +} + +// DaysSince returns the signed number of days between the date and s, not including the end day. +// This is the inverse operation to AddDays. +func (d LocalDate) DaysSince(s LocalDate) (days int) { + // We convert to Unix time so we do not have to worry about leap seconds: + // Unix time increases by exactly 86400 seconds per day. + deltaUnix := d.In(time.UTC).Unix() - s.In(time.UTC).Unix() + + const secondsInADay = 86400 + + return int(deltaUnix / secondsInADay) +} + +// Before reports whether d1 occurs before future date. +func (d LocalDate) Before(future LocalDate) bool { + if d.Year != future.Year { + return d.Year < future.Year + } + + if d.Month != future.Month { + return d.Month < future.Month + } + + return d.Day < future.Day +} + +// After reports whether d1 occurs after past date. +func (d LocalDate) After(past LocalDate) bool { + return past.Before(d) +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The output is the result of d.String(). +func (d LocalDate) MarshalText() ([]byte, error) { + return []byte(d.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// The date is expected to be a string in a format accepted by ParseLocalDate. +func (d *LocalDate) UnmarshalText(data []byte) error { + var err error + *d, err = ParseLocalDate(string(data)) + + return err +} + +// A LocalTime represents a time with nanosecond precision. +// +// This type does not include location information, and therefore does not +// describe a unique moment in time. +// +// This type exists to represent the TIME type in storage-based APIs like BigQuery. +// Most operations on Times are unlikely to be meaningful. Prefer the LocalDateTime type. +type LocalTime struct { + Hour int // The hour of the day in 24-hour format; range [0-23] + Minute int // The minute of the hour; range [0-59] + Second int // The second of the minute; range [0-59] + Nanosecond int // The nanosecond of the second; range [0-999999999] +} + +// LocalTimeOf returns the LocalTime representing the time of day in which a time occurs +// in that time's location. It ignores the date. +func LocalTimeOf(t time.Time) LocalTime { + var tm LocalTime + tm.Hour, tm.Minute, tm.Second = t.Clock() + tm.Nanosecond = t.Nanosecond() + + return tm +} + +// ParseLocalTime parses a string and returns the time value it represents. +// ParseLocalTime accepts an extended form of the RFC3339 partial-time format. After +// the HH:MM:SS part of the string, an optional fractional part may appear, +// consisting of a decimal point followed by one to nine decimal digits. +// (RFC3339 admits only one digit after the decimal point). +func ParseLocalTime(s string) (LocalTime, error) { + t, err := time.Parse("15:04:05.999999999", s) + if err != nil { + return LocalTime{}, err + } + + return LocalTimeOf(t), nil +} + +// String returns the date in the format described in ParseLocalTime. If Nanoseconds +// is zero, no fractional part will be generated. Otherwise, the result will +// end with a fractional part consisting of a decimal point and nine digits. +func (t LocalTime) String() string { + s := fmt.Sprintf("%02d:%02d:%02d", t.Hour, t.Minute, t.Second) + if t.Nanosecond == 0 { + return s + } + + return s + fmt.Sprintf(".%09d", t.Nanosecond) +} + +// IsValid reports whether the time is valid. +func (t LocalTime) IsValid() bool { + // Construct a non-zero time. + tm := time.Date(2, 2, 2, t.Hour, t.Minute, t.Second, t.Nanosecond, time.UTC) + + return LocalTimeOf(tm) == t +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The output is the result of t.String(). +func (t LocalTime) MarshalText() ([]byte, error) { + return []byte(t.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// The time is expected to be a string in a format accepted by ParseLocalTime. +func (t *LocalTime) UnmarshalText(data []byte) error { + var err error + *t, err = ParseLocalTime(string(data)) + + return err +} + +// A LocalDateTime represents a date and time. +// +// This type does not include location information, and therefore does not +// describe a unique moment in time. +type LocalDateTime struct { + Date LocalDate + Time LocalTime +} + +// Note: We deliberately do not embed LocalDate into LocalDateTime, to avoid promoting AddDays and Sub. + +// LocalDateTimeOf returns the LocalDateTime in which a time occurs in that time's location. +func LocalDateTimeOf(t time.Time) LocalDateTime { + return LocalDateTime{ + Date: LocalDateOf(t), + Time: LocalTimeOf(t), + } +} + +// ParseLocalDateTime parses a string and returns the LocalDateTime it represents. +// ParseLocalDateTime accepts a variant of the RFC3339 date-time format that omits +// the time offset but includes an optional fractional time, as described in +// ParseLocalTime. Informally, the accepted format is +// YYYY-MM-DDTHH:MM:SS[.FFFFFFFFF] +// where the 'T' may be a lower-case 't'. +func ParseLocalDateTime(s string) (LocalDateTime, error) { + t, err := time.Parse("2006-01-02T15:04:05.999999999", s) + if err != nil { + t, err = time.Parse("2006-01-02t15:04:05.999999999", s) + if err != nil { + return LocalDateTime{}, err + } + } + + return LocalDateTimeOf(t), nil +} + +// String returns the date in the format described in ParseLocalDate. +func (dt LocalDateTime) String() string { + return dt.Date.String() + "T" + dt.Time.String() +} + +// IsValid reports whether the datetime is valid. +func (dt LocalDateTime) IsValid() bool { + return dt.Date.IsValid() && dt.Time.IsValid() +} + +// In returns the time corresponding to the LocalDateTime in the given location. +// +// If the time is missing or ambigous at the location, In returns the same +// result as time.LocalDate. For example, if loc is America/Indiana/Vincennes, then +// both +// time.LocalDate(1955, time.May, 1, 0, 30, 0, 0, loc) +// and +// civil.LocalDateTime{ +// civil.LocalDate{Year: 1955, Month: time.May, Day: 1}}, +// civil.LocalTime{Minute: 30}}.In(loc) +// return 23:30:00 on April 30, 1955. +// +// In panics if loc is nil. +func (dt LocalDateTime) In(loc *time.Location) time.Time { + return time.Date( + dt.Date.Year, dt.Date.Month, dt.Date.Day, + dt.Time.Hour, dt.Time.Minute, dt.Time.Second, dt.Time.Nanosecond, loc, + ) +} + +// Before reports whether dt occurs before future. +func (dt LocalDateTime) Before(future LocalDateTime) bool { + return dt.In(time.UTC).Before(future.In(time.UTC)) +} + +// After reports whether dt occurs after past. +func (dt LocalDateTime) After(past LocalDateTime) bool { + return past.Before(dt) +} + +// MarshalText implements the encoding.TextMarshaler interface. +// The output is the result of dt.String(). +func (dt LocalDateTime) MarshalText() ([]byte, error) { + return []byte(dt.String()), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +// The datetime is expected to be a string in a format accepted by ParseLocalDateTime. +func (dt *LocalDateTime) UnmarshalText(data []byte) error { + var err error + *dt, err = ParseLocalDateTime(string(data)) + + return err +} diff --git a/vendor/github.com/pelletier/go-toml/v2/marshaler.go b/vendor/github.com/pelletier/go-toml/v2/marshaler.go new file mode 100644 index 000000000..ce9972aae --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/marshaler.go @@ -0,0 +1,796 @@ +package toml + +import ( + "bytes" + "encoding" + "fmt" + "io" + "reflect" + "sort" + "strconv" + "strings" + "time" +) + +// Marshal serializes a Go value as a TOML document. +// +// It is a shortcut for Encoder.Encode() with the default options. +func Marshal(v interface{}) ([]byte, error) { + var buf bytes.Buffer + enc := NewEncoder(&buf) + + err := enc.Encode(v) + if err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +// Encoder writes a TOML document to an output stream. +type Encoder struct { + // output + w io.Writer + + // global settings + tablesInline bool + arraysMultiline bool + indentSymbol string + indentTables bool +} + +// NewEncoder returns a new Encoder that writes to w. +func NewEncoder(w io.Writer) *Encoder { + return &Encoder{ + w: w, + indentSymbol: " ", + } +} + +// SetTablesInline forces the encoder to emit all tables inline. +// +// This behavior can be controlled on an individual struct field basis with the +// inline tag: +// +// MyField `inline:"true"` +func (enc *Encoder) SetTablesInline(inline bool) { + enc.tablesInline = inline +} + +// SetArraysMultiline forces the encoder to emit all arrays with one element per +// line. +// +// This behavior can be controlled on an individual struct field basis with the multiline tag: +// +// MyField `multiline:"true"` +func (enc *Encoder) SetArraysMultiline(multiline bool) { + enc.arraysMultiline = multiline +} + +// SetIndentSymbol defines the string that should be used for indentation. The +// provided string is repeated for each indentation level. Defaults to two +// spaces. +func (enc *Encoder) SetIndentSymbol(s string) { + enc.indentSymbol = s +} + +// SetIndentTables forces the encoder to intent tables and array tables. +func (enc *Encoder) SetIndentTables(indent bool) { + enc.indentTables = indent +} + +// Encode writes a TOML representation of v to the stream. +// +// If v cannot be represented to TOML it returns an error. +// +// Encoding rules +// +// A top level slice containing only maps or structs is encoded as [[table +// array]]. +// +// All slices not matching rule 1 are encoded as [array]. As a result, any map +// or struct they contain is encoded as an {inline table}. +// +// Nil interfaces and nil pointers are not supported. +// +// Keys in key-values always have one part. +// +// Intermediate tables are always printed. +// +// By default, strings are encoded as literal string, unless they contain either +// a newline character or a single quote. In that case they are emitted as quoted +// strings. +// +// When encoding structs, fields are encoded in order of definition, with their +// exact name. +// +// Struct tags +// +// The following struct tags are available to tweak encoding on a per-field +// basis: +// +// toml:"foo" +// Changes the name of the key to use for the field to foo. +// +// multiline:"true" +// When the field contains a string, it will be emitted as a quoted +// multi-line TOML string. +// +// inline:"true" +// When the field would normally be encoded as a table, it is instead +// encoded as an inline table. +func (enc *Encoder) Encode(v interface{}) error { + var ( + b []byte + ctx encoderCtx + ) + + ctx.inline = enc.tablesInline + + if v == nil { + return fmt.Errorf("toml: cannot encode a nil interface") + } + + b, err := enc.encode(b, ctx, reflect.ValueOf(v)) + if err != nil { + return err + } + + _, err = enc.w.Write(b) + if err != nil { + return fmt.Errorf("toml: cannot write: %w", err) + } + + return nil +} + +type valueOptions struct { + multiline bool +} + +type encoderCtx struct { + // Current top-level key. + parentKey []string + + // Key that should be used for a KV. + key string + // Extra flag to account for the empty string + hasKey bool + + // Set to true to indicate that the encoder is inside a KV, so that all + // tables need to be inlined. + insideKv bool + + // Set to true to skip the first table header in an array table. + skipTableHeader bool + + // Should the next table be encoded as inline + inline bool + + // Indentation level + indent int + + // Options coming from struct tags + options valueOptions +} + +func (ctx *encoderCtx) shiftKey() { + if ctx.hasKey { + ctx.parentKey = append(ctx.parentKey, ctx.key) + ctx.clearKey() + } +} + +func (ctx *encoderCtx) setKey(k string) { + ctx.key = k + ctx.hasKey = true +} + +func (ctx *encoderCtx) clearKey() { + ctx.key = "" + ctx.hasKey = false +} + +func (ctx *encoderCtx) isRoot() bool { + return len(ctx.parentKey) == 0 && !ctx.hasKey +} + +//nolint:cyclop,funlen +func (enc *Encoder) encode(b []byte, ctx encoderCtx, v reflect.Value) ([]byte, error) { + if !v.IsZero() { + i, ok := v.Interface().(time.Time) + if ok { + return i.AppendFormat(b, time.RFC3339), nil + } + } + + if v.Type().Implements(textMarshalerType) { + if ctx.isRoot() { + return nil, fmt.Errorf("toml: type %s implementing the TextMarshaler interface cannot be a root element", v.Type()) + } + + text, err := v.Interface().(encoding.TextMarshaler).MarshalText() + if err != nil { + return nil, err + } + + b = enc.encodeString(b, string(text), ctx.options) + + return b, nil + } + + switch v.Kind() { + // containers + case reflect.Map: + return enc.encodeMap(b, ctx, v) + case reflect.Struct: + return enc.encodeStruct(b, ctx, v) + case reflect.Slice: + return enc.encodeSlice(b, ctx, v) + case reflect.Interface: + if v.IsNil() { + return nil, fmt.Errorf("toml: encoding a nil interface is not supported") + } + + return enc.encode(b, ctx, v.Elem()) + case reflect.Ptr: + if v.IsNil() { + return enc.encode(b, ctx, reflect.Zero(v.Type().Elem())) + } + + return enc.encode(b, ctx, v.Elem()) + + // values + case reflect.String: + b = enc.encodeString(b, v.String(), ctx.options) + case reflect.Float32: + b = strconv.AppendFloat(b, v.Float(), 'f', -1, 32) + case reflect.Float64: + b = strconv.AppendFloat(b, v.Float(), 'f', -1, 64) + case reflect.Bool: + if v.Bool() { + b = append(b, "true"...) + } else { + b = append(b, "false"...) + } + case reflect.Uint64, reflect.Uint32, reflect.Uint16, reflect.Uint8, reflect.Uint: + b = strconv.AppendUint(b, v.Uint(), 10) + case reflect.Int64, reflect.Int32, reflect.Int16, reflect.Int8, reflect.Int: + b = strconv.AppendInt(b, v.Int(), 10) + default: + return nil, fmt.Errorf("toml: cannot encode value of type %s", v.Kind()) + } + + return b, nil +} + +func isNil(v reflect.Value) bool { + switch v.Kind() { + case reflect.Ptr, reflect.Interface, reflect.Map: + return v.IsNil() + default: + return false + } +} + +func (enc *Encoder) encodeKv(b []byte, ctx encoderCtx, options valueOptions, v reflect.Value) ([]byte, error) { + var err error + + if !ctx.hasKey { + panic("caller of encodeKv should have set the key in the context") + } + b = enc.indent(ctx.indent, b) + + b, err = enc.encodeKey(b, ctx.key) + if err != nil { + return nil, err + } + + b = append(b, " = "...) + + // create a copy of the context because the value of a KV shouldn't + // modify the global context. + subctx := ctx + subctx.insideKv = true + subctx.shiftKey() + subctx.options = options + + b, err = enc.encode(b, subctx, v) + if err != nil { + return nil, err + } + + return b, nil +} + +const literalQuote = '\'' + +func (enc *Encoder) encodeString(b []byte, v string, options valueOptions) []byte { + if needsQuoting(v) { + return enc.encodeQuotedString(options.multiline, b, v) + } + + return enc.encodeLiteralString(b, v) +} + +func needsQuoting(v string) bool { + return strings.ContainsAny(v, "'\b\f\n\r\t") +} + +// caller should have checked that the string does not contain new lines or ' . +func (enc *Encoder) encodeLiteralString(b []byte, v string) []byte { + b = append(b, literalQuote) + b = append(b, v...) + b = append(b, literalQuote) + + return b +} + +//nolint:cyclop +func (enc *Encoder) encodeQuotedString(multiline bool, b []byte, v string) []byte { + stringQuote := `"` + + if multiline { + stringQuote = `"""` + } + + b = append(b, stringQuote...) + if multiline { + b = append(b, '\n') + } + + const ( + hextable = "0123456789ABCDEF" + // U+0000 to U+0008, U+000A to U+001F, U+007F + nul = 0x0 + bs = 0x8 + lf = 0xa + us = 0x1f + del = 0x7f + ) + + for _, r := range []byte(v) { + switch r { + case '\\': + b = append(b, `\\`...) + case '"': + b = append(b, `\"`...) + case '\b': + b = append(b, `\b`...) + case '\f': + b = append(b, `\f`...) + case '\n': + if multiline { + b = append(b, r) + } else { + b = append(b, `\n`...) + } + case '\r': + b = append(b, `\r`...) + case '\t': + b = append(b, `\t`...) + default: + switch { + case r >= nul && r <= bs, r >= lf && r <= us, r == del: + b = append(b, `\u00`...) + b = append(b, hextable[r>>4]) + b = append(b, hextable[r&0x0f]) + default: + b = append(b, r) + } + } + } + + b = append(b, stringQuote...) + + return b +} + +// called should have checked that the string is in A-Z / a-z / 0-9 / - / _ . +func (enc *Encoder) encodeUnquotedKey(b []byte, v string) []byte { + return append(b, v...) +} + +func (enc *Encoder) encodeTableHeader(ctx encoderCtx, b []byte) ([]byte, error) { + if len(ctx.parentKey) == 0 { + return b, nil + } + + b = enc.indent(ctx.indent, b) + + b = append(b, '[') + + var err error + + b, err = enc.encodeKey(b, ctx.parentKey[0]) + if err != nil { + return nil, err + } + + for _, k := range ctx.parentKey[1:] { + b = append(b, '.') + + b, err = enc.encodeKey(b, k) + if err != nil { + return nil, err + } + } + + b = append(b, "]\n"...) + + return b, nil +} + +//nolint:cyclop +func (enc *Encoder) encodeKey(b []byte, k string) ([]byte, error) { + needsQuotation := false + cannotUseLiteral := false + + for _, c := range k { + if (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-' || c == '_' { + continue + } + + if c == '\n' { + return nil, fmt.Errorf("toml: new line characters in keys are not supported") + } + + if c == literalQuote { + cannotUseLiteral = true + } + + needsQuotation = true + } + + switch { + case cannotUseLiteral: + return enc.encodeQuotedString(false, b, k), nil + case needsQuotation: + return enc.encodeLiteralString(b, k), nil + default: + return enc.encodeUnquotedKey(b, k), nil + } +} + +func (enc *Encoder) encodeMap(b []byte, ctx encoderCtx, v reflect.Value) ([]byte, error) { + if v.Type().Key().Kind() != reflect.String { + return nil, fmt.Errorf("toml: type %s is not supported as a map key", v.Type().Key().Kind()) + } + + var ( + t table + emptyValueOptions valueOptions + ) + + iter := v.MapRange() + for iter.Next() { + k := iter.Key().String() + v := iter.Value() + + if isNil(v) { + continue + } + + if willConvertToTableOrArrayTable(ctx, v) { + t.pushTable(k, v, emptyValueOptions) + } else { + t.pushKV(k, v, emptyValueOptions) + } + } + + sortEntriesByKey(t.kvs) + sortEntriesByKey(t.tables) + + return enc.encodeTable(b, ctx, t) +} + +func sortEntriesByKey(e []entry) { + sort.Slice(e, func(i, j int) bool { + return e[i].Key < e[j].Key + }) +} + +type entry struct { + Key string + Value reflect.Value + Options valueOptions +} + +type table struct { + kvs []entry + tables []entry +} + +func (t *table) pushKV(k string, v reflect.Value, options valueOptions) { + t.kvs = append(t.kvs, entry{Key: k, Value: v, Options: options}) +} + +func (t *table) pushTable(k string, v reflect.Value, options valueOptions) { + t.tables = append(t.tables, entry{Key: k, Value: v, Options: options}) +} + +func (enc *Encoder) encodeStruct(b []byte, ctx encoderCtx, v reflect.Value) ([]byte, error) { + var t table + + //nolint:godox + // TODO: cache this? + typ := v.Type() + for i := 0; i < typ.NumField(); i++ { + fieldType := typ.Field(i) + + // only consider exported fields + if fieldType.PkgPath != "" { + continue + } + + k, ok := fieldType.Tag.Lookup("toml") + if !ok { + k = fieldType.Name + } + + // special field name to skip field + if k == "-" { + continue + } + + f := v.Field(i) + + if isNil(f) { + continue + } + + options := valueOptions{ + multiline: fieldBoolTag(fieldType, "multiline"), + } + + inline := fieldBoolTag(fieldType, "inline") + + if inline || !willConvertToTableOrArrayTable(ctx, f) { + t.pushKV(k, f, options) + } else { + t.pushTable(k, f, options) + } + } + + return enc.encodeTable(b, ctx, t) +} + +func fieldBoolTag(field reflect.StructField, tag string) bool { + x, ok := field.Tag.Lookup(tag) + + return ok && x == "true" +} + +//nolint:cyclop +func (enc *Encoder) encodeTable(b []byte, ctx encoderCtx, t table) ([]byte, error) { + var err error + + ctx.shiftKey() + + if ctx.insideKv || (ctx.inline && !ctx.isRoot()) { + return enc.encodeTableInline(b, ctx, t) + } + + if !ctx.skipTableHeader { + b, err = enc.encodeTableHeader(ctx, b) + if err != nil { + return nil, err + } + + if enc.indentTables && len(ctx.parentKey) > 0 { + ctx.indent++ + } + } + ctx.skipTableHeader = false + + for _, kv := range t.kvs { + ctx.setKey(kv.Key) + + b, err = enc.encodeKv(b, ctx, kv.Options, kv.Value) + if err != nil { + return nil, err + } + + b = append(b, '\n') + } + + for _, table := range t.tables { + ctx.setKey(table.Key) + + ctx.options = table.Options + + b, err = enc.encode(b, ctx, table.Value) + if err != nil { + return nil, err + } + + b = append(b, '\n') + } + + return b, nil +} + +func (enc *Encoder) encodeTableInline(b []byte, ctx encoderCtx, t table) ([]byte, error) { + var err error + + b = append(b, '{') + + first := true + for _, kv := range t.kvs { + if first { + first = false + } else { + b = append(b, `, `...) + } + + ctx.setKey(kv.Key) + + b, err = enc.encodeKv(b, ctx, kv.Options, kv.Value) + if err != nil { + return nil, err + } + } + + if len(t.tables) > 0 { + panic("inline table cannot contain nested tables, online key-values") + } + + b = append(b, "}"...) + + return b, nil +} + +var textMarshalerType = reflect.TypeOf(new(encoding.TextMarshaler)).Elem() + +func willConvertToTable(ctx encoderCtx, v reflect.Value) bool { + if v.Type() == timeType || v.Type().Implements(textMarshalerType) { + return false + } + + t := v.Type() + switch t.Kind() { + case reflect.Map, reflect.Struct: + return !ctx.inline + case reflect.Interface: + return willConvertToTable(ctx, v.Elem()) + case reflect.Ptr: + if v.IsNil() { + return false + } + + return willConvertToTable(ctx, v.Elem()) + default: + return false + } +} + +func willConvertToTableOrArrayTable(ctx encoderCtx, v reflect.Value) bool { + t := v.Type() + + if t.Kind() == reflect.Interface { + return willConvertToTableOrArrayTable(ctx, v.Elem()) + } + + if t.Kind() == reflect.Slice { + if v.Len() == 0 { + // An empty slice should be a kv = []. + return false + } + + for i := 0; i < v.Len(); i++ { + t := willConvertToTable(ctx, v.Index(i)) + + if !t { + return false + } + } + + return true + } + + return willConvertToTable(ctx, v) +} + +func (enc *Encoder) encodeSlice(b []byte, ctx encoderCtx, v reflect.Value) ([]byte, error) { + if v.Len() == 0 { + b = append(b, "[]"...) + + return b, nil + } + + if willConvertToTableOrArrayTable(ctx, v) { + return enc.encodeSliceAsArrayTable(b, ctx, v) + } + + return enc.encodeSliceAsArray(b, ctx, v) +} + +// caller should have checked that v is a slice that only contains values that +// encode into tables. +func (enc *Encoder) encodeSliceAsArrayTable(b []byte, ctx encoderCtx, v reflect.Value) ([]byte, error) { + ctx.shiftKey() + + var err error + scratch := make([]byte, 0, 64) + scratch = append(scratch, "[["...) + + for i, k := range ctx.parentKey { + if i > 0 { + scratch = append(scratch, '.') + } + + scratch, err = enc.encodeKey(scratch, k) + if err != nil { + return nil, err + } + } + + scratch = append(scratch, "]]\n"...) + ctx.skipTableHeader = true + + for i := 0; i < v.Len(); i++ { + b = append(b, scratch...) + + b, err = enc.encode(b, ctx, v.Index(i)) + if err != nil { + return nil, err + } + } + + return b, nil +} + +func (enc *Encoder) encodeSliceAsArray(b []byte, ctx encoderCtx, v reflect.Value) ([]byte, error) { + multiline := ctx.options.multiline || enc.arraysMultiline + separator := ", " + + b = append(b, '[') + + subCtx := ctx + subCtx.options = valueOptions{} + + if multiline { + separator = ",\n" + + b = append(b, '\n') + + subCtx.indent++ + } + + var err error + first := true + + for i := 0; i < v.Len(); i++ { + if first { + first = false + } else { + b = append(b, separator...) + } + + if multiline { + b = enc.indent(subCtx.indent, b) + } + + b, err = enc.encode(b, subCtx, v.Index(i)) + if err != nil { + return nil, err + } + } + + if multiline { + b = append(b, '\n') + b = enc.indent(ctx.indent, b) + } + + b = append(b, ']') + + return b, nil +} + +func (enc *Encoder) indent(level int, b []byte) []byte { + for i := 0; i < level; i++ { + b = append(b, enc.indentSymbol...) + } + + return b +} diff --git a/vendor/github.com/pelletier/go-toml/v2/parser.go b/vendor/github.com/pelletier/go-toml/v2/parser.go new file mode 100644 index 000000000..eefbf032a --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/parser.go @@ -0,0 +1,981 @@ +package toml + +import ( + "bytes" + "strconv" + + "github.com/pelletier/go-toml/v2/internal/ast" +) + +type parser struct { + builder ast.Builder + ref ast.Reference + data []byte + left []byte + err error + first bool +} + +func (p *parser) Reset(b []byte) { + p.builder.Reset() + p.ref = ast.Reference{} + p.data = b + p.left = b + p.err = nil + p.first = true +} + +//nolint:cyclop +func (p *parser) NextExpression() bool { + if len(p.left) == 0 || p.err != nil { + return false + } + + p.builder.Reset() + p.ref = ast.Reference{} + + for { + if len(p.left) == 0 || p.err != nil { + return false + } + + if !p.first { + p.left, p.err = p.parseNewline(p.left) + } + + if len(p.left) == 0 || p.err != nil { + return false + } + + p.ref, p.left, p.err = p.parseExpression(p.left) + + if p.err != nil { + return false + } + + p.first = false + + if p.ref.Valid() { + return true + } + } +} + +func (p *parser) Expression() ast.Node { + return p.builder.NodeAt(p.ref) +} + +func (p *parser) Error() error { + return p.err +} + +func (p *parser) parseNewline(b []byte) ([]byte, error) { + if b[0] == '\n' { + return b[1:], nil + } + + if b[0] == '\r' { + _, rest, err := scanWindowsNewline(b) + return rest, err + } + + return nil, newDecodeError(b[0:1], "expected newline but got %#U", b[0]) +} + +func (p *parser) parseExpression(b []byte) (ast.Reference, []byte, error) { + // expression = ws [ comment ] + // expression =/ ws keyval ws [ comment ] + // expression =/ ws table ws [ comment ] + var ref ast.Reference + + b = p.parseWhitespace(b) + + if len(b) == 0 { + return ref, b, nil + } + + if b[0] == '#' { + _, rest := scanComment(b) + + return ref, rest, nil + } + + if b[0] == '\n' || b[0] == '\r' { + return ref, b, nil + } + + var err error + if b[0] == '[' { + ref, b, err = p.parseTable(b) + } else { + ref, b, err = p.parseKeyval(b) + } + + if err != nil { + return ref, nil, err + } + + b = p.parseWhitespace(b) + + if len(b) > 0 && b[0] == '#' { + _, rest := scanComment(b) + + return ref, rest, nil + } + + return ref, b, nil +} + +func (p *parser) parseTable(b []byte) (ast.Reference, []byte, error) { + // table = std-table / array-table + if len(b) > 1 && b[1] == '[' { + return p.parseArrayTable(b) + } + + return p.parseStdTable(b) +} + +func (p *parser) parseArrayTable(b []byte) (ast.Reference, []byte, error) { + // array-table = array-table-open key array-table-close + // array-table-open = %x5B.5B ws ; [[ Double left square bracket + // array-table-close = ws %x5D.5D ; ]] Double right square bracket + ref := p.builder.Push(ast.Node{ + Kind: ast.ArrayTable, + }) + + b = b[2:] + b = p.parseWhitespace(b) + + k, b, err := p.parseKey(b) + if err != nil { + return ref, nil, err + } + + p.builder.AttachChild(ref, k) + b = p.parseWhitespace(b) + + b, err = expect(']', b) + if err != nil { + return ref, nil, err + } + + b, err = expect(']', b) + + return ref, b, err +} + +func (p *parser) parseStdTable(b []byte) (ast.Reference, []byte, error) { + // std-table = std-table-open key std-table-close + // std-table-open = %x5B ws ; [ Left square bracket + // std-table-close = ws %x5D ; ] Right square bracket + ref := p.builder.Push(ast.Node{ + Kind: ast.Table, + }) + + b = b[1:] + b = p.parseWhitespace(b) + + key, b, err := p.parseKey(b) + if err != nil { + return ref, nil, err + } + + p.builder.AttachChild(ref, key) + + b = p.parseWhitespace(b) + + b, err = expect(']', b) + + return ref, b, err +} + +func (p *parser) parseKeyval(b []byte) (ast.Reference, []byte, error) { + // keyval = key keyval-sep val + ref := p.builder.Push(ast.Node{ + Kind: ast.KeyValue, + }) + + key, b, err := p.parseKey(b) + if err != nil { + return ast.Reference{}, nil, err + } + + // keyval-sep = ws %x3D ws ; = + + b = p.parseWhitespace(b) + + if len(b) == 0 { + return ast.Reference{}, nil, newDecodeError(b, "expected = after a key, but the document ends there") + } + + b, err = expect('=', b) + if err != nil { + return ast.Reference{}, nil, err + } + + b = p.parseWhitespace(b) + + valRef, b, err := p.parseVal(b) + if err != nil { + return ref, b, err + } + + p.builder.Chain(valRef, key) + p.builder.AttachChild(ref, valRef) + + return ref, b, err +} + +//nolint:cyclop,funlen +func (p *parser) parseVal(b []byte) (ast.Reference, []byte, error) { + // val = string / boolean / array / inline-table / date-time / float / integer + var ref ast.Reference + + if len(b) == 0 { + return ref, nil, newDecodeError(b, "expected value, not eof") + } + + var err error + c := b[0] + + switch c { + case '"': + var v []byte + if scanFollowsMultilineBasicStringDelimiter(b) { + v, b, err = p.parseMultilineBasicString(b) + } else { + v, b, err = p.parseBasicString(b) + } + + if err == nil { + ref = p.builder.Push(ast.Node{ + Kind: ast.String, + Data: v, + }) + } + + return ref, b, err + case '\'': + var v []byte + if scanFollowsMultilineLiteralStringDelimiter(b) { + v, b, err = p.parseMultilineLiteralString(b) + } else { + v, b, err = p.parseLiteralString(b) + } + + if err == nil { + ref = p.builder.Push(ast.Node{ + Kind: ast.String, + Data: v, + }) + } + + return ref, b, err + case 't': + if !scanFollowsTrue(b) { + return ref, nil, newDecodeError(atmost(b, 4), "expected 'true'") + } + + ref = p.builder.Push(ast.Node{ + Kind: ast.Bool, + Data: b[:4], + }) + + return ref, b[4:], nil + case 'f': + if !scanFollowsFalse(b) { + return ref, nil, newDecodeError(atmost(b, 5), "expected 'false'") + } + + ref = p.builder.Push(ast.Node{ + Kind: ast.Bool, + Data: b[:5], + }) + + return ref, b[5:], nil + case '[': + return p.parseValArray(b) + case '{': + return p.parseInlineTable(b) + default: + return p.parseIntOrFloatOrDateTime(b) + } +} + +func atmost(b []byte, n int) []byte { + if n >= len(b) { + return b + } + + return b[:n] +} + +func (p *parser) parseLiteralString(b []byte) ([]byte, []byte, error) { + v, rest, err := scanLiteralString(b) + if err != nil { + return nil, nil, err + } + + return v[1 : len(v)-1], rest, nil +} + +func (p *parser) parseInlineTable(b []byte) (ast.Reference, []byte, error) { + // inline-table = inline-table-open [ inline-table-keyvals ] inline-table-close + // inline-table-open = %x7B ws ; { + // inline-table-close = ws %x7D ; } + // inline-table-sep = ws %x2C ws ; , Comma + // inline-table-keyvals = keyval [ inline-table-sep inline-table-keyvals ] + parent := p.builder.Push(ast.Node{ + Kind: ast.InlineTable, + }) + + first := true + + var child ast.Reference + + b = b[1:] + + var err error + + for len(b) > 0 { + b = p.parseWhitespace(b) + if b[0] == '}' { + break + } + + if !first { + b, err = expect(',', b) + if err != nil { + return parent, nil, err + } + b = p.parseWhitespace(b) + } + + var kv ast.Reference + + kv, b, err = p.parseKeyval(b) + if err != nil { + return parent, nil, err + } + + if first { + p.builder.AttachChild(parent, kv) + } else { + p.builder.Chain(child, kv) + } + child = kv + + first = false + } + + rest, err := expect('}', b) + + return parent, rest, err +} + +//nolint:funlen,cyclop +func (p *parser) parseValArray(b []byte) (ast.Reference, []byte, error) { + // array = array-open [ array-values ] ws-comment-newline array-close + // array-open = %x5B ; [ + // array-close = %x5D ; ] + // array-values = ws-comment-newline val ws-comment-newline array-sep array-values + // array-values =/ ws-comment-newline val ws-comment-newline [ array-sep ] + // array-sep = %x2C ; , Comma + // ws-comment-newline = *( wschar / [ comment ] newline ) + b = b[1:] + + parent := p.builder.Push(ast.Node{ + Kind: ast.Array, + }) + + first := true + + var lastChild ast.Reference + + var err error + for len(b) > 0 { + b, err = p.parseOptionalWhitespaceCommentNewline(b) + if err != nil { + return parent, nil, err + } + + if len(b) == 0 { + return parent, nil, newDecodeError(b, "array is incomplete") + } + + if b[0] == ']' { + break + } + + if b[0] == ',' { + if first { + return parent, nil, newDecodeError(b[0:1], "array cannot start with comma") + } + b = b[1:] + + b, err = p.parseOptionalWhitespaceCommentNewline(b) + if err != nil { + return parent, nil, err + } + } + + // TOML allows trailing commas in arrays. + if len(b) > 0 && b[0] == ']' { + break + } + + var valueRef ast.Reference + + valueRef, b, err = p.parseVal(b) + if err != nil { + return parent, nil, err + } + + if first { + p.builder.AttachChild(parent, valueRef) + } else { + p.builder.Chain(lastChild, valueRef) + } + lastChild = valueRef + + b, err = p.parseOptionalWhitespaceCommentNewline(b) + if err != nil { + return parent, nil, err + } + first = false + } + + rest, err := expect(']', b) + + return parent, rest, err +} + +func (p *parser) parseOptionalWhitespaceCommentNewline(b []byte) ([]byte, error) { + for len(b) > 0 { + var err error + b = p.parseWhitespace(b) + + if len(b) > 0 && b[0] == '#' { + _, b = scanComment(b) + } + + if len(b) == 0 { + break + } + + if b[0] == '\n' || b[0] == '\r' { + b, err = p.parseNewline(b) + if err != nil { + return nil, err + } + } else { + break + } + } + + return b, nil +} + +func (p *parser) parseMultilineLiteralString(b []byte) ([]byte, []byte, error) { + token, rest, err := scanMultilineLiteralString(b) + if err != nil { + return nil, nil, err + } + + i := 3 + + // skip the immediate new line + if token[i] == '\n' { + i++ + } else if token[i] == '\r' && token[i+1] == '\n' { + i += 2 + } + + return token[i : len(token)-3], rest, err +} + +//nolint:funlen,gocognit,cyclop +func (p *parser) parseMultilineBasicString(b []byte) ([]byte, []byte, error) { + // ml-basic-string = ml-basic-string-delim [ newline ] ml-basic-body + // ml-basic-string-delim + // ml-basic-string-delim = 3quotation-mark + // ml-basic-body = *mlb-content *( mlb-quotes 1*mlb-content ) [ mlb-quotes ] + // + // mlb-content = mlb-char / newline / mlb-escaped-nl + // mlb-char = mlb-unescaped / escaped + // mlb-quotes = 1*2quotation-mark + // mlb-unescaped = wschar / %x21 / %x23-5B / %x5D-7E / non-ascii + // mlb-escaped-nl = escape ws newline *( wschar / newline ) + token, rest, err := scanMultilineBasicString(b) + if err != nil { + return nil, nil, err + } + + var builder bytes.Buffer + + i := 3 + + // skip the immediate new line + if token[i] == '\n' { + i++ + } else if token[i] == '\r' && token[i+1] == '\n' { + i += 2 + } + + // The scanner ensures that the token starts and ends with quotes and that + // escapes are balanced. + for ; i < len(token)-3; i++ { + c := token[i] + + //nolint:nestif + if c == '\\' { + // When the last non-whitespace character on a line is an unescaped \, + // it will be trimmed along with all whitespace (including newlines) up + // to the next non-whitespace character or closing delimiter. + if token[i+1] == '\n' || (token[i+1] == '\r' && token[i+2] == '\n') { + i++ // skip the \ + for ; i < len(token)-3; i++ { + c := token[i] + if !(c == '\n' || c == '\r' || c == ' ' || c == '\t') { + i-- + + break + } + } + + continue + } + + // handle escaping + i++ + c = token[i] + + switch c { + case '"', '\\': + builder.WriteByte(c) + case 'b': + builder.WriteByte('\b') + case 'f': + builder.WriteByte('\f') + case 'n': + builder.WriteByte('\n') + case 'r': + builder.WriteByte('\r') + case 't': + builder.WriteByte('\t') + case 'u': + x, err := hexToString(atmost(token[i+1:], 4), 4) + if err != nil { + return nil, nil, err + } + + builder.WriteString(x) + i += 4 + case 'U': + x, err := hexToString(atmost(token[i+1:], 8), 8) + if err != nil { + return nil, nil, err + } + + builder.WriteString(x) + i += 8 + default: + return nil, nil, newDecodeError(token[i:i+1], "invalid escaped character %#U", c) + } + } else { + builder.WriteByte(c) + } + } + + return builder.Bytes(), rest, nil +} + +func (p *parser) parseKey(b []byte) (ast.Reference, []byte, error) { + // key = simple-key / dotted-key + // simple-key = quoted-key / unquoted-key + // + // unquoted-key = 1*( ALPHA / DIGIT / %x2D / %x5F ) ; A-Z / a-z / 0-9 / - / _ + // quoted-key = basic-string / literal-string + // dotted-key = simple-key 1*( dot-sep simple-key ) + // + // dot-sep = ws %x2E ws ; . Period + key, b, err := p.parseSimpleKey(b) + if err != nil { + return ast.Reference{}, nil, err + } + + ref := p.builder.Push(ast.Node{ + Kind: ast.Key, + Data: key, + }) + + for { + b = p.parseWhitespace(b) + if len(b) > 0 && b[0] == '.' { + b = p.parseWhitespace(b[1:]) + + key, b, err = p.parseSimpleKey(b) + if err != nil { + return ref, nil, err + } + + p.builder.PushAndChain(ast.Node{ + Kind: ast.Key, + Data: key, + }) + } else { + break + } + } + + return ref, b, nil +} + +func (p *parser) parseSimpleKey(b []byte) (key, rest []byte, err error) { + // simple-key = quoted-key / unquoted-key + // unquoted-key = 1*( ALPHA / DIGIT / %x2D / %x5F ) ; A-Z / a-z / 0-9 / - / _ + // quoted-key = basic-string / literal-string + if len(b) == 0 { + return nil, nil, newDecodeError(b, "key is incomplete") + } + + switch { + case b[0] == '\'': + return p.parseLiteralString(b) + case b[0] == '"': + return p.parseBasicString(b) + case isUnquotedKeyChar(b[0]): + key, rest = scanUnquotedKey(b) + return key, rest, nil + default: + return nil, nil, newDecodeError(b[0:1], "invalid character at start of key: %c", b[0]) + } +} + +//nolint:funlen,cyclop +func (p *parser) parseBasicString(b []byte) ([]byte, []byte, error) { + // basic-string = quotation-mark *basic-char quotation-mark + // quotation-mark = %x22 ; " + // basic-char = basic-unescaped / escaped + // basic-unescaped = wschar / %x21 / %x23-5B / %x5D-7E / non-ascii + // escaped = escape escape-seq-char + // escape-seq-char = %x22 ; " quotation mark U+0022 + // escape-seq-char =/ %x5C ; \ reverse solidus U+005C + // escape-seq-char =/ %x62 ; b backspace U+0008 + // escape-seq-char =/ %x66 ; f form feed U+000C + // escape-seq-char =/ %x6E ; n line feed U+000A + // escape-seq-char =/ %x72 ; r carriage return U+000D + // escape-seq-char =/ %x74 ; t tab U+0009 + // escape-seq-char =/ %x75 4HEXDIG ; uXXXX U+XXXX + // escape-seq-char =/ %x55 8HEXDIG ; UXXXXXXXX U+XXXXXXXX + token, rest, err := scanBasicString(b) + if err != nil { + return nil, nil, err + } + + var builder bytes.Buffer + + // The scanner ensures that the token starts and ends with quotes and that + // escapes are balanced. + for i := 1; i < len(token)-1; i++ { + c := token[i] + if c == '\\' { + i++ + c = token[i] + + switch c { + case '"', '\\': + builder.WriteByte(c) + case 'b': + builder.WriteByte('\b') + case 'f': + builder.WriteByte('\f') + case 'n': + builder.WriteByte('\n') + case 'r': + builder.WriteByte('\r') + case 't': + builder.WriteByte('\t') + case 'u': + x, err := hexToString(token[i+1:len(token)-1], 4) + if err != nil { + return nil, nil, err + } + + builder.WriteString(x) + i += 4 + case 'U': + x, err := hexToString(token[i+1:len(token)-1], 8) + if err != nil { + return nil, nil, err + } + + builder.WriteString(x) + i += 8 + default: + return nil, nil, newDecodeError(token[i:i+1], "invalid escaped character %#U", c) + } + } else { + builder.WriteByte(c) + } + } + + return builder.Bytes(), rest, nil +} + +func hexToString(b []byte, length int) (string, error) { + if len(b) < length { + return "", newDecodeError(b, "unicode point needs %d character, not %d", length, len(b)) + } + b = b[:length] + + //nolint:godox + // TODO: slow + intcode, err := strconv.ParseInt(string(b), 16, 32) + if err != nil { + return "", newDecodeError(b, "couldn't parse hexadecimal number: %w", err) + } + + return string(rune(intcode)), nil +} + +func (p *parser) parseWhitespace(b []byte) []byte { + // ws = *wschar + // wschar = %x20 ; Space + // wschar =/ %x09 ; Horizontal tab + _, rest := scanWhitespace(b) + + return rest +} + +//nolint:cyclop +func (p *parser) parseIntOrFloatOrDateTime(b []byte) (ast.Reference, []byte, error) { + switch b[0] { + case 'i': + if !scanFollowsInf(b) { + return ast.Reference{}, nil, newDecodeError(atmost(b, 3), "expected 'inf'") + } + + return p.builder.Push(ast.Node{ + Kind: ast.Float, + Data: b[:3], + }), b[3:], nil + case 'n': + if !scanFollowsNan(b) { + return ast.Reference{}, nil, newDecodeError(atmost(b, 3), "expected 'nan'") + } + + return p.builder.Push(ast.Node{ + Kind: ast.Float, + Data: b[:3], + }), b[3:], nil + case '+', '-': + return p.scanIntOrFloat(b) + } + + //nolint:gomnd + if len(b) < 3 { + return p.scanIntOrFloat(b) + } + + s := 5 + if len(b) < s { + s = len(b) + } + + for idx, c := range b[:s] { + if isDigit(c) { + continue + } + + if idx == 2 && c == ':' || (idx == 4 && c == '-') { + return p.scanDateTime(b) + } + } + + return p.scanIntOrFloat(b) +} + +func digitsToInt(b []byte) int { + x := 0 + + for _, d := range b { + x *= 10 + x += int(d - '0') + } + + return x +} + +//nolint:gocognit,cyclop +func (p *parser) scanDateTime(b []byte) (ast.Reference, []byte, error) { + // scans for contiguous characters in [0-9T:Z.+-], and up to one space if + // followed by a digit. + hasTime := false + hasTz := false + seenSpace := false + + i := 0 +byteLoop: + for ; i < len(b); i++ { + c := b[i] + + switch { + case isDigit(c): + case c == '-': + const offsetOfTz = 19 + if i == offsetOfTz { + hasTz = true + } + case c == 'T' || c == ':' || c == '.': + hasTime = true + case c == '+' || c == '-' || c == 'Z': + hasTz = true + case c == ' ': + if !seenSpace && i+1 < len(b) && isDigit(b[i+1]) { + i += 2 + seenSpace = true + hasTime = true + } else { + break byteLoop + } + default: + break byteLoop + } + } + + var kind ast.Kind + + if hasTime { + if hasTz { + kind = ast.DateTime + } else { + kind = ast.LocalDateTime + } + } else { + kind = ast.LocalDate + } + + return p.builder.Push(ast.Node{ + Kind: kind, + Data: b[:i], + }), b[i:], nil +} + +//nolint:funlen,gocognit,cyclop +func (p *parser) scanIntOrFloat(b []byte) (ast.Reference, []byte, error) { + i := 0 + + if len(b) > 2 && b[0] == '0' && b[1] != '.' { + var isValidRune validRuneFn + + switch b[1] { + case 'x': + isValidRune = isValidHexRune + case 'o': + isValidRune = isValidOctalRune + case 'b': + isValidRune = isValidBinaryRune + default: + i++ + } + + if isValidRune != nil { + i += 2 + for ; i < len(b); i++ { + if !isValidRune(b[i]) { + break + } + } + } + + return p.builder.Push(ast.Node{ + Kind: ast.Integer, + Data: b[:i], + }), b[i:], nil + } + + isFloat := false + + for ; i < len(b); i++ { + c := b[i] + + if c >= '0' && c <= '9' || c == '+' || c == '-' || c == '_' { + continue + } + + if c == '.' || c == 'e' || c == 'E' { + isFloat = true + + continue + } + + if c == 'i' { + if scanFollowsInf(b[i:]) { + return p.builder.Push(ast.Node{ + Kind: ast.Float, + Data: b[:i+3], + }), b[i+3:], nil + } + + return ast.Reference{}, nil, newDecodeError(b[i:i+1], "unexpected character 'i' while scanning for a number") + } + + if c == 'n' { + if scanFollowsNan(b[i:]) { + return p.builder.Push(ast.Node{ + Kind: ast.Float, + Data: b[:i+3], + }), b[i+3:], nil + } + + return ast.Reference{}, nil, newDecodeError(b[i:i+1], "unexpected character 'n' while scanning for a number") + } + + break + } + + if i == 0 { + return ast.Reference{}, b, newDecodeError(b, "incomplete number") + } + + kind := ast.Integer + + if isFloat { + kind = ast.Float + } + + return p.builder.Push(ast.Node{ + Kind: kind, + Data: b[:i], + }), b[i:], nil +} + +func isDigit(r byte) bool { + return r >= '0' && r <= '9' +} + +type validRuneFn func(r byte) bool + +func isValidHexRune(r byte) bool { + return r >= 'a' && r <= 'f' || + r >= 'A' && r <= 'F' || + r >= '0' && r <= '9' || + r == '_' +} + +func isValidOctalRune(r byte) bool { + return r >= '0' && r <= '7' || r == '_' +} + +func isValidBinaryRune(r byte) bool { + return r == '0' || r == '1' || r == '_' +} + +func expect(x byte, b []byte) ([]byte, error) { + if b[0] != x { + return nil, newDecodeError(b[0:1], "expected character %U", x) + } + + return b[1:], nil +} diff --git a/vendor/github.com/pelletier/go-toml/v2/scanner.go b/vendor/github.com/pelletier/go-toml/v2/scanner.go new file mode 100644 index 000000000..b20370223 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/scanner.go @@ -0,0 +1,173 @@ +package toml + +func scanFollows(b []byte, pattern string) bool { + n := len(pattern) + + return len(b) >= n && string(b[:n]) == pattern +} + +func scanFollowsMultilineBasicStringDelimiter(b []byte) bool { + return scanFollows(b, `"""`) +} + +func scanFollowsMultilineLiteralStringDelimiter(b []byte) bool { + return scanFollows(b, `'''`) +} + +func scanFollowsTrue(b []byte) bool { + return scanFollows(b, `true`) +} + +func scanFollowsFalse(b []byte) bool { + return scanFollows(b, `false`) +} + +func scanFollowsInf(b []byte) bool { + return scanFollows(b, `inf`) +} + +func scanFollowsNan(b []byte) bool { + return scanFollows(b, `nan`) +} + +func scanUnquotedKey(b []byte) ([]byte, []byte) { + // unquoted-key = 1*( ALPHA / DIGIT / %x2D / %x5F ) ; A-Z / a-z / 0-9 / - / _ + for i := 0; i < len(b); i++ { + if !isUnquotedKeyChar(b[i]) { + return b[:i], b[i:] + } + } + + return b, b[len(b):] +} + +func isUnquotedKeyChar(r byte) bool { + return (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '-' || r == '_' +} + +func scanLiteralString(b []byte) ([]byte, []byte, error) { + // literal-string = apostrophe *literal-char apostrophe + // apostrophe = %x27 ; ' apostrophe + // literal-char = %x09 / %x20-26 / %x28-7E / non-ascii + for i := 1; i < len(b); i++ { + switch b[i] { + case '\'': + return b[:i+1], b[i+1:], nil + case '\n': + return nil, nil, newDecodeError(b[i:i+1], "literal strings cannot have new lines") + } + } + + return nil, nil, newDecodeError(b[len(b):], "unterminated literal string") +} + +func scanMultilineLiteralString(b []byte) ([]byte, []byte, error) { + // ml-literal-string = ml-literal-string-delim [ newline ] ml-literal-body + // ml-literal-string-delim + // ml-literal-string-delim = 3apostrophe + // ml-literal-body = *mll-content *( mll-quotes 1*mll-content ) [ mll-quotes ] + // + // mll-content = mll-char / newline + // mll-char = %x09 / %x20-26 / %x28-7E / non-ascii + // mll-quotes = 1*2apostrophe + for i := 3; i < len(b); i++ { + if b[i] == '\'' && scanFollowsMultilineLiteralStringDelimiter(b[i:]) { + return b[:i+3], b[i+3:], nil + } + } + + return nil, nil, newDecodeError(b[len(b):], `multiline literal string not terminated by '''`) +} + +func scanWindowsNewline(b []byte) ([]byte, []byte, error) { + const lenCRLF = 2 + if len(b) < lenCRLF { + return nil, nil, newDecodeError(b, "windows new line expected") + } + + if b[1] != '\n' { + return nil, nil, newDecodeError(b, `windows new line should be \r\n`) + } + + return b[:lenCRLF], b[lenCRLF:], nil +} + +func scanWhitespace(b []byte) ([]byte, []byte) { + for i := 0; i < len(b); i++ { + switch b[i] { + case ' ', '\t': + continue + default: + return b[:i], b[i:] + } + } + + return b, b[len(b):] +} + +//nolint:unparam +func scanComment(b []byte) ([]byte, []byte) { + // comment-start-symbol = %x23 ; # + // non-ascii = %x80-D7FF / %xE000-10FFFF + // non-eol = %x09 / %x20-7F / non-ascii + // + // comment = comment-start-symbol *non-eol + for i := 1; i < len(b); i++ { + if b[i] == '\n' { + return b[:i], b[i:] + } + } + + return b, nil +} + +func scanBasicString(b []byte) ([]byte, []byte, error) { + // basic-string = quotation-mark *basic-char quotation-mark + // quotation-mark = %x22 ; " + // basic-char = basic-unescaped / escaped + // basic-unescaped = wschar / %x21 / %x23-5B / %x5D-7E / non-ascii + // escaped = escape escape-seq-char + for i := 1; i < len(b); i++ { + switch b[i] { + case '"': + return b[:i+1], b[i+1:], nil + case '\n': + return nil, nil, newDecodeError(b[i:i+1], "basic strings cannot have new lines") + case '\\': + if len(b) < i+2 { + return nil, nil, newDecodeError(b[i:i+1], "need a character after \\") + } + i++ // skip the next character + } + } + + return nil, nil, newDecodeError(b[len(b):], `basic string not terminated by "`) +} + +func scanMultilineBasicString(b []byte) ([]byte, []byte, error) { + // ml-basic-string = ml-basic-string-delim [ newline ] ml-basic-body + // ml-basic-string-delim + // ml-basic-string-delim = 3quotation-mark + // ml-basic-body = *mlb-content *( mlb-quotes 1*mlb-content ) [ mlb-quotes ] + // + // mlb-content = mlb-char / newline / mlb-escaped-nl + // mlb-char = mlb-unescaped / escaped + // mlb-quotes = 1*2quotation-mark + // mlb-unescaped = wschar / %x21 / %x23-5B / %x5D-7E / non-ascii + // mlb-escaped-nl = escape ws newline *( wschar / newline ) + for i := 3; i < len(b); i++ { + switch b[i] { + case '"': + if scanFollowsMultilineBasicStringDelimiter(b[i:]) { + return b[:i+3], b[i+3:], nil + } + case '\\': + if len(b) < i+2 { + return nil, nil, newDecodeError(b[len(b):], "need a character after \\") + } + i++ // skip the next character + } + } + + return nil, nil, newDecodeError(b[len(b):], `multiline basic string not terminated by """`) +} diff --git a/vendor/github.com/pelletier/go-toml/v2/strict.go b/vendor/github.com/pelletier/go-toml/v2/strict.go new file mode 100644 index 000000000..2b2e7d652 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/strict.go @@ -0,0 +1,88 @@ +package toml + +import ( + "github.com/pelletier/go-toml/v2/internal/ast" + "github.com/pelletier/go-toml/v2/internal/tracker" +) + +type strict struct { + Enabled bool + + // Tracks the current key being processed. + key tracker.KeyTracker + + missing []decodeError +} + +func (s *strict) EnterTable(node ast.Node) { + if !s.Enabled { + return + } + + s.key.UpdateTable(node) +} + +func (s *strict) EnterArrayTable(node ast.Node) { + if !s.Enabled { + return + } + + s.key.UpdateArrayTable(node) +} + +func (s *strict) EnterKeyValue(node ast.Node) { + if !s.Enabled { + return + } + + s.key.Push(node) +} + +func (s *strict) ExitKeyValue(node ast.Node) { + if !s.Enabled { + return + } + + s.key.Pop(node) +} + +func (s *strict) MissingTable(node ast.Node) { + if !s.Enabled { + return + } + + s.missing = append(s.missing, decodeError{ + highlight: keyLocation(node), + message: "missing table", + key: s.key.Key(), + }) +} + +func (s *strict) MissingField(node ast.Node) { + if !s.Enabled { + return + } + + s.missing = append(s.missing, decodeError{ + highlight: keyLocation(node), + message: "missing field", + key: s.key.Key(), + }) +} + +func (s *strict) Error(doc []byte) error { + if !s.Enabled || len(s.missing) == 0 { + return nil + } + + err := &StrictMissingError{ + Errors: make([]DecodeError, 0, len(s.missing)), + } + + for _, derr := range s.missing { + derr := derr + err.Errors = append(err.Errors, *wrapDecodeError(doc, &derr)) + } + + return err +} diff --git a/vendor/github.com/pelletier/go-toml/v2/targets.go b/vendor/github.com/pelletier/go-toml/v2/targets.go new file mode 100644 index 000000000..370892f0d --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/targets.go @@ -0,0 +1,536 @@ +package toml + +import ( + "fmt" + "math" + "reflect" + "strings" + "sync" +) + +type target interface { + // Dereferences the target. + get() reflect.Value + + // Store a string at the target. + setString(v string) + + // Store a boolean at the target + setBool(v bool) + + // Store an int64 at the target + setInt64(v int64) + + // Store a float64 at the target + setFloat64(v float64) + + // Stores any value at the target + set(v reflect.Value) +} + +// valueTarget just contains a reflect.Value that can be set. +// It is used for struct fields. +type valueTarget reflect.Value + +func (t valueTarget) get() reflect.Value { + return reflect.Value(t) +} + +func (t valueTarget) set(v reflect.Value) { + reflect.Value(t).Set(v) +} + +func (t valueTarget) setString(v string) { + t.get().SetString(v) +} + +func (t valueTarget) setBool(v bool) { + t.get().SetBool(v) +} + +func (t valueTarget) setInt64(v int64) { + t.get().SetInt(v) +} + +func (t valueTarget) setFloat64(v float64) { + t.get().SetFloat(v) +} + +// interfaceTarget wraps an other target to dereference on get. +type interfaceTarget struct { + x target +} + +func (t interfaceTarget) get() reflect.Value { + return t.x.get().Elem() +} + +func (t interfaceTarget) set(v reflect.Value) { + t.x.set(v) +} + +func (t interfaceTarget) setString(v string) { + panic("interface targets should always go through set") +} + +func (t interfaceTarget) setBool(v bool) { + panic("interface targets should always go through set") +} + +func (t interfaceTarget) setInt64(v int64) { + panic("interface targets should always go through set") +} + +func (t interfaceTarget) setFloat64(v float64) { + panic("interface targets should always go through set") +} + +// mapTarget targets a specific key of a map. +type mapTarget struct { + v reflect.Value + k reflect.Value +} + +func (t mapTarget) get() reflect.Value { + return t.v.MapIndex(t.k) +} + +func (t mapTarget) set(v reflect.Value) { + t.v.SetMapIndex(t.k, v) +} + +func (t mapTarget) setString(v string) { + t.set(reflect.ValueOf(v)) +} + +func (t mapTarget) setBool(v bool) { + t.set(reflect.ValueOf(v)) +} + +func (t mapTarget) setInt64(v int64) { + t.set(reflect.ValueOf(v)) +} + +func (t mapTarget) setFloat64(v float64) { + t.set(reflect.ValueOf(v)) +} + +// makes sure that the value pointed at by t is indexable (Slice, Array), or +// dereferences to an indexable (Ptr, Interface). +func ensureValueIndexable(t target) error { + f := t.get() + + switch f.Type().Kind() { + case reflect.Slice: + if f.IsNil() { + t.set(reflect.MakeSlice(f.Type(), 0, 0)) + return nil + } + case reflect.Interface: + if f.IsNil() || f.Elem().Type() != sliceInterfaceType { + t.set(reflect.MakeSlice(sliceInterfaceType, 0, 0)) + return nil + } + case reflect.Ptr: + panic("pointer should have already been dereferenced") + case reflect.Array: + // arrays are always initialized. + default: + return fmt.Errorf("toml: cannot store array in a %s", f.Kind()) + } + + return nil +} + +var ( + sliceInterfaceType = reflect.TypeOf([]interface{}{}) + mapStringInterfaceType = reflect.TypeOf(map[string]interface{}{}) +) + +func ensureMapIfInterface(x target) { + v := x.get() + + if v.Kind() == reflect.Interface && v.IsNil() { + newElement := reflect.MakeMap(mapStringInterfaceType) + + x.set(newElement) + } +} + +func setString(t target, v string) error { + f := t.get() + + switch f.Kind() { + case reflect.String: + t.setString(v) + case reflect.Interface: + t.set(reflect.ValueOf(v)) + default: + return fmt.Errorf("toml: cannot assign string to a %s", f.Kind()) + } + + return nil +} + +func setBool(t target, v bool) error { + f := t.get() + + switch f.Kind() { + case reflect.Bool: + t.setBool(v) + case reflect.Interface: + t.set(reflect.ValueOf(v)) + default: + return fmt.Errorf("toml: cannot assign boolean to a %s", f.Kind()) + } + + return nil +} + +const ( + maxInt = int64(^uint(0) >> 1) + minInt = -maxInt - 1 +) + +//nolint:funlen,gocognit,cyclop +func setInt64(t target, v int64) error { + f := t.get() + + switch f.Kind() { + case reflect.Int64: + t.setInt64(v) + case reflect.Int32: + if v < math.MinInt32 || v > math.MaxInt32 { + return fmt.Errorf("toml: number %d does not fit in an int32", v) + } + + t.set(reflect.ValueOf(int32(v))) + return nil + case reflect.Int16: + if v < math.MinInt16 || v > math.MaxInt16 { + return fmt.Errorf("toml: number %d does not fit in an int16", v) + } + + t.set(reflect.ValueOf(int16(v))) + case reflect.Int8: + if v < math.MinInt8 || v > math.MaxInt8 { + return fmt.Errorf("toml: number %d does not fit in an int8", v) + } + + t.set(reflect.ValueOf(int8(v))) + case reflect.Int: + if v < minInt || v > maxInt { + return fmt.Errorf("toml: number %d does not fit in an int", v) + } + + t.set(reflect.ValueOf(int(v))) + case reflect.Uint64: + if v < 0 { + return fmt.Errorf("toml: negative number %d does not fit in an uint64", v) + } + + t.set(reflect.ValueOf(uint64(v))) + case reflect.Uint32: + if v < 0 || v > math.MaxUint32 { + return fmt.Errorf("toml: negative number %d does not fit in an uint32", v) + } + + t.set(reflect.ValueOf(uint32(v))) + case reflect.Uint16: + if v < 0 || v > math.MaxUint16 { + return fmt.Errorf("toml: negative number %d does not fit in an uint16", v) + } + + t.set(reflect.ValueOf(uint16(v))) + case reflect.Uint8: + if v < 0 || v > math.MaxUint8 { + return fmt.Errorf("toml: negative number %d does not fit in an uint8", v) + } + + t.set(reflect.ValueOf(uint8(v))) + case reflect.Uint: + if v < 0 { + return fmt.Errorf("toml: negative number %d does not fit in an uint", v) + } + + t.set(reflect.ValueOf(uint(v))) + case reflect.Interface: + t.set(reflect.ValueOf(v)) + default: + return fmt.Errorf("toml: integer cannot be assigned to %s", f.Kind()) + } + + return nil +} + +func setFloat64(t target, v float64) error { + f := t.get() + + switch f.Kind() { + case reflect.Float64: + t.setFloat64(v) + case reflect.Float32: + if v > math.MaxFloat32 { + return fmt.Errorf("toml: number %f does not fit in a float32", v) + } + + t.set(reflect.ValueOf(float32(v))) + case reflect.Interface: + t.set(reflect.ValueOf(v)) + default: + return fmt.Errorf("toml: float cannot be assigned to %s", f.Kind()) + } + + return nil +} + +// Returns the element at idx of the value pointed at by target, or an error if +// t does not point to an indexable. +// If the target points to an Array and idx is out of bounds, it returns +// (nil, nil) as this is not a fatal error (the unmarshaler will skip). +func elementAt(t target, idx int) target { + f := t.get() + + switch f.Kind() { + case reflect.Slice: + //nolint:godox + // TODO: use the idx function argument and avoid alloc if possible. + idx := f.Len() + + t.set(reflect.Append(f, reflect.New(f.Type().Elem()).Elem())) + + return valueTarget(t.get().Index(idx)) + case reflect.Array: + if idx >= f.Len() { + return nil + } + + return valueTarget(f.Index(idx)) + case reflect.Interface: + // This function is called after ensureValueIndexable, so it's + // guaranteed that f contains an initialized slice. + ifaceElem := f.Elem() + idx := ifaceElem.Len() + newElem := reflect.New(ifaceElem.Type().Elem()).Elem() + newSlice := reflect.Append(ifaceElem, newElem) + + t.set(newSlice) + + return valueTarget(t.get().Elem().Index(idx)) + default: + // Why ensureValueIndexable let it go through? + panic(fmt.Errorf("elementAt received unhandled value type: %s", f.Kind())) + } +} + +func (d *decoder) scopeTableTarget(shouldAppend bool, t target, name string) (target, bool, error) { + x := t.get() + + switch x.Kind() { + // Kinds that need to recurse + case reflect.Interface: + t := scopeInterface(shouldAppend, t) + return d.scopeTableTarget(shouldAppend, t, name) + case reflect.Ptr: + t := scopePtr(t) + return d.scopeTableTarget(shouldAppend, t, name) + case reflect.Slice: + t := scopeSlice(shouldAppend, t) + shouldAppend = false + return d.scopeTableTarget(shouldAppend, t, name) + case reflect.Array: + t, err := d.scopeArray(shouldAppend, t) + if err != nil { + return t, false, err + } + shouldAppend = false + + return d.scopeTableTarget(shouldAppend, t, name) + + // Terminal kinds + case reflect.Struct: + return scopeStruct(x, name) + case reflect.Map: + if x.IsNil() { + t.set(reflect.MakeMap(x.Type())) + x = t.get() + } + + return scopeMap(x, name) + default: + panic(fmt.Sprintf("can't scope on a %s", x.Kind())) + } +} + +func scopeInterface(shouldAppend bool, t target) target { + initInterface(shouldAppend, t) + return interfaceTarget{t} +} + +func scopePtr(t target) target { + initPtr(t) + return valueTarget(t.get().Elem()) +} + +func initPtr(t target) { + x := t.get() + if !x.IsNil() { + return + } + + t.set(reflect.New(x.Type().Elem())) +} + +// initInterface makes sure that the interface pointed at by the target is not +// nil. +// Returns the target to the initialized value of the target. +func initInterface(shouldAppend bool, t target) { + x := t.get() + + if x.Kind() != reflect.Interface { + panic("this should only be called on interfaces") + } + + if !x.IsNil() && (x.Elem().Type() == sliceInterfaceType || x.Elem().Type() == mapStringInterfaceType) { + return + } + + var newElement reflect.Value + if shouldAppend { + newElement = reflect.MakeSlice(sliceInterfaceType, 0, 0) + } else { + newElement = reflect.MakeMap(mapStringInterfaceType) + } + + t.set(newElement) +} + +func scopeSlice(shouldAppend bool, t target) target { + v := t.get() + + if shouldAppend { + newElem := reflect.New(v.Type().Elem()) + newSlice := reflect.Append(v, newElem.Elem()) + + t.set(newSlice) + + v = t.get() + } + + return valueTarget(v.Index(v.Len() - 1)) +} + +func (d *decoder) scopeArray(shouldAppend bool, t target) (target, error) { + v := t.get() + + idx := d.arrayIndex(shouldAppend, v) + + if idx >= v.Len() { + return nil, fmt.Errorf("toml: impossible to insert element beyond array's size: %d", v.Len()) + } + + return valueTarget(v.Index(idx)), nil +} + +func scopeMap(v reflect.Value, name string) (target, bool, error) { + k := reflect.ValueOf(name) + + keyType := v.Type().Key() + if !k.Type().AssignableTo(keyType) { + if !k.Type().ConvertibleTo(keyType) { + return nil, false, fmt.Errorf("toml: cannot convert map key of type %s to expected type %s", k.Type(), keyType) + } + + k = k.Convert(keyType) + } + + if !v.MapIndex(k).IsValid() { + newElem := reflect.New(v.Type().Elem()) + v.SetMapIndex(k, newElem.Elem()) + } + + return mapTarget{ + v: v, + k: k, + }, true, nil +} + +type fieldPathsMap = map[string][]int + +type fieldPathsCache struct { + m map[reflect.Type]fieldPathsMap + l sync.RWMutex +} + +func (c *fieldPathsCache) get(t reflect.Type) (fieldPathsMap, bool) { + c.l.RLock() + paths, ok := c.m[t] + c.l.RUnlock() + + return paths, ok +} + +func (c *fieldPathsCache) set(t reflect.Type, m fieldPathsMap) { + c.l.Lock() + c.m[t] = m + c.l.Unlock() +} + +var globalFieldPathsCache = fieldPathsCache{ + m: map[reflect.Type]fieldPathsMap{}, + l: sync.RWMutex{}, +} + +func scopeStruct(v reflect.Value, name string) (target, bool, error) { + //nolint:godox + // TODO: cache this, and reduce allocations + fieldPaths, ok := globalFieldPathsCache.get(v.Type()) + if !ok { + fieldPaths = map[string][]int{} + + path := make([]int, 0, 16) + + var walk func(reflect.Value) + walk = func(v reflect.Value) { + t := v.Type() + for i := 0; i < t.NumField(); i++ { + l := len(path) + path = append(path, i) + f := t.Field(i) + + if f.Anonymous { + walk(v.Field(i)) + } else if f.PkgPath == "" { + // only consider exported fields + fieldName, ok := f.Tag.Lookup("toml") + if !ok { + fieldName = f.Name + } + + pathCopy := make([]int, len(path)) + copy(pathCopy, path) + + fieldPaths[fieldName] = pathCopy + // extra copy for the case-insensitive match + fieldPaths[strings.ToLower(fieldName)] = pathCopy + } + path = path[:l] + } + } + + walk(v) + + globalFieldPathsCache.set(v.Type(), fieldPaths) + } + + path, ok := fieldPaths[name] + if !ok { + path, ok = fieldPaths[strings.ToLower(name)] + } + + if !ok { + return nil, false, nil + } + + return valueTarget(v.FieldByIndex(path)), true, nil +} diff --git a/vendor/github.com/pelletier/go-toml/v2/toml.abnf b/vendor/github.com/pelletier/go-toml/v2/toml.abnf new file mode 100644 index 000000000..473f3749e --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/toml.abnf @@ -0,0 +1,243 @@ +;; This document describes TOML's syntax, using the ABNF format (defined in +;; RFC 5234 -- https://www.ietf.org/rfc/rfc5234.txt). +;; +;; All valid TOML documents will match this description, however certain +;; invalid documents would need to be rejected as per the semantics described +;; in the supporting text description. + +;; It is possible to try this grammar interactively, using instaparse. +;; http://instaparse.mojombo.com/ +;; +;; To do so, in the lower right, click on Options and change `:input-format` to +;; ':abnf'. Then paste this entire ABNF document into the grammar entry box +;; (above the options). Then you can type or paste a sample TOML document into +;; the beige box on the left. Tada! + +;; Overall Structure + +toml = expression *( newline expression ) + +expression = ws [ comment ] +expression =/ ws keyval ws [ comment ] +expression =/ ws table ws [ comment ] + +;; Whitespace + +ws = *wschar +wschar = %x20 ; Space +wschar =/ %x09 ; Horizontal tab + +;; Newline + +newline = %x0A ; LF +newline =/ %x0D.0A ; CRLF + +;; Comment + +comment-start-symbol = %x23 ; # +non-ascii = %x80-D7FF / %xE000-10FFFF +non-eol = %x09 / %x20-7F / non-ascii + +comment = comment-start-symbol *non-eol + +;; Key-Value pairs + +keyval = key keyval-sep val + +key = simple-key / dotted-key +simple-key = quoted-key / unquoted-key + +unquoted-key = 1*( ALPHA / DIGIT / %x2D / %x5F ) ; A-Z / a-z / 0-9 / - / _ +quoted-key = basic-string / literal-string +dotted-key = simple-key 1*( dot-sep simple-key ) + +dot-sep = ws %x2E ws ; . Period +keyval-sep = ws %x3D ws ; = + +val = string / boolean / array / inline-table / date-time / float / integer + +;; String + +string = ml-basic-string / basic-string / ml-literal-string / literal-string + +;; Basic String + +basic-string = quotation-mark *basic-char quotation-mark + +quotation-mark = %x22 ; " + +basic-char = basic-unescaped / escaped +basic-unescaped = wschar / %x21 / %x23-5B / %x5D-7E / non-ascii +escaped = escape escape-seq-char + +escape = %x5C ; \ +escape-seq-char = %x22 ; " quotation mark U+0022 +escape-seq-char =/ %x5C ; \ reverse solidus U+005C +escape-seq-char =/ %x62 ; b backspace U+0008 +escape-seq-char =/ %x66 ; f form feed U+000C +escape-seq-char =/ %x6E ; n line feed U+000A +escape-seq-char =/ %x72 ; r carriage return U+000D +escape-seq-char =/ %x74 ; t tab U+0009 +escape-seq-char =/ %x75 4HEXDIG ; uXXXX U+XXXX +escape-seq-char =/ %x55 8HEXDIG ; UXXXXXXXX U+XXXXXXXX + +;; Multiline Basic String + +ml-basic-string = ml-basic-string-delim [ newline ] ml-basic-body + ml-basic-string-delim +ml-basic-string-delim = 3quotation-mark +ml-basic-body = *mlb-content *( mlb-quotes 1*mlb-content ) [ mlb-quotes ] + +mlb-content = mlb-char / newline / mlb-escaped-nl +mlb-char = mlb-unescaped / escaped +mlb-quotes = 1*2quotation-mark +mlb-unescaped = wschar / %x21 / %x23-5B / %x5D-7E / non-ascii +mlb-escaped-nl = escape ws newline *( wschar / newline ) + +;; Literal String + +literal-string = apostrophe *literal-char apostrophe + +apostrophe = %x27 ; ' apostrophe + +literal-char = %x09 / %x20-26 / %x28-7E / non-ascii + +;; Multiline Literal String + +ml-literal-string = ml-literal-string-delim [ newline ] ml-literal-body + ml-literal-string-delim +ml-literal-string-delim = 3apostrophe +ml-literal-body = *mll-content *( mll-quotes 1*mll-content ) [ mll-quotes ] + +mll-content = mll-char / newline +mll-char = %x09 / %x20-26 / %x28-7E / non-ascii +mll-quotes = 1*2apostrophe + +;; Integer + +integer = dec-int / hex-int / oct-int / bin-int + +minus = %x2D ; - +plus = %x2B ; + +underscore = %x5F ; _ +digit1-9 = %x31-39 ; 1-9 +digit0-7 = %x30-37 ; 0-7 +digit0-1 = %x30-31 ; 0-1 + +hex-prefix = %x30.78 ; 0x +oct-prefix = %x30.6F ; 0o +bin-prefix = %x30.62 ; 0b + +dec-int = [ minus / plus ] unsigned-dec-int +unsigned-dec-int = DIGIT / digit1-9 1*( DIGIT / underscore DIGIT ) + +hex-int = hex-prefix HEXDIG *( HEXDIG / underscore HEXDIG ) +oct-int = oct-prefix digit0-7 *( digit0-7 / underscore digit0-7 ) +bin-int = bin-prefix digit0-1 *( digit0-1 / underscore digit0-1 ) + +;; Float + +float = float-int-part ( exp / frac [ exp ] ) +float =/ special-float + +float-int-part = dec-int +frac = decimal-point zero-prefixable-int +decimal-point = %x2E ; . +zero-prefixable-int = DIGIT *( DIGIT / underscore DIGIT ) + +exp = "e" float-exp-part +float-exp-part = [ minus / plus ] zero-prefixable-int + +special-float = [ minus / plus ] ( inf / nan ) +inf = %x69.6e.66 ; inf +nan = %x6e.61.6e ; nan + +;; Boolean + +boolean = true / false + +true = %x74.72.75.65 ; true +false = %x66.61.6C.73.65 ; false + +;; Date and Time (as defined in RFC 3339) + +date-time = offset-date-time / local-date-time / local-date / local-time + +date-fullyear = 4DIGIT +date-month = 2DIGIT ; 01-12 +date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year +time-delim = "T" / %x20 ; T, t, or space +time-hour = 2DIGIT ; 00-23 +time-minute = 2DIGIT ; 00-59 +time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules +time-secfrac = "." 1*DIGIT +time-numoffset = ( "+" / "-" ) time-hour ":" time-minute +time-offset = "Z" / time-numoffset + +partial-time = time-hour ":" time-minute ":" time-second [ time-secfrac ] +full-date = date-fullyear "-" date-month "-" date-mday +full-time = partial-time time-offset + +;; Offset Date-Time + +offset-date-time = full-date time-delim full-time + +;; Local Date-Time + +local-date-time = full-date time-delim partial-time + +;; Local Date + +local-date = full-date + +;; Local Time + +local-time = partial-time + +;; Array + +array = array-open [ array-values ] ws-comment-newline array-close + +array-open = %x5B ; [ +array-close = %x5D ; ] + +array-values = ws-comment-newline val ws-comment-newline array-sep array-values +array-values =/ ws-comment-newline val ws-comment-newline [ array-sep ] + +array-sep = %x2C ; , Comma + +ws-comment-newline = *( wschar / [ comment ] newline ) + +;; Table + +table = std-table / array-table + +;; Standard Table + +std-table = std-table-open key std-table-close + +std-table-open = %x5B ws ; [ Left square bracket +std-table-close = ws %x5D ; ] Right square bracket + +;; Inline Table + +inline-table = inline-table-open [ inline-table-keyvals ] inline-table-close + +inline-table-open = %x7B ws ; { +inline-table-close = ws %x7D ; } +inline-table-sep = ws %x2C ws ; , Comma + +inline-table-keyvals = keyval [ inline-table-sep inline-table-keyvals ] + +;; Array Table + +array-table = array-table-open key array-table-close + +array-table-open = %x5B.5B ws ; [[ Double left square bracket +array-table-close = ws %x5D.5D ; ]] Double right square bracket + +;; Built-in ABNF terms, reproduced here for clarity + +ALPHA = %x41-5A / %x61-7A ; A-Z / a-z +DIGIT = %x30-39 ; 0-9 +HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F" diff --git a/vendor/github.com/pelletier/go-toml/v2/unmarshaler.go b/vendor/github.com/pelletier/go-toml/v2/unmarshaler.go new file mode 100644 index 000000000..6a156ae6a --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/v2/unmarshaler.go @@ -0,0 +1,593 @@ +package toml + +import ( + "encoding" + "errors" + "fmt" + "io" + "io/ioutil" + "reflect" + "time" + + "github.com/pelletier/go-toml/v2/internal/ast" + "github.com/pelletier/go-toml/v2/internal/tracker" + "github.com/pelletier/go-toml/v2/internal/unsafe" +) + +// Unmarshal deserializes a TOML document into a Go value. +// +// It is a shortcut for Decoder.Decode() with the default options. +func Unmarshal(data []byte, v interface{}) error { + p := parser{} + p.Reset(data) + d := decoder{} + + return d.FromParser(&p, v) +} + +// Decoder reads and decode a TOML document from an input stream. +type Decoder struct { + // input + r io.Reader + + // global settings + strict bool +} + +// NewDecoder creates a new Decoder that will read from r. +func NewDecoder(r io.Reader) *Decoder { + return &Decoder{r: r} +} + +// SetStrict toggles decoding in stict mode. +// +// When the decoder is in strict mode, it will record fields from the document +// that could not be set on the target value. In that case, the decoder returns +// a StrictMissingError that can be used to retrieve the individual errors as +// well as generate a human readable description of the missing fields. +func (d *Decoder) SetStrict(strict bool) { + d.strict = strict +} + +// Decode the whole content of r into v. +// +// By default, values in the document that don't exist in the target Go value +// are ignored. See Decoder.SetStrict() to change this behavior. +// +// When a TOML local date, time, or date-time is decoded into a time.Time, its +// value is represented in time.Local timezone. Otherwise the approriate Local* +// structure is used. +// +// Empty tables decoded in an interface{} create an empty initialized +// map[string]interface{}. +// +// Types implementing the encoding.TextUnmarshaler interface are decoded from a +// TOML string. +// +// When decoding a number, go-toml will return an error if the number is out of +// bounds for the target type (which includes negative numbers when decoding +// into an unsigned int). +// +// Type mapping +// +// List of supported TOML types and their associated accepted Go types: +// +// String -> string +// Integer -> uint*, int*, depending on size +// Float -> float*, depending on size +// Boolean -> bool +// Offset Date-Time -> time.Time +// Local Date-time -> LocalDateTime, time.Time +// Local Date -> LocalDate, time.Time +// Local Time -> LocalTime, time.Time +// Array -> slice and array, depending on elements types +// Table -> map and struct +// Inline Table -> same as Table +// Array of Tables -> same as Array and Table +func (d *Decoder) Decode(v interface{}) error { + b, err := ioutil.ReadAll(d.r) + if err != nil { + return fmt.Errorf("toml: %w", err) + } + + p := parser{} + p.Reset(b) + dec := decoder{ + strict: strict{ + Enabled: d.strict, + }, + } + + return dec.FromParser(&p, v) +} + +type decoder struct { + // Tracks position in Go arrays. + arrayIndexes map[reflect.Value]int + + // Tracks keys that have been seen, with which type. + seen tracker.SeenTracker + + // Strict mode + strict strict +} + +func (d *decoder) arrayIndex(shouldAppend bool, v reflect.Value) int { + if d.arrayIndexes == nil { + d.arrayIndexes = make(map[reflect.Value]int, 1) + } + + idx, ok := d.arrayIndexes[v] + + if !ok { + d.arrayIndexes[v] = 0 + } else if shouldAppend { + idx++ + d.arrayIndexes[v] = idx + } + + return idx +} + +func (d *decoder) FromParser(p *parser, v interface{}) error { + err := d.fromParser(p, v) + if err == nil { + return d.strict.Error(p.data) + } + + var e *decodeError + if errors.As(err, &e) { + return wrapDecodeError(p.data, e) + } + + return err +} + +func keyLocation(node ast.Node) []byte { + k := node.Key() + + hasOne := k.Next() + if !hasOne { + panic("should not be called with empty key") + } + + start := k.Node().Data + end := k.Node().Data + + for k.Next() { + end = k.Node().Data + } + + return unsafe.BytesRange(start, end) +} + +//nolint:funlen,cyclop +func (d *decoder) fromParser(p *parser, v interface{}) error { + r := reflect.ValueOf(v) + if r.Kind() != reflect.Ptr { + return fmt.Errorf("toml: decoding can only be performed into a pointer, not %s", r.Kind()) + } + + if r.IsNil() { + return fmt.Errorf("toml: decoding pointer target cannot be nil") + } + + var ( + skipUntilTable bool + root target = valueTarget(r.Elem()) + ) + + current := root + + for p.NextExpression() { + node := p.Expression() + + if node.Kind == ast.KeyValue && skipUntilTable { + continue + } + + err := d.seen.CheckExpression(node) + if err != nil { + return err + } + + var found bool + + switch node.Kind { + case ast.KeyValue: + err = d.unmarshalKeyValue(current, node) + found = true + case ast.Table: + d.strict.EnterTable(node) + + current, found, err = d.scopeWithKey(root, node.Key()) + if err == nil && found { + // In case this table points to an interface, + // make sure it at least holds something that + // looks like a table. Otherwise the information + // of a table is lost, and marshal cannot do the + // round trip. + ensureMapIfInterface(current) + } + case ast.ArrayTable: + d.strict.EnterArrayTable(node) + current, found, err = d.scopeWithArrayTable(root, node.Key()) + default: + panic(fmt.Sprintf("this should not be a top level node type: %s", node.Kind)) + } + + if err != nil { + return err + } + + if !found { + skipUntilTable = true + + d.strict.MissingTable(node) + } + } + + return p.Error() +} + +// scopeWithKey performs target scoping when unmarshaling an ast.KeyValue node. +// +// The goal is to hop from target to target recursively using the names in key. +// Parts of the key should be used to resolve field names for structs, and as +// keys when targeting maps. +// +// When encountering slices, it should always use its last element, and error +// if the slice does not have any. +func (d *decoder) scopeWithKey(x target, key ast.Iterator) (target, bool, error) { + var ( + err error + found bool + ) + + for key.Next() { + n := key.Node() + + x, found, err = d.scopeTableTarget(false, x, string(n.Data)) + if err != nil || !found { + return nil, found, err + } + } + + return x, true, nil +} + +//nolint:cyclop +// scopeWithArrayTable performs target scoping when unmarshaling an +// ast.ArrayTable node. +// +// It is the same as scopeWithKey, but when scoping the last part of the key +// it creates a new element in the array instead of using the last one. +func (d *decoder) scopeWithArrayTable(x target, key ast.Iterator) (target, bool, error) { + var ( + err error + found bool + ) + + for key.Next() { + n := key.Node() + if !n.Next().Valid() { // want to stop at one before last + break + } + + x, found, err = d.scopeTableTarget(false, x, string(n.Data)) + if err != nil || !found { + return nil, found, err + } + } + + n := key.Node() + + x, found, err = d.scopeTableTarget(false, x, string(n.Data)) + if err != nil || !found { + return x, found, err + } + + v := x.get() + + if v.Kind() == reflect.Ptr { + x = scopePtr(x) + v = x.get() + } + + if v.Kind() == reflect.Interface { + x = scopeInterface(true, x) + v = x.get() + } + + switch v.Kind() { + case reflect.Slice: + x = scopeSlice(true, x) + case reflect.Array: + x, err = d.scopeArray(true, x) + default: + } + + return x, found, err +} + +func (d *decoder) unmarshalKeyValue(x target, node ast.Node) error { + assertNode(ast.KeyValue, node) + + d.strict.EnterKeyValue(node) + defer d.strict.ExitKeyValue(node) + + x, found, err := d.scopeWithKey(x, node.Key()) + if err != nil { + return err + } + + // A struct in the path was not found. Skip this value. + if !found { + d.strict.MissingField(node) + + return nil + } + + return d.unmarshalValue(x, node.Value()) +} + +var textUnmarshalerType = reflect.TypeOf(new(encoding.TextUnmarshaler)).Elem() + +func tryTextUnmarshaler(x target, node ast.Node) (bool, error) { + v := x.get() + + if v.Kind() != reflect.Struct { + return false, nil + } + + // Special case for time, because we allow to unmarshal to it from + // different kind of AST nodes. + if v.Type() == timeType { + return false, nil + } + + if v.Type().Implements(textUnmarshalerType) { + err := v.Interface().(encoding.TextUnmarshaler).UnmarshalText(node.Data) + if err != nil { + return false, newDecodeError(node.Data, "error calling UnmarshalText: %w", err) + } + + return true, nil + } + + if v.CanAddr() && v.Addr().Type().Implements(textUnmarshalerType) { + err := v.Addr().Interface().(encoding.TextUnmarshaler).UnmarshalText(node.Data) + if err != nil { + return false, newDecodeError(node.Data, "error calling UnmarshalText: %w", err) + } + + return true, nil + } + + return false, nil +} + +//nolint:cyclop +func (d *decoder) unmarshalValue(x target, node ast.Node) error { + v := x.get() + + if v.Kind() == reflect.Ptr { + if !v.Elem().IsValid() { + x.set(reflect.New(v.Type().Elem())) + v = x.get() + } + + return d.unmarshalValue(valueTarget(v.Elem()), node) + } + + ok, err := tryTextUnmarshaler(x, node) + if ok { + return err + } + + switch node.Kind { + case ast.String: + return unmarshalString(x, node) + case ast.Bool: + return unmarshalBool(x, node) + case ast.Integer: + return unmarshalInteger(x, node) + case ast.Float: + return unmarshalFloat(x, node) + case ast.Array: + return d.unmarshalArray(x, node) + case ast.InlineTable: + return d.unmarshalInlineTable(x, node) + case ast.LocalDateTime: + return unmarshalLocalDateTime(x, node) + case ast.DateTime: + return unmarshalDateTime(x, node) + case ast.LocalDate: + return unmarshalLocalDate(x, node) + default: + panic(fmt.Sprintf("unhandled node kind %s", node.Kind)) + } +} + +func unmarshalLocalDate(x target, node ast.Node) error { + assertNode(ast.LocalDate, node) + + v, err := parseLocalDate(node.Data) + if err != nil { + return err + } + + setDate(x, v) + + return nil +} + +func unmarshalLocalDateTime(x target, node ast.Node) error { + assertNode(ast.LocalDateTime, node) + + v, rest, err := parseLocalDateTime(node.Data) + if err != nil { + return err + } + + if len(rest) > 0 { + return newDecodeError(rest, "extra characters at the end of a local date time") + } + + setLocalDateTime(x, v) + + return nil +} + +func unmarshalDateTime(x target, node ast.Node) error { + assertNode(ast.DateTime, node) + + v, err := parseDateTime(node.Data) + if err != nil { + return err + } + + setDateTime(x, v) + + return nil +} + +func setLocalDateTime(x target, v LocalDateTime) { + if x.get().Type() == timeType { + cast := v.In(time.Local) + + setDateTime(x, cast) + return + } + + x.set(reflect.ValueOf(v)) +} + +func setDateTime(x target, v time.Time) { + x.set(reflect.ValueOf(v)) +} + +var timeType = reflect.TypeOf(time.Time{}) + +func setDate(x target, v LocalDate) { + if x.get().Type() == timeType { + cast := v.In(time.Local) + + setDateTime(x, cast) + return + } + + x.set(reflect.ValueOf(v)) +} + +func unmarshalString(x target, node ast.Node) error { + assertNode(ast.String, node) + + return setString(x, string(node.Data)) +} + +func unmarshalBool(x target, node ast.Node) error { + assertNode(ast.Bool, node) + v := node.Data[0] == 't' + + return setBool(x, v) +} + +func unmarshalInteger(x target, node ast.Node) error { + assertNode(ast.Integer, node) + + v, err := parseInteger(node.Data) + if err != nil { + return err + } + + return setInt64(x, v) +} + +func unmarshalFloat(x target, node ast.Node) error { + assertNode(ast.Float, node) + + v, err := parseFloat(node.Data) + if err != nil { + return err + } + + return setFloat64(x, v) +} + +func (d *decoder) unmarshalInlineTable(x target, node ast.Node) error { + assertNode(ast.InlineTable, node) + + ensureMapIfInterface(x) + + it := node.Children() + for it.Next() { + n := it.Node() + + err := d.unmarshalKeyValue(x, n) + if err != nil { + return err + } + } + + return nil +} + +func (d *decoder) unmarshalArray(x target, node ast.Node) error { + assertNode(ast.Array, node) + + err := ensureValueIndexable(x) + if err != nil { + return err + } + + // Special work around when unmarshaling into an array. + // If the array is not addressable, for example when stored as a value in a + // map, calling elementAt in the inner function would fail. + // Instead, we allocate a new array that will be filled then inserted into + // the container. + // This problem does not exist with slices because they are addressable. + // There may be a better way of doing this, but it is not obvious to me + // with the target system. + if x.get().Kind() == reflect.Array { + container := x + newArrayPtr := reflect.New(x.get().Type()) + x = valueTarget(newArrayPtr.Elem()) + defer func() { + container.set(newArrayPtr.Elem()) + }() + } + + return d.unmarshalArrayInner(x, node) +} + +func (d *decoder) unmarshalArrayInner(x target, node ast.Node) error { + idx := 0 + + it := node.Children() + for it.Next() { + n := it.Node() + + v := elementAt(x, idx) + + if v == nil { + // when we go out of bound for an array just stop processing it to + // mimic encoding/json + break + } + + err := d.unmarshalValue(v, n) + if err != nil { + return err + } + + idx++ + } + return nil +} + +func assertNode(expected ast.Kind, node ast.Node) { + if node.Kind != expected { + panic(fmt.Sprintf("expected node of kind %s, not %s", expected, node.Kind)) + } +} diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go new file mode 100644 index 000000000..169de3922 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/doc.go @@ -0,0 +1,28 @@ +// Package require implements the same assertions as the `assert` package but +// stops test execution when a test fails. +// +// Example Usage +// +// The following is a complete example using require in a standard test function: +// import ( +// "testing" +// "github.com/stretchr/testify/require" +// ) +// +// func TestSomething(t *testing.T) { +// +// var a string = "Hello" +// var b string = "Hello" +// +// require.Equal(t, a, b, "The two words should be the same.") +// +// } +// +// Assertions +// +// The `require` package have same global functions as in the `assert` package, +// but instead of returning a boolean result they call `t.FailNow()`. +// +// Every assertion function also takes an optional string message as the final argument, +// allowing custom error messages to be appended to the message the assertion method outputs. +package require diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go new file mode 100644 index 000000000..1dcb2338c --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/forward_requirements.go @@ -0,0 +1,16 @@ +package require + +// Assertions provides assertion methods around the +// TestingT interface. +type Assertions struct { + t TestingT +} + +// New makes a new Assertions object for the specified TestingT. +func New(t TestingT) *Assertions { + return &Assertions{ + t: t, + } +} + +//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require_forward.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go new file mode 100644 index 000000000..51820df2e --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require.go @@ -0,0 +1,1879 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND + */ + +package require + +import ( + assert "github.com/stretchr/testify/assert" + http "net/http" + url "net/url" + time "time" +) + +// Condition uses a Comparison to assert a complex condition. +func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Condition(t, comp, msgAndArgs...) { + return + } + t.FailNow() +} + +// Conditionf uses a Comparison to assert a complex condition. +func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Conditionf(t, comp, msg, args...) { + return + } + t.FailNow() +} + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Contains(t, "Hello World", "World") +// assert.Contains(t, ["Hello", "World"], "World") +// assert.Contains(t, {"Hello": "World"}, "Hello") +func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Contains(t, s, contains, msgAndArgs...) { + return + } + t.FailNow() +} + +// Containsf asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted") +// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") +// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") +func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Containsf(t, s, contains, msg, args...) { + return + } + t.FailNow() +} + +// DirExists checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func DirExists(t TestingT, path string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.DirExists(t, path, msgAndArgs...) { + return + } + t.FailNow() +} + +// DirExistsf checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func DirExistsf(t TestingT, path string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.DirExistsf(t, path, msg, args...) { + return + } + t.FailNow() +} + +// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]) +func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ElementsMatch(t, listA, listB, msgAndArgs...) { + return + } + t.FailNow() +} + +// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") +func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ElementsMatchf(t, listA, listB, msg, args...) { + return + } + t.FailNow() +} + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Empty(t, obj) +func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Empty(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Emptyf(t, obj, "error message %s", "formatted") +func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Emptyf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// Equal asserts that two objects are equal. +// +// assert.Equal(t, 123, 123) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Equal(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// assert.EqualError(t, err, expectedErrorString) +func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.EqualError(t, theError, errString, msgAndArgs...) { + return + } + t.FailNow() +} + +// EqualErrorf asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") +func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.EqualErrorf(t, theError, errString, msg, args...) { + return + } + t.FailNow() +} + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValues(t, uint32(123), int32(123)) +func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.EqualValues(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// EqualValuesf asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") +func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.EqualValuesf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Equalf asserts that two objects are equal. +// +// assert.Equalf(t, 123, 123, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Equalf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err) { +// assert.Equal(t, expectedError, err) +// } +func Error(t TestingT, err error, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Error(t, err, msgAndArgs...) { + return + } + t.FailNow() +} + +// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorAs(t, err, target, msgAndArgs...) { + return + } + t.FailNow() +} + +// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorAsf(t, err, target, msg, args...) { + return + } + t.FailNow() +} + +// ErrorIs asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func ErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorIs(t, err, target, msgAndArgs...) { + return + } + t.FailNow() +} + +// ErrorIsf asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.ErrorIsf(t, err, target, msg, args...) { + return + } + t.FailNow() +} + +// Errorf asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Errorf(t, err, "error message %s", "formatted") { +// assert.Equal(t, expectedErrorf, err) +// } +func Errorf(t TestingT, err error, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Errorf(t, err, msg, args...) { + return + } + t.FailNow() +} + +// Eventually asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond) +func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Eventually(t, condition, waitFor, tick, msgAndArgs...) { + return + } + t.FailNow() +} + +// Eventuallyf asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Eventuallyf(t, condition, waitFor, tick, msg, args...) { + return + } + t.FailNow() +} + +// Exactly asserts that two objects are equal in value and type. +// +// assert.Exactly(t, int32(123), int64(123)) +func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Exactly(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// Exactlyf asserts that two objects are equal in value and type. +// +// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted") +func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Exactlyf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Fail reports a failure through +func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Fail(t, failureMessage, msgAndArgs...) { + return + } + t.FailNow() +} + +// FailNow fails test +func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.FailNow(t, failureMessage, msgAndArgs...) { + return + } + t.FailNow() +} + +// FailNowf fails test +func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.FailNowf(t, failureMessage, msg, args...) { + return + } + t.FailNow() +} + +// Failf reports a failure through +func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Failf(t, failureMessage, msg, args...) { + return + } + t.FailNow() +} + +// False asserts that the specified value is false. +// +// assert.False(t, myBool) +func False(t TestingT, value bool, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.False(t, value, msgAndArgs...) { + return + } + t.FailNow() +} + +// Falsef asserts that the specified value is false. +// +// assert.Falsef(t, myBool, "error message %s", "formatted") +func Falsef(t TestingT, value bool, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Falsef(t, value, msg, args...) { + return + } + t.FailNow() +} + +// FileExists checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func FileExists(t TestingT, path string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.FileExists(t, path, msgAndArgs...) { + return + } + t.FailNow() +} + +// FileExistsf checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func FileExistsf(t TestingT, path string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.FileExistsf(t, path, msg, args...) { + return + } + t.FailNow() +} + +// Greater asserts that the first element is greater than the second +// +// assert.Greater(t, 2, 1) +// assert.Greater(t, float64(2), float64(1)) +// assert.Greater(t, "b", "a") +func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Greater(t, e1, e2, msgAndArgs...) { + return + } + t.FailNow() +} + +// GreaterOrEqual asserts that the first element is greater than or equal to the second +// +// assert.GreaterOrEqual(t, 2, 1) +// assert.GreaterOrEqual(t, 2, 2) +// assert.GreaterOrEqual(t, "b", "a") +// assert.GreaterOrEqual(t, "b", "b") +func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.GreaterOrEqual(t, e1, e2, msgAndArgs...) { + return + } + t.FailNow() +} + +// GreaterOrEqualf asserts that the first element is greater than or equal to the second +// +// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted") +// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted") +// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted") +// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted") +func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.GreaterOrEqualf(t, e1, e2, msg, args...) { + return + } + t.FailNow() +} + +// Greaterf asserts that the first element is greater than the second +// +// assert.Greaterf(t, 2, 1, "error message %s", "formatted") +// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted") +// assert.Greaterf(t, "b", "a", "error message %s", "formatted") +func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Greaterf(t, e1, e2, msg, args...) { + return + } + t.FailNow() +} + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPBodyContainsf asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) { + return + } + t.FailNow() +} + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPBodyNotContainsf asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) { + return + } + t.FailNow() +} + +// HTTPError asserts that a specified handler returns an error status code. +// +// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPErrorf asserts that a specified handler returns an error status code. +// +// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPErrorf(t, handler, method, url, values, msg, args...) { + return + } + t.FailNow() +} + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPRedirectf asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) { + return + } + t.FailNow() +} + +// HTTPStatusCode asserts that a specified handler returns a specified status code. +// +// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPStatusCode(t, handler, method, url, values, statuscode, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPStatusCodef asserts that a specified handler returns a specified status code. +// +// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPStatusCodef(t, handler, method, url, values, statuscode, msg, args...) { + return + } + t.FailNow() +} + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) { + return + } + t.FailNow() +} + +// HTTPSuccessf asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) { + return + } + t.FailNow() +} + +// Implements asserts that an object is implemented by the specified interface. +// +// assert.Implements(t, (*MyInterface)(nil), new(MyObject)) +func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Implements(t, interfaceObject, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// Implementsf asserts that an object is implemented by the specified interface. +// +// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Implementsf(t, interfaceObject, object, msg, args...) { + return + } + t.FailNow() +} + +// InDelta asserts that the two numerals are within delta of each other. +// +// assert.InDelta(t, math.Pi, 22/7.0, 0.01) +func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDelta(t, expected, actual, delta, msgAndArgs...) { + return + } + t.FailNow() +} + +// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) { + return + } + t.FailNow() +} + +// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) { + return + } + t.FailNow() +} + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) { + return + } + t.FailNow() +} + +// InDeltaSlicef is the same as InDelta, except it compares two slices. +func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) { + return + } + t.FailNow() +} + +// InDeltaf asserts that the two numerals are within delta of each other. +// +// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted") +func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InDeltaf(t, expected, actual, delta, msg, args...) { + return + } + t.FailNow() +} + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) { + return + } + t.FailNow() +} + +// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. +func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) { + return + } + t.FailNow() +} + +// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. +func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) { + return + } + t.FailNow() +} + +// InEpsilonf asserts that expected and actual have a relative error less than epsilon +func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) { + return + } + t.FailNow() +} + +// IsDecreasing asserts that the collection is decreasing +// +// assert.IsDecreasing(t, []int{2, 1, 0}) +// assert.IsDecreasing(t, []float{2, 1}) +// assert.IsDecreasing(t, []string{"b", "a"}) +func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsDecreasing(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsDecreasingf asserts that the collection is decreasing +// +// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") +// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted") +// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted") +func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsDecreasingf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// IsIncreasing asserts that the collection is increasing +// +// assert.IsIncreasing(t, []int{1, 2, 3}) +// assert.IsIncreasing(t, []float{1, 2}) +// assert.IsIncreasing(t, []string{"a", "b"}) +func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsIncreasing(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsIncreasingf asserts that the collection is increasing +// +// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") +// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted") +// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted") +func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsIncreasingf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// IsNonDecreasing asserts that the collection is not decreasing +// +// assert.IsNonDecreasing(t, []int{1, 1, 2}) +// assert.IsNonDecreasing(t, []float{1, 2}) +// assert.IsNonDecreasing(t, []string{"a", "b"}) +func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNonDecreasing(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsNonDecreasingf asserts that the collection is not decreasing +// +// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") +// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted") +// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted") +func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNonDecreasingf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// IsNonIncreasing asserts that the collection is not increasing +// +// assert.IsNonIncreasing(t, []int{2, 1, 1}) +// assert.IsNonIncreasing(t, []float{2, 1}) +// assert.IsNonIncreasing(t, []string{"b", "a"}) +func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNonIncreasing(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsNonIncreasingf asserts that the collection is not increasing +// +// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") +// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted") +// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted") +func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsNonIncreasingf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// IsType asserts that the specified objects are of the same type. +func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsType(t, expectedType, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// IsTypef asserts that the specified objects are of the same type. +func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.IsTypef(t, expectedType, object, msg, args...) { + return + } + t.FailNow() +} + +// JSONEq asserts that two JSON strings are equivalent. +// +// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.JSONEq(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// JSONEqf asserts that two JSON strings are equivalent. +// +// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") +func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.JSONEqf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// assert.Len(t, mySlice, 3) +func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Len(t, object, length, msgAndArgs...) { + return + } + t.FailNow() +} + +// Lenf asserts that the specified object has specific length. +// Lenf also fails if the object has a type that len() not accept. +// +// assert.Lenf(t, mySlice, 3, "error message %s", "formatted") +func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Lenf(t, object, length, msg, args...) { + return + } + t.FailNow() +} + +// Less asserts that the first element is less than the second +// +// assert.Less(t, 1, 2) +// assert.Less(t, float64(1), float64(2)) +// assert.Less(t, "a", "b") +func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Less(t, e1, e2, msgAndArgs...) { + return + } + t.FailNow() +} + +// LessOrEqual asserts that the first element is less than or equal to the second +// +// assert.LessOrEqual(t, 1, 2) +// assert.LessOrEqual(t, 2, 2) +// assert.LessOrEqual(t, "a", "b") +// assert.LessOrEqual(t, "b", "b") +func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.LessOrEqual(t, e1, e2, msgAndArgs...) { + return + } + t.FailNow() +} + +// LessOrEqualf asserts that the first element is less than or equal to the second +// +// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted") +// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted") +// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted") +// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted") +func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.LessOrEqualf(t, e1, e2, msg, args...) { + return + } + t.FailNow() +} + +// Lessf asserts that the first element is less than the second +// +// assert.Lessf(t, 1, 2, "error message %s", "formatted") +// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted") +// assert.Lessf(t, "a", "b", "error message %s", "formatted") +func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Lessf(t, e1, e2, msg, args...) { + return + } + t.FailNow() +} + +// Negative asserts that the specified element is negative +// +// assert.Negative(t, -1) +// assert.Negative(t, -1.23) +func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Negative(t, e, msgAndArgs...) { + return + } + t.FailNow() +} + +// Negativef asserts that the specified element is negative +// +// assert.Negativef(t, -1, "error message %s", "formatted") +// assert.Negativef(t, -1.23, "error message %s", "formatted") +func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Negativef(t, e, msg, args...) { + return + } + t.FailNow() +} + +// Never asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond) +func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Never(t, condition, waitFor, tick, msgAndArgs...) { + return + } + t.FailNow() +} + +// Neverf asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Neverf(t, condition, waitFor, tick, msg, args...) { + return + } + t.FailNow() +} + +// Nil asserts that the specified object is nil. +// +// assert.Nil(t, err) +func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Nil(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// Nilf asserts that the specified object is nil. +// +// assert.Nilf(t, err, "error message %s", "formatted") +func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Nilf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// NoDirExists checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoDirExists(t, path, msgAndArgs...) { + return + } + t.FailNow() +} + +// NoDirExistsf checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoDirExistsf(t, path, msg, args...) { + return + } + t.FailNow() +} + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoError(t, err) { +// assert.Equal(t, expectedObj, actualObj) +// } +func NoError(t TestingT, err error, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoError(t, err, msgAndArgs...) { + return + } + t.FailNow() +} + +// NoErrorf asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoErrorf(t, err, "error message %s", "formatted") { +// assert.Equal(t, expectedObj, actualObj) +// } +func NoErrorf(t TestingT, err error, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoErrorf(t, err, msg, args...) { + return + } + t.FailNow() +} + +// NoFileExists checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoFileExists(t, path, msgAndArgs...) { + return + } + t.FailNow() +} + +// NoFileExistsf checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NoFileExistsf(t, path, msg, args...) { + return + } + t.FailNow() +} + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContains(t, "Hello World", "Earth") +// assert.NotContains(t, ["Hello", "World"], "Earth") +// assert.NotContains(t, {"Hello": "World"}, "Earth") +func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotContains(t, s, contains, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") +// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") +// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") +func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotContainsf(t, s, contains, msg, args...) { + return + } + t.FailNow() +} + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmpty(t, obj) { +// assert.Equal(t, "two", obj[1]) +// } +func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEmpty(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmptyf(t, obj, "error message %s", "formatted") { +// assert.Equal(t, "two", obj[1]) +// } +func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEmptyf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// NotEqual asserts that the specified values are NOT equal. +// +// assert.NotEqual(t, obj1, obj2) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEqual(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotEqualValues asserts that two objects are not equal even when converted to the same type +// +// assert.NotEqualValues(t, obj1, obj2) +func NotEqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEqualValues(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotEqualValuesf asserts that two objects are not equal even when converted to the same type +// +// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted") +func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEqualValuesf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// NotEqualf asserts that the specified values are NOT equal. +// +// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotEqualf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// NotErrorIs asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func NotErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotErrorIs(t, err, target, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotErrorIsf(t, err, target, msg, args...) { + return + } + t.FailNow() +} + +// NotNil asserts that the specified object is not nil. +// +// assert.NotNil(t, err) +func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotNil(t, object, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotNilf asserts that the specified object is not nil. +// +// assert.NotNilf(t, err, "error message %s", "formatted") +func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotNilf(t, object, msg, args...) { + return + } + t.FailNow() +} + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanics(t, func(){ RemainCalm() }) +func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotPanics(t, f, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") +func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotPanicsf(t, f, msg, args...) { + return + } + t.FailNow() +} + +// NotRegexp asserts that a specified regexp does not match a string. +// +// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") +// assert.NotRegexp(t, "^start", "it's not starting") +func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotRegexp(t, rx, str, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotRegexpf asserts that a specified regexp does not match a string. +// +// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") +// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") +func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotRegexpf(t, rx, str, msg, args...) { + return + } + t.FailNow() +} + +// NotSame asserts that two pointers do not reference the same object. +// +// assert.NotSame(t, ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func NotSame(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotSame(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotSamef asserts that two pointers do not reference the same object. +// +// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotSamef(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// NotSubset asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotSubset(t, list, subset, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotSubsetf asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotSubsetf(t, list, subset, msg, args...) { + return + } + t.FailNow() +} + +// NotZero asserts that i is not the zero value for its type. +func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotZero(t, i, msgAndArgs...) { + return + } + t.FailNow() +} + +// NotZerof asserts that i is not the zero value for its type. +func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.NotZerof(t, i, msg, args...) { + return + } + t.FailNow() +} + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panics(t, func(){ GoCrazy() }) +func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Panics(t, f, msgAndArgs...) { + return + } + t.FailNow() +} + +// PanicsWithError asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() }) +func PanicsWithError(t TestingT, errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.PanicsWithError(t, errString, f, msgAndArgs...) { + return + } + t.FailNow() +} + +// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func PanicsWithErrorf(t TestingT, errString string, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.PanicsWithErrorf(t, errString, f, msg, args...) { + return + } + t.FailNow() +} + +// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) +func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.PanicsWithValue(t, expected, f, msgAndArgs...) { + return + } + t.FailNow() +} + +// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.PanicsWithValuef(t, expected, f, msg, args...) { + return + } + t.FailNow() +} + +// Panicsf asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") +func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Panicsf(t, f, msg, args...) { + return + } + t.FailNow() +} + +// Positive asserts that the specified element is positive +// +// assert.Positive(t, 1) +// assert.Positive(t, 1.23) +func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Positive(t, e, msgAndArgs...) { + return + } + t.FailNow() +} + +// Positivef asserts that the specified element is positive +// +// assert.Positivef(t, 1, "error message %s", "formatted") +// assert.Positivef(t, 1.23, "error message %s", "formatted") +func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Positivef(t, e, msg, args...) { + return + } + t.FailNow() +} + +// Regexp asserts that a specified regexp matches a string. +// +// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") +// assert.Regexp(t, "start...$", "it's not starting") +func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Regexp(t, rx, str, msgAndArgs...) { + return + } + t.FailNow() +} + +// Regexpf asserts that a specified regexp matches a string. +// +// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") +// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") +func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Regexpf(t, rx, str, msg, args...) { + return + } + t.FailNow() +} + +// Same asserts that two pointers reference the same object. +// +// assert.Same(t, ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func Same(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Same(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// Samef asserts that two pointers reference the same object. +// +// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Samef(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Subset asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Subset(t, list, subset, msgAndArgs...) { + return + } + t.FailNow() +} + +// Subsetf asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Subsetf(t, list, subset, msg, args...) { + return + } + t.FailNow() +} + +// True asserts that the specified value is true. +// +// assert.True(t, myBool) +func True(t TestingT, value bool, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.True(t, value, msgAndArgs...) { + return + } + t.FailNow() +} + +// Truef asserts that the specified value is true. +// +// assert.Truef(t, myBool, "error message %s", "formatted") +func Truef(t TestingT, value bool, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Truef(t, value, msg, args...) { + return + } + t.FailNow() +} + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) +func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) { + return + } + t.FailNow() +} + +// WithinDurationf asserts that the two times are within duration delta of each other. +// +// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") +func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.WithinDurationf(t, expected, actual, delta, msg, args...) { + return + } + t.FailNow() +} + +// YAMLEq asserts that two YAML strings are equivalent. +func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.YAMLEq(t, expected, actual, msgAndArgs...) { + return + } + t.FailNow() +} + +// YAMLEqf asserts that two YAML strings are equivalent. +func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.YAMLEqf(t, expected, actual, msg, args...) { + return + } + t.FailNow() +} + +// Zero asserts that i is the zero value for its type. +func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Zero(t, i, msgAndArgs...) { + return + } + t.FailNow() +} + +// Zerof asserts that i is the zero value for its type. +func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) { + if h, ok := t.(tHelper); ok { + h.Helper() + } + if assert.Zerof(t, i, msg, args...) { + return + } + t.FailNow() +} diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl new file mode 100644 index 000000000..55e42ddeb --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require.go.tmpl @@ -0,0 +1,6 @@ +{{.Comment}} +func {{.DocInfo.Name}}(t TestingT, {{.Params}}) { + if h, ok := t.(tHelper); ok { h.Helper() } + if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return } + t.FailNow() +} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go new file mode 100644 index 000000000..ed54a9d83 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require_forward.go @@ -0,0 +1,1471 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND + */ + +package require + +import ( + assert "github.com/stretchr/testify/assert" + http "net/http" + url "net/url" + time "time" +) + +// Condition uses a Comparison to assert a complex condition. +func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Condition(a.t, comp, msgAndArgs...) +} + +// Conditionf uses a Comparison to assert a complex condition. +func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Conditionf(a.t, comp, msg, args...) +} + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Contains("Hello World", "World") +// a.Contains(["Hello", "World"], "World") +// a.Contains({"Hello": "World"}, "Hello") +func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Contains(a.t, s, contains, msgAndArgs...) +} + +// Containsf asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Containsf("Hello World", "World", "error message %s", "formatted") +// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") +// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") +func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Containsf(a.t, s, contains, msg, args...) +} + +// DirExists checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + DirExists(a.t, path, msgAndArgs...) +} + +// DirExistsf checks whether a directory exists in the given path. It also fails +// if the path is a file rather a directory or there is an error checking whether it exists. +func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + DirExistsf(a.t, path, msg, args...) +} + +// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) +func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ElementsMatch(a.t, listA, listB, msgAndArgs...) +} + +// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified +// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, +// the number of appearances of each of them in both lists should match. +// +// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") +func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ElementsMatchf(a.t, listA, listB, msg, args...) +} + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Empty(obj) +func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Empty(a.t, object, msgAndArgs...) +} + +// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Emptyf(obj, "error message %s", "formatted") +func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Emptyf(a.t, object, msg, args...) +} + +// Equal asserts that two objects are equal. +// +// a.Equal(123, 123) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Equal(a.t, expected, actual, msgAndArgs...) +} + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// a.EqualError(err, expectedErrorString) +func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + EqualError(a.t, theError, errString, msgAndArgs...) +} + +// EqualErrorf asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") +func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + EqualErrorf(a.t, theError, errString, msg, args...) +} + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValues(uint32(123), int32(123)) +func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + EqualValues(a.t, expected, actual, msgAndArgs...) +} + +// EqualValuesf asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") +func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + EqualValuesf(a.t, expected, actual, msg, args...) +} + +// Equalf asserts that two objects are equal. +// +// a.Equalf(123, 123, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). Function equality +// cannot be determined and will always fail. +func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Equalf(a.t, expected, actual, msg, args...) +} + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Error(err) { +// assert.Equal(t, expectedError, err) +// } +func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Error(a.t, err, msgAndArgs...) +} + +// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorAs(a.t, err, target, msgAndArgs...) +} + +// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. +// This is a wrapper for errors.As. +func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorAsf(a.t, err, target, msg, args...) +} + +// ErrorIs asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorIs(a.t, err, target, msgAndArgs...) +} + +// ErrorIsf asserts that at least one of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + ErrorIsf(a.t, err, target, msg, args...) +} + +// Errorf asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Errorf(err, "error message %s", "formatted") { +// assert.Equal(t, expectedErrorf, err) +// } +func (a *Assertions) Errorf(err error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Errorf(a.t, err, msg, args...) +} + +// Eventually asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond) +func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Eventually(a.t, condition, waitFor, tick, msgAndArgs...) +} + +// Eventuallyf asserts that given condition will be met in waitFor time, +// periodically checking target function each tick. +// +// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Eventuallyf(a.t, condition, waitFor, tick, msg, args...) +} + +// Exactly asserts that two objects are equal in value and type. +// +// a.Exactly(int32(123), int64(123)) +func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Exactly(a.t, expected, actual, msgAndArgs...) +} + +// Exactlyf asserts that two objects are equal in value and type. +// +// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted") +func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Exactlyf(a.t, expected, actual, msg, args...) +} + +// Fail reports a failure through +func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Fail(a.t, failureMessage, msgAndArgs...) +} + +// FailNow fails test +func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + FailNow(a.t, failureMessage, msgAndArgs...) +} + +// FailNowf fails test +func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + FailNowf(a.t, failureMessage, msg, args...) +} + +// Failf reports a failure through +func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Failf(a.t, failureMessage, msg, args...) +} + +// False asserts that the specified value is false. +// +// a.False(myBool) +func (a *Assertions) False(value bool, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + False(a.t, value, msgAndArgs...) +} + +// Falsef asserts that the specified value is false. +// +// a.Falsef(myBool, "error message %s", "formatted") +func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Falsef(a.t, value, msg, args...) +} + +// FileExists checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + FileExists(a.t, path, msgAndArgs...) +} + +// FileExistsf checks whether a file exists in the given path. It also fails if +// the path points to a directory or there is an error when trying to check the file. +func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + FileExistsf(a.t, path, msg, args...) +} + +// Greater asserts that the first element is greater than the second +// +// a.Greater(2, 1) +// a.Greater(float64(2), float64(1)) +// a.Greater("b", "a") +func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Greater(a.t, e1, e2, msgAndArgs...) +} + +// GreaterOrEqual asserts that the first element is greater than or equal to the second +// +// a.GreaterOrEqual(2, 1) +// a.GreaterOrEqual(2, 2) +// a.GreaterOrEqual("b", "a") +// a.GreaterOrEqual("b", "b") +func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + GreaterOrEqual(a.t, e1, e2, msgAndArgs...) +} + +// GreaterOrEqualf asserts that the first element is greater than or equal to the second +// +// a.GreaterOrEqualf(2, 1, "error message %s", "formatted") +// a.GreaterOrEqualf(2, 2, "error message %s", "formatted") +// a.GreaterOrEqualf("b", "a", "error message %s", "formatted") +// a.GreaterOrEqualf("b", "b", "error message %s", "formatted") +func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + GreaterOrEqualf(a.t, e1, e2, msg, args...) +} + +// Greaterf asserts that the first element is greater than the second +// +// a.Greaterf(2, 1, "error message %s", "formatted") +// a.Greaterf(float64(2), float64(1), "error message %s", "formatted") +// a.Greaterf("b", "a", "error message %s", "formatted") +func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Greaterf(a.t, e1, e2, msg, args...) +} + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) +} + +// HTTPBodyContainsf asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...) +} + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) +} + +// HTTPBodyNotContainsf asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...) +} + +// HTTPError asserts that a specified handler returns an error status code. +// +// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPError(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPErrorf asserts that a specified handler returns an error status code. +// +// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPErrorf(a.t, handler, method, url, values, msg, args...) +} + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPRedirectf asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPRedirectf(a.t, handler, method, url, values, msg, args...) +} + +// HTTPStatusCode asserts that a specified handler returns a specified status code. +// +// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...) +} + +// HTTPStatusCodef asserts that a specified handler returns a specified status code. +// +// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...) +} + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) +} + +// HTTPSuccessf asserts that a specified handler returns a success status code. +// +// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + HTTPSuccessf(a.t, handler, method, url, values, msg, args...) +} + +// Implements asserts that an object is implemented by the specified interface. +// +// a.Implements((*MyInterface)(nil), new(MyObject)) +func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Implements(a.t, interfaceObject, object, msgAndArgs...) +} + +// Implementsf asserts that an object is implemented by the specified interface. +// +// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") +func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Implementsf(a.t, interfaceObject, object, msg, args...) +} + +// InDelta asserts that the two numerals are within delta of each other. +// +// a.InDelta(math.Pi, 22/7.0, 0.01) +func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDelta(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. +func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...) +} + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) +} + +// InDeltaSlicef is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaSlicef(a.t, expected, actual, delta, msg, args...) +} + +// InDeltaf asserts that the two numerals are within delta of each other. +// +// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted") +func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InDeltaf(a.t, expected, actual, delta, msg, args...) +} + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) +} + +// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. +func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) +} + +// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. +func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) +} + +// InEpsilonf asserts that expected and actual have a relative error less than epsilon +func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + InEpsilonf(a.t, expected, actual, epsilon, msg, args...) +} + +// IsDecreasing asserts that the collection is decreasing +// +// a.IsDecreasing([]int{2, 1, 0}) +// a.IsDecreasing([]float{2, 1}) +// a.IsDecreasing([]string{"b", "a"}) +func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsDecreasing(a.t, object, msgAndArgs...) +} + +// IsDecreasingf asserts that the collection is decreasing +// +// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted") +// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted") +// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted") +func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsDecreasingf(a.t, object, msg, args...) +} + +// IsIncreasing asserts that the collection is increasing +// +// a.IsIncreasing([]int{1, 2, 3}) +// a.IsIncreasing([]float{1, 2}) +// a.IsIncreasing([]string{"a", "b"}) +func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsIncreasing(a.t, object, msgAndArgs...) +} + +// IsIncreasingf asserts that the collection is increasing +// +// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted") +// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted") +// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted") +func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsIncreasingf(a.t, object, msg, args...) +} + +// IsNonDecreasing asserts that the collection is not decreasing +// +// a.IsNonDecreasing([]int{1, 1, 2}) +// a.IsNonDecreasing([]float{1, 2}) +// a.IsNonDecreasing([]string{"a", "b"}) +func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNonDecreasing(a.t, object, msgAndArgs...) +} + +// IsNonDecreasingf asserts that the collection is not decreasing +// +// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted") +// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted") +// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted") +func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNonDecreasingf(a.t, object, msg, args...) +} + +// IsNonIncreasing asserts that the collection is not increasing +// +// a.IsNonIncreasing([]int{2, 1, 1}) +// a.IsNonIncreasing([]float{2, 1}) +// a.IsNonIncreasing([]string{"b", "a"}) +func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNonIncreasing(a.t, object, msgAndArgs...) +} + +// IsNonIncreasingf asserts that the collection is not increasing +// +// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted") +// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted") +// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted") +func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsNonIncreasingf(a.t, object, msg, args...) +} + +// IsType asserts that the specified objects are of the same type. +func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsType(a.t, expectedType, object, msgAndArgs...) +} + +// IsTypef asserts that the specified objects are of the same type. +func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + IsTypef(a.t, expectedType, object, msg, args...) +} + +// JSONEq asserts that two JSON strings are equivalent. +// +// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + JSONEq(a.t, expected, actual, msgAndArgs...) +} + +// JSONEqf asserts that two JSON strings are equivalent. +// +// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") +func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + JSONEqf(a.t, expected, actual, msg, args...) +} + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// a.Len(mySlice, 3) +func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Len(a.t, object, length, msgAndArgs...) +} + +// Lenf asserts that the specified object has specific length. +// Lenf also fails if the object has a type that len() not accept. +// +// a.Lenf(mySlice, 3, "error message %s", "formatted") +func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Lenf(a.t, object, length, msg, args...) +} + +// Less asserts that the first element is less than the second +// +// a.Less(1, 2) +// a.Less(float64(1), float64(2)) +// a.Less("a", "b") +func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Less(a.t, e1, e2, msgAndArgs...) +} + +// LessOrEqual asserts that the first element is less than or equal to the second +// +// a.LessOrEqual(1, 2) +// a.LessOrEqual(2, 2) +// a.LessOrEqual("a", "b") +// a.LessOrEqual("b", "b") +func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + LessOrEqual(a.t, e1, e2, msgAndArgs...) +} + +// LessOrEqualf asserts that the first element is less than or equal to the second +// +// a.LessOrEqualf(1, 2, "error message %s", "formatted") +// a.LessOrEqualf(2, 2, "error message %s", "formatted") +// a.LessOrEqualf("a", "b", "error message %s", "formatted") +// a.LessOrEqualf("b", "b", "error message %s", "formatted") +func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + LessOrEqualf(a.t, e1, e2, msg, args...) +} + +// Lessf asserts that the first element is less than the second +// +// a.Lessf(1, 2, "error message %s", "formatted") +// a.Lessf(float64(1), float64(2), "error message %s", "formatted") +// a.Lessf("a", "b", "error message %s", "formatted") +func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Lessf(a.t, e1, e2, msg, args...) +} + +// Negative asserts that the specified element is negative +// +// a.Negative(-1) +// a.Negative(-1.23) +func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Negative(a.t, e, msgAndArgs...) +} + +// Negativef asserts that the specified element is negative +// +// a.Negativef(-1, "error message %s", "formatted") +// a.Negativef(-1.23, "error message %s", "formatted") +func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Negativef(a.t, e, msg, args...) +} + +// Never asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond) +func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Never(a.t, condition, waitFor, tick, msgAndArgs...) +} + +// Neverf asserts that the given condition doesn't satisfy in waitFor time, +// periodically checking the target function each tick. +// +// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") +func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Neverf(a.t, condition, waitFor, tick, msg, args...) +} + +// Nil asserts that the specified object is nil. +// +// a.Nil(err) +func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Nil(a.t, object, msgAndArgs...) +} + +// Nilf asserts that the specified object is nil. +// +// a.Nilf(err, "error message %s", "formatted") +func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Nilf(a.t, object, msg, args...) +} + +// NoDirExists checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoDirExists(a.t, path, msgAndArgs...) +} + +// NoDirExistsf checks whether a directory does not exist in the given path. +// It fails if the path points to an existing _directory_ only. +func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoDirExistsf(a.t, path, msg, args...) +} + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoError(err) { +// assert.Equal(t, expectedObj, actualObj) +// } +func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoError(a.t, err, msgAndArgs...) +} + +// NoErrorf asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoErrorf(err, "error message %s", "formatted") { +// assert.Equal(t, expectedObj, actualObj) +// } +func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoErrorf(a.t, err, msg, args...) +} + +// NoFileExists checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoFileExists(a.t, path, msgAndArgs...) +} + +// NoFileExistsf checks whether a file does not exist in a given path. It fails +// if the path points to an existing _file_ only. +func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NoFileExistsf(a.t, path, msg, args...) +} + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContains("Hello World", "Earth") +// a.NotContains(["Hello", "World"], "Earth") +// a.NotContains({"Hello": "World"}, "Earth") +func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotContains(a.t, s, contains, msgAndArgs...) +} + +// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") +// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") +// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") +func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotContainsf(a.t, s, contains, msg, args...) +} + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmpty(obj) { +// assert.Equal(t, "two", obj[1]) +// } +func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEmpty(a.t, object, msgAndArgs...) +} + +// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmptyf(obj, "error message %s", "formatted") { +// assert.Equal(t, "two", obj[1]) +// } +func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEmptyf(a.t, object, msg, args...) +} + +// NotEqual asserts that the specified values are NOT equal. +// +// a.NotEqual(obj1, obj2) +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEqual(a.t, expected, actual, msgAndArgs...) +} + +// NotEqualValues asserts that two objects are not equal even when converted to the same type +// +// a.NotEqualValues(obj1, obj2) +func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEqualValues(a.t, expected, actual, msgAndArgs...) +} + +// NotEqualValuesf asserts that two objects are not equal even when converted to the same type +// +// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted") +func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEqualValuesf(a.t, expected, actual, msg, args...) +} + +// NotEqualf asserts that the specified values are NOT equal. +// +// a.NotEqualf(obj1, obj2, "error message %s", "formatted") +// +// Pointer variable equality is determined based on the equality of the +// referenced values (as opposed to the memory addresses). +func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotEqualf(a.t, expected, actual, msg, args...) +} + +// NotErrorIs asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotErrorIs(a.t, err, target, msgAndArgs...) +} + +// NotErrorIsf asserts that at none of the errors in err's chain matches target. +// This is a wrapper for errors.Is. +func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotErrorIsf(a.t, err, target, msg, args...) +} + +// NotNil asserts that the specified object is not nil. +// +// a.NotNil(err) +func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotNil(a.t, object, msgAndArgs...) +} + +// NotNilf asserts that the specified object is not nil. +// +// a.NotNilf(err, "error message %s", "formatted") +func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotNilf(a.t, object, msg, args...) +} + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanics(func(){ RemainCalm() }) +func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotPanics(a.t, f, msgAndArgs...) +} + +// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") +func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotPanicsf(a.t, f, msg, args...) +} + +// NotRegexp asserts that a specified regexp does not match a string. +// +// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") +// a.NotRegexp("^start", "it's not starting") +func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotRegexp(a.t, rx, str, msgAndArgs...) +} + +// NotRegexpf asserts that a specified regexp does not match a string. +// +// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") +// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") +func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotRegexpf(a.t, rx, str, msg, args...) +} + +// NotSame asserts that two pointers do not reference the same object. +// +// a.NotSame(ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotSame(a.t, expected, actual, msgAndArgs...) +} + +// NotSamef asserts that two pointers do not reference the same object. +// +// a.NotSamef(ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotSamef(a.t, expected, actual, msg, args...) +} + +// NotSubset asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]") +func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotSubset(a.t, list, subset, msgAndArgs...) +} + +// NotSubsetf asserts that the specified list(array, slice...) contains not all +// elements given in the specified subset(array, slice...). +// +// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted") +func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotSubsetf(a.t, list, subset, msg, args...) +} + +// NotZero asserts that i is not the zero value for its type. +func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotZero(a.t, i, msgAndArgs...) +} + +// NotZerof asserts that i is not the zero value for its type. +func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + NotZerof(a.t, i, msg, args...) +} + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panics(func(){ GoCrazy() }) +func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Panics(a.t, f, msgAndArgs...) +} + +// PanicsWithError asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// a.PanicsWithError("crazy error", func(){ GoCrazy() }) +func (a *Assertions) PanicsWithError(errString string, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + PanicsWithError(a.t, errString, f, msgAndArgs...) +} + +// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc +// panics, and that the recovered panic value is an error that satisfies the +// EqualError comparison. +// +// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) PanicsWithErrorf(errString string, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + PanicsWithErrorf(a.t, errString, f, msg, args...) +} + +// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// a.PanicsWithValue("crazy error", func(){ GoCrazy() }) +func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + PanicsWithValue(a.t, expected, f, msgAndArgs...) +} + +// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that +// the recovered panic value equals the expected panic value. +// +// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + PanicsWithValuef(a.t, expected, f, msg, args...) +} + +// Panicsf asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") +func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Panicsf(a.t, f, msg, args...) +} + +// Positive asserts that the specified element is positive +// +// a.Positive(1) +// a.Positive(1.23) +func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Positive(a.t, e, msgAndArgs...) +} + +// Positivef asserts that the specified element is positive +// +// a.Positivef(1, "error message %s", "formatted") +// a.Positivef(1.23, "error message %s", "formatted") +func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Positivef(a.t, e, msg, args...) +} + +// Regexp asserts that a specified regexp matches a string. +// +// a.Regexp(regexp.MustCompile("start"), "it's starting") +// a.Regexp("start...$", "it's not starting") +func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Regexp(a.t, rx, str, msgAndArgs...) +} + +// Regexpf asserts that a specified regexp matches a string. +// +// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") +// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") +func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Regexpf(a.t, rx, str, msg, args...) +} + +// Same asserts that two pointers reference the same object. +// +// a.Same(ptr1, ptr2) +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Same(a.t, expected, actual, msgAndArgs...) +} + +// Samef asserts that two pointers reference the same object. +// +// a.Samef(ptr1, ptr2, "error message %s", "formatted") +// +// Both arguments must be pointer variables. Pointer variable sameness is +// determined based on the equality of both type and value. +func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Samef(a.t, expected, actual, msg, args...) +} + +// Subset asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]") +func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Subset(a.t, list, subset, msgAndArgs...) +} + +// Subsetf asserts that the specified list(array, slice...) contains all +// elements given in the specified subset(array, slice...). +// +// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted") +func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Subsetf(a.t, list, subset, msg, args...) +} + +// True asserts that the specified value is true. +// +// a.True(myBool) +func (a *Assertions) True(value bool, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + True(a.t, value, msgAndArgs...) +} + +// Truef asserts that the specified value is true. +// +// a.Truef(myBool, "error message %s", "formatted") +func (a *Assertions) Truef(value bool, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Truef(a.t, value, msg, args...) +} + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// a.WithinDuration(time.Now(), time.Now(), 10*time.Second) +func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + WithinDuration(a.t, expected, actual, delta, msgAndArgs...) +} + +// WithinDurationf asserts that the two times are within duration delta of each other. +// +// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") +func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + WithinDurationf(a.t, expected, actual, delta, msg, args...) +} + +// YAMLEq asserts that two YAML strings are equivalent. +func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + YAMLEq(a.t, expected, actual, msgAndArgs...) +} + +// YAMLEqf asserts that two YAML strings are equivalent. +func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + YAMLEqf(a.t, expected, actual, msg, args...) +} + +// Zero asserts that i is the zero value for its type. +func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Zero(a.t, i, msgAndArgs...) +} + +// Zerof asserts that i is the zero value for its type. +func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + Zerof(a.t, i, msg, args...) +} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl new file mode 100644 index 000000000..54124df1d --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl @@ -0,0 +1,5 @@ +{{.CommentWithoutT "a"}} +func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) { + if h, ok := a.t.(tHelper); ok { h.Helper() } + {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) +} diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go new file mode 100644 index 000000000..91772dfeb --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/requirements.go @@ -0,0 +1,29 @@ +package require + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Errorf(format string, args ...interface{}) + FailNow() +} + +type tHelper interface { + Helper() +} + +// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful +// for table driven tests. +type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) + +// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful +// for table driven tests. +type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) + +// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful +// for table driven tests. +type BoolAssertionFunc func(TestingT, bool, ...interface{}) + +// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful +// for table driven tests. +type ErrorAssertionFunc func(TestingT, error, ...interface{}) + +//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=require -template=require.go.tmpl -include-format-funcs" diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 1cecf98b2..86b734aec 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -24,7 +24,6 @@ import ( "net/http" "net/http/httptrace" "net/textproto" - "os" "sort" "strconv" "strings" @@ -131,11 +130,6 @@ type Transport struct { // Defaults to 15s. PingTimeout time.Duration - // WriteByteTimeout is the timeout after which the connection will be - // closed no data can be written to it. The timeout begins when data is - // available to write, and is extended whenever any bytes are written. - WriteByteTimeout time.Duration - // CountError, if non-nil, is called on HTTP/2 transport errors. // It's intended to increment a metric for monitoring, such // as an expvar or Prometheus metric. @@ -399,31 +393,17 @@ func (cs *clientStream) abortRequestBodyWrite() { } type stickyErrWriter struct { - conn net.Conn - timeout time.Duration - err *error + w io.Writer + err *error } func (sew stickyErrWriter) Write(p []byte) (n int, err error) { if *sew.err != nil { return 0, *sew.err } - for { - if sew.timeout != 0 { - sew.conn.SetWriteDeadline(time.Now().Add(sew.timeout)) - } - nn, err := sew.conn.Write(p[n:]) - n += nn - if n < len(p) && nn > 0 && errors.Is(err, os.ErrDeadlineExceeded) { - // Keep extending the deadline so long as we're making progress. - continue - } - if sew.timeout != 0 { - sew.conn.SetWriteDeadline(time.Time{}) - } - *sew.err = err - return n, err - } + n, err = sew.w.Write(p) + *sew.err = err + return } // noCachedConnError is the concrete type of ErrNoCachedConn, which @@ -678,11 +658,7 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro // TODO: adjust this writer size to account for frame size + // MTU + crypto/tls record padding. - cc.bw = bufio.NewWriter(stickyErrWriter{ - conn: c, - timeout: t.WriteByteTimeout, - err: &cc.werr, - }) + cc.bw = bufio.NewWriter(stickyErrWriter{c, &cc.werr}) cc.br = bufio.NewReader(c) cc.fr = NewFramer(cc.bw, cc.br) if t.CountError != nil { @@ -2291,8 +2267,6 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra } else if len(clens) > 1 { // TODO: care? unlike http/1, it won't mess up our framing, so it's // more safe smuggling-wise to ignore. - } else if f.StreamEnded() && !cs.isHead { - res.ContentLength = 0 } if cs.isHead { diff --git a/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go b/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go index 87ae9d2a3..c9b69937a 100644 --- a/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go +++ b/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build go1.5 // +build go1.5 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/pwd_plan9.go b/vendor/golang.org/x/sys/plan9/pwd_plan9.go index c07c798bc..98bf56b73 100644 --- a/vendor/golang.org/x/sys/plan9/pwd_plan9.go +++ b/vendor/golang.org/x/sys/plan9/pwd_plan9.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !go1.5 // +build !go1.5 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/race.go b/vendor/golang.org/x/sys/plan9/race.go index 42edd93ef..62377d2ff 100644 --- a/vendor/golang.org/x/sys/plan9/race.go +++ b/vendor/golang.org/x/sys/plan9/race.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build plan9 && race // +build plan9,race package plan9 diff --git a/vendor/golang.org/x/sys/plan9/race0.go b/vendor/golang.org/x/sys/plan9/race0.go index c89cf8fc0..f8da30876 100644 --- a/vendor/golang.org/x/sys/plan9/race0.go +++ b/vendor/golang.org/x/sys/plan9/race0.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build plan9 && !race // +build plan9,!race package plan9 diff --git a/vendor/golang.org/x/sys/plan9/str.go b/vendor/golang.org/x/sys/plan9/str.go index 4f7f9ad7c..55fa8d025 100644 --- a/vendor/golang.org/x/sys/plan9/str.go +++ b/vendor/golang.org/x/sys/plan9/str.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build plan9 // +build plan9 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/syscall.go b/vendor/golang.org/x/sys/plan9/syscall.go index e7363a2f5..602473cba 100644 --- a/vendor/golang.org/x/sys/plan9/syscall.go +++ b/vendor/golang.org/x/sys/plan9/syscall.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build plan9 // +build plan9 // Package plan9 contains an interface to the low-level operating system diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go index 6819bc209..3f40b9bd7 100644 --- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go +++ b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -plan9 -tags plan9,386 syscall_plan9.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build plan9 && 386 // +build plan9,386 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go index 418abbbfc..0e6a96aa4 100644 --- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go +++ b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -plan9 -tags plan9,amd64 syscall_plan9.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build plan9 && amd64 // +build plan9,amd64 package plan9 diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go index 3e8a1a58c..244c501b7 100644 --- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go +++ b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -plan9 -tags plan9,arm syscall_plan9.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build plan9 && arm // +build plan9,arm package plan9 diff --git a/vendor/golang.org/x/sys/unix/README.md b/vendor/golang.org/x/sys/unix/README.md index 474efad0e..7d3c060e1 100644 --- a/vendor/golang.org/x/sys/unix/README.md +++ b/vendor/golang.org/x/sys/unix/README.md @@ -149,7 +149,7 @@ To add a constant, add the header that includes it to the appropriate variable. Then, edit the regex (if necessary) to match the desired constant. Avoid making the regex too broad to avoid matching unintended constants. -### mkmerge.go +### internal/mkmerge This program is used to extract duplicate const, func, and type declarations from the generated architecture-specific files listed below, and merge these diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh index 396aadf86..ee7362348 100644 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then # Use the Docker-based build system # Files generated through docker (use $cmd so you can Ctl-C the build or run) $cmd docker build --tag generate:$GOOS $GOOS - $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")" && /bin/pwd):/build generate:$GOOS + $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS exit fi diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index a74ef58f8..4945739ea 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -239,6 +239,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -520,7 +521,7 @@ ccflags="$@" $2 ~ /^HW_MACHINE$/ || $2 ~ /^SYSCTL_VERS/ || $2 !~ "MNT_BITS" && - $2 ~ /^(MS|MNT|UMOUNT)_/ || + $2 ~ /^(MS|MNT|MOUNT|UMOUNT)_/ || $2 ~ /^NS_GET_/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || $2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ || diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_linux.go b/vendor/golang.org/x/sys/unix/sockcmsg_linux.go index 326fb04a5..5f63147e0 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_linux.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_linux.go @@ -67,9 +67,7 @@ func ParseOrigDstAddr(m *SocketControlMessage) (Sockaddr, error) { sa := new(SockaddrInet4) p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil case m.Header.Level == SOL_IPV6 && m.Header.Type == IPV6_ORIGDSTADDR: @@ -78,9 +76,7 @@ func ParseOrigDstAddr(m *SocketControlMessage) (Sockaddr, error) { p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil default: diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index d8efb715f..6192750ce 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -70,9 +70,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil } @@ -85,9 +83,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) { p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) sa.raw.Scope_id = sa.ZoneId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil } @@ -261,9 +257,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { sa := new(SockaddrInet4) p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil case AF_INET6: @@ -272,9 +266,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil } return nil, EAFNOSUPPORT @@ -385,6 +377,11 @@ func (w WaitStatus) TrapCause() int { return -1 } //sys fcntl(fd int, cmd int, arg int) (val int, err error) +//sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range +func Fsync(fd int) error { + return fsyncRange(fd, O_SYNC, 0, 0) +} + /* * Direct access */ @@ -401,7 +398,6 @@ func (w WaitStatus) TrapCause() int { return -1 } //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Fdatasync(fd int) (err error) -//sys Fsync(fd int) (err error) // readdir_r //sysnb Getpgid(pid int) (pgid int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 95ac3946b..0ce452326 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -163,9 +163,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil } @@ -179,9 +177,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) { p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) sa.raw.Scope_id = sa.ZoneId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil } @@ -210,9 +206,7 @@ func (sa *SockaddrDatalink) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Nlen = sa.Nlen sa.raw.Alen = sa.Alen sa.raw.Slen = sa.Slen - for i := 0; i < len(sa.raw.Data); i++ { - sa.raw.Data[i] = sa.Data[i] - } + sa.raw.Data = sa.Data return unsafe.Pointer(&sa.raw), SizeofSockaddrDatalink, nil } @@ -228,9 +222,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { sa.Nlen = pp.Nlen sa.Alen = pp.Alen sa.Slen = pp.Slen - for i := 0; i < len(sa.Data); i++ { - sa.Data[i] = pp.Data[i] - } + sa.Data = pp.Data return sa, nil case AF_UNIX: @@ -262,9 +254,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { sa := new(SockaddrInet4) p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil case AF_INET6: @@ -273,9 +263,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil } return anyToSockaddrGOOS(fd, rsa) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index a8c13317d..8826f4143 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -430,8 +430,25 @@ func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { return x, err } -func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) { - mib, err := sysctlmib(name) +func SysctlKinfoProc(name string, args ...int) (*KinfoProc, error) { + mib, err := sysctlmib(name, args...) + if err != nil { + return nil, err + } + + var kinfo KinfoProc + n := uintptr(SizeofKinfoProc) + if err := sysctl(mib, (*byte)(unsafe.Pointer(&kinfo)), &n, nil, 0); err != nil { + return nil, err + } + if n != SizeofKinfoProc { + return nil, EIO + } + return &kinfo, nil +} + +func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { + mib, err := sysctlmib(name, args...) if err != nil { return nil, err } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index fff38a84c..4bc5baf77 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -372,9 +372,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil } @@ -387,9 +385,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) { p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) sa.raw.Scope_id = sa.ZoneId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil } @@ -438,9 +434,7 @@ func (sa *SockaddrLinklayer) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Hatype = sa.Hatype sa.raw.Pkttype = sa.Pkttype sa.raw.Halen = sa.Halen - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrLinklayer, nil } @@ -855,12 +849,10 @@ func (sa *SockaddrTIPC) sockaddr() (unsafe.Pointer, _Socklen, error) { if sa.Addr == nil { return nil, 0, EINVAL } - sa.raw.Family = AF_TIPC sa.raw.Scope = int8(sa.Scope) sa.raw.Addrtype = sa.Addr.tipcAddrtype() sa.raw.Addr = sa.Addr.tipcAddr() - return unsafe.Pointer(&sa.raw), SizeofSockaddrTIPC, nil } @@ -874,9 +866,7 @@ type SockaddrL2TPIP struct { func (sa *SockaddrL2TPIP) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Family = AF_INET sa.raw.Conn_id = sa.ConnId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP, nil } @@ -892,9 +882,7 @@ func (sa *SockaddrL2TPIP6) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Family = AF_INET6 sa.raw.Conn_id = sa.ConnId sa.raw.Scope_id = sa.ZoneId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP6, nil } @@ -990,9 +978,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { sa.Hatype = pp.Hatype sa.Pkttype = pp.Pkttype sa.Halen = pp.Halen - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil case AF_UNIX: @@ -1031,18 +1017,14 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { pp := (*RawSockaddrL2TPIP)(unsafe.Pointer(rsa)) sa := new(SockaddrL2TPIP) sa.ConnId = pp.Conn_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil default: pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa)) sa := new(SockaddrInet4) p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil } @@ -1058,9 +1040,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { sa := new(SockaddrL2TPIP6) sa.ConnId = pp.Conn_id sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil default: pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa)) @@ -1068,9 +1048,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil } @@ -1797,6 +1775,16 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri return mount(source, target, fstype, flags, datap) } +//sys mountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr, size uintptr) (err error) = SYS_MOUNT_SETATTR + +// MountSetattr is a wrapper for mount_setattr(2). +// https://man7.org/linux/man-pages/man2/mount_setattr.2.html +// +// Requires kernel >= 5.12. +func MountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr) error { + return mountSetattr(dirfd, pathname, flags, attr, unsafe.Sizeof(*attr)) +} + func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { if raceenabled { raceReleaseMerge(unsafe.Pointer(&ioSync)) diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index d2a6495c7..8b88ac213 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -92,9 +92,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil } @@ -107,9 +105,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) { p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) sa.raw.Scope_id = sa.ZoneId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil } @@ -417,9 +413,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { sa := new(SockaddrInet4) p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil case AF_INET6: @@ -428,9 +422,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil } return nil, EAFNOSUPPORT diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index 1ffd8bfcf..5fb76a146 100644 --- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -67,9 +67,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil } @@ -83,9 +81,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) { p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) sa.raw.Scope_id = sa.ZoneId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil } @@ -144,9 +140,7 @@ func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) { sa := new(SockaddrInet4) p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil case AF_INET6: @@ -155,9 +149,7 @@ func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) { p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil } return nil, EAFNOSUPPORT diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 78d4b85ec..d175aae89 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux @@ -116,6 +116,7 @@ const ( ARPHRD_LAPB = 0x204 ARPHRD_LOCALTLK = 0x305 ARPHRD_LOOPBACK = 0x304 + ARPHRD_MCTP = 0x122 ARPHRD_METRICOM = 0x17 ARPHRD_NETLINK = 0x338 ARPHRD_NETROM = 0x0 @@ -472,6 +473,7 @@ const ( DM_DEV_WAIT = 0xc138fd08 DM_DIR = "mapper" DM_GET_TARGET_VERSION = 0xc138fd11 + DM_IMA_MEASUREMENT_FLAG = 0x80000 DM_INACTIVE_PRESENT_FLAG = 0x40 DM_INTERNAL_SUSPEND_FLAG = 0x40000 DM_IOCTL = 0xfd @@ -716,6 +718,7 @@ const ( ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 ETH_P_MAP = 0xf9 + ETH_P_MCTP = 0xfa ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 @@ -751,6 +754,21 @@ const ( ETH_P_WCCP = 0x883e ETH_P_X25 = 0x805 ETH_P_XDSA = 0xf8 + EV_ABS = 0x3 + EV_CNT = 0x20 + EV_FF = 0x15 + EV_FF_STATUS = 0x17 + EV_KEY = 0x1 + EV_LED = 0x11 + EV_MAX = 0x1f + EV_MSC = 0x4 + EV_PWR = 0x16 + EV_REL = 0x2 + EV_REP = 0x14 + EV_SND = 0x12 + EV_SW = 0x5 + EV_SYN = 0x0 + EV_VERSION = 0x10001 EXABYTE_ENABLE_NEST = 0xf0 EXT2_SUPER_MAGIC = 0xef53 EXT3_SUPER_MAGIC = 0xef53 @@ -789,9 +807,11 @@ const ( FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EPIDFD = -0x2 FAN_EVENT_INFO_TYPE_DFID = 0x3 FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2 FAN_EVENT_INFO_TYPE_FID = 0x1 + FAN_EVENT_INFO_TYPE_PIDFD = 0x4 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -811,6 +831,7 @@ const ( FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 + FAN_NOPIDFD = -0x1 FAN_ONDIR = 0x40000000 FAN_OPEN = 0x20 FAN_OPEN_EXEC = 0x1000 @@ -821,6 +842,7 @@ const ( FAN_REPORT_DIR_FID = 0x400 FAN_REPORT_FID = 0x200 FAN_REPORT_NAME = 0x800 + FAN_REPORT_PIDFD = 0x80 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1454,6 +1476,18 @@ const ( MNT_FORCE = 0x1 MODULE_INIT_IGNORE_MODVERSIONS = 0x1 MODULE_INIT_IGNORE_VERMAGIC = 0x2 + MOUNT_ATTR_IDMAP = 0x100000 + MOUNT_ATTR_NOATIME = 0x10 + MOUNT_ATTR_NODEV = 0x4 + MOUNT_ATTR_NODIRATIME = 0x80 + MOUNT_ATTR_NOEXEC = 0x8 + MOUNT_ATTR_NOSUID = 0x2 + MOUNT_ATTR_NOSYMFOLLOW = 0x200000 + MOUNT_ATTR_RDONLY = 0x1 + MOUNT_ATTR_RELATIME = 0x0 + MOUNT_ATTR_SIZE_VER0 = 0x20 + MOUNT_ATTR_STRICTATIME = 0x20 + MOUNT_ATTR__ATIME = 0x70 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1997,6 +2031,7 @@ const ( PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 + PR_SPEC_L1D_FLUSH = 0x2 PR_SPEC_NOT_AFFECTED = 0x0 PR_SPEC_PRCTL = 0x1 PR_SPEC_STORE_BYPASS = 0x0 @@ -2432,12 +2467,15 @@ const ( SMART_WRITE_THRESHOLDS = 0xd7 SMB_SUPER_MAGIC = 0x517b SOCKFS_MAGIC = 0x534f434b + SOCK_BUF_LOCK_MASK = 0x3 SOCK_DCCP = 0x6 SOCK_IOC_TYPE = 0x89 SOCK_PACKET = 0xa SOCK_RAW = 0x3 + SOCK_RCVBUF_LOCK = 0x2 SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 + SOCK_SNDBUF_LOCK = 0x1 SOL_AAL = 0x109 SOL_ALG = 0x117 SOL_ATM = 0x108 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 697811a46..3ca40ca7f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -5,7 +5,7 @@ // +build 386,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/unix/_const.go package unix @@ -293,6 +293,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 7d8d93bfc..ead332091 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -5,7 +5,7 @@ // +build amd64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/unix/_const.go package unix @@ -294,6 +294,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index f707d5089..39bdc9455 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -5,7 +5,7 @@ // +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -300,6 +300,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 3a67a9c85..9aec987db 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -5,7 +5,7 @@ // +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/_const.go package unix @@ -290,6 +290,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index a7ccef56c..a8bba9491 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -5,7 +5,7 @@ // +build mips,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -293,6 +293,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index f7b7cec91..ee9e7e202 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -5,7 +5,7 @@ // +build mips64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -293,6 +293,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 4fcacf958..ba4b288a3 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -5,7 +5,7 @@ // +build mips64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -293,6 +293,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 6f6c223a2..bc93afc36 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -5,7 +5,7 @@ // +build mipsle,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -293,6 +293,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 59e522bcf..9295e6947 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -5,7 +5,7 @@ // +build ppc,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -348,6 +348,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index d4264a0f7..1fa081c9a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -5,7 +5,7 @@ // +build ppc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -352,6 +352,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 21cbec1dd..74b321149 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -5,7 +5,7 @@ // +build ppc64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -352,6 +352,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 9b05bf12f..c91c8ac5b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -5,7 +5,7 @@ // +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -281,6 +281,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index bd82ace09..b66bf2228 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -5,7 +5,7 @@ // +build s390x,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/_const.go package unix @@ -356,6 +356,7 @@ const ( SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe + SO_BUF_LOCK = 0x48 SO_BUSY_POLL = 0x2e SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 1f8bded56..f7fb149b0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -5,7 +5,7 @@ // +build sparc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -347,6 +347,7 @@ const ( SO_BPF_EXTENSIONS = 0x32 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0x400 + SO_BUF_LOCK = 0x51 SO_BUSY_POLL = 0x30 SO_BUSY_POLL_BUDGET = 0x49 SO_CNX_ADVICE = 0x37 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index 91a23cc72..85e0cc386 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -17,6 +17,7 @@ int getdirent(int, uintptr_t, size_t); int wait4(int, uintptr_t, int, uintptr_t); int ioctl(int, int, uintptr_t); int fcntl(uintptr_t, int, uintptr_t); +int fsync_range(int, int, long long, long long); int acct(uintptr_t); int chdir(uintptr_t); int chroot(uintptr_t); @@ -29,7 +30,6 @@ int fchmod(int, unsigned int); int fchmodat(int, uintptr_t, unsigned int, int); int fchownat(int, uintptr_t, int, int, int); int fdatasync(int); -int fsync(int); int getpgid(int); int getpgrp(); int getpid(); @@ -255,6 +255,16 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fsyncRange(fd int, how int, start int64, length int64) (err error) { + r0, er := C.fsync_range(C.int(fd), C.int(how), C.longlong(start), C.longlong(length)) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Acct(path string) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) r0, er := C.acct(C.uintptr_t(_p0)) @@ -379,16 +389,6 @@ func Fdatasync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fsync(fd int) (err error) { - r0, er := C.fsync(C.int(fd)) - if r0 == -1 && er != nil { - err = er - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpgid(pid int) (pgid int, err error) { r0, er := C.getpgid(C.int(pid)) pgid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index 33c2609b8..f1d4a73b0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -135,6 +135,16 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fsyncRange(fd int, how int, start int64, length int64) (err error) { + _, e1 := callfsync_range(fd, how, start, length) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Acct(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -283,16 +293,6 @@ func Fdatasync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fsync(fd int) (err error) { - _, e1 := callfsync(fd) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpgid(pid int) (pgid int, err error) { r0, e1 := callgetpgid(pid) pgid = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index 8b737fa97..2caa5adf9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -18,6 +18,7 @@ import ( //go:cgo_import_dynamic libc_wait4 wait4 "libc.a/shr_64.o" //go:cgo_import_dynamic libc_ioctl ioctl "libc.a/shr_64.o" //go:cgo_import_dynamic libc_fcntl fcntl "libc.a/shr_64.o" +//go:cgo_import_dynamic libc_fsync_range fsync_range "libc.a/shr_64.o" //go:cgo_import_dynamic libc_acct acct "libc.a/shr_64.o" //go:cgo_import_dynamic libc_chdir chdir "libc.a/shr_64.o" //go:cgo_import_dynamic libc_chroot chroot "libc.a/shr_64.o" @@ -30,7 +31,6 @@ import ( //go:cgo_import_dynamic libc_fchmodat fchmodat "libc.a/shr_64.o" //go:cgo_import_dynamic libc_fchownat fchownat "libc.a/shr_64.o" //go:cgo_import_dynamic libc_fdatasync fdatasync "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fsync fsync "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getpgid getpgid "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getpgrp getpgrp "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getpid getpid "libc.a/shr_64.o" @@ -136,6 +136,7 @@ import ( //go:linkname libc_wait4 libc_wait4 //go:linkname libc_ioctl libc_ioctl //go:linkname libc_fcntl libc_fcntl +//go:linkname libc_fsync_range libc_fsync_range //go:linkname libc_acct libc_acct //go:linkname libc_chdir libc_chdir //go:linkname libc_chroot libc_chroot @@ -148,7 +149,6 @@ import ( //go:linkname libc_fchmodat libc_fchmodat //go:linkname libc_fchownat libc_fchownat //go:linkname libc_fdatasync libc_fdatasync -//go:linkname libc_fsync libc_fsync //go:linkname libc_getpgid libc_getpgid //go:linkname libc_getpgrp libc_getpgrp //go:linkname libc_getpid libc_getpid @@ -257,6 +257,7 @@ var ( libc_wait4, libc_ioctl, libc_fcntl, + libc_fsync_range, libc_acct, libc_chdir, libc_chroot, @@ -269,7 +270,6 @@ var ( libc_fchmodat, libc_fchownat, libc_fdatasync, - libc_fsync, libc_getpgid, libc_getpgrp, libc_getpid, @@ -430,6 +430,13 @@ func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func callfsync_range(fd int, how int, start int64, length int64) (r1 uintptr, e1 Errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fsync_range)), 4, uintptr(fd), uintptr(how), uintptr(start), uintptr(length), 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func callacct(_p0 uintptr) (r1 uintptr, e1 Errno) { r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_acct)), 1, _p0, 0, 0, 0, 0, 0) return @@ -514,13 +521,6 @@ func callfdatasync(fd int) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callfsync(fd int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fsync)), 1, uintptr(fd), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func callgetpgid(pid int) (r1 uintptr, e1 Errno) { r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index 3c260917e..944a714b1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -16,6 +16,7 @@ int getdirent(int, uintptr_t, size_t); int wait4(int, uintptr_t, int, uintptr_t); int ioctl(int, int, uintptr_t); int fcntl(uintptr_t, int, uintptr_t); +int fsync_range(int, int, long long, long long); int acct(uintptr_t); int chdir(uintptr_t); int chroot(uintptr_t); @@ -28,7 +29,6 @@ int fchmod(int, unsigned int); int fchmodat(int, uintptr_t, unsigned int, int); int fchownat(int, uintptr_t, int, int, int); int fdatasync(int); -int fsync(int); int getpgid(int); int getpgrp(); int getpid(); @@ -199,6 +199,14 @@ func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func callfsync_range(fd int, how int, start int64, length int64) (r1 uintptr, e1 Errno) { + r1 = uintptr(C.fsync_range(C.int(fd), C.int(how), C.longlong(start), C.longlong(length))) + e1 = syscall.GetErrno() + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func callacct(_p0 uintptr) (r1 uintptr, e1 Errno) { r1 = uintptr(C.acct(C.uintptr_t(_p0))) e1 = syscall.GetErrno() @@ -295,14 +303,6 @@ func callfdatasync(fd int) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callfsync(fd int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fsync(C.int(fd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func callgetpgid(pid int) (r1 uintptr, e1 Errno) { r1 = uintptr(C.getpgid(C.int(pid))) e1 = syscall.GetErrno() diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 4f5da1f54..93edda4c4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux @@ -409,6 +409,21 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func mountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr, size uintptr) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MOUNT_SETATTR, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(unsafe.Pointer(attr)), uintptr(size), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Acct(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index aa7ce85d1..31847d230 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -444,4 +444,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_MEMFD_SECRET = 447 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index b83032638..3503cbbde 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -366,4 +366,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_MEMFD_SECRET = 447 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index d75f65a0a..5ecd24bf6 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -7,6 +7,7 @@ package unix const ( + SYS_SYSCALL_MASK = 0 SYS_RESTART_SYSCALL = 0 SYS_EXIT = 1 SYS_FORK = 2 @@ -407,4 +408,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 8b02f09e9..7e5c94cc7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -311,4 +311,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_MEMFD_SECRET = 447 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 026695abb..e1e2a2bf5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -428,4 +428,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 4444 SYS_LANDLOCK_ADD_RULE = 4445 SYS_LANDLOCK_RESTRICT_SELF = 4446 + SYS_PROCESS_MRELEASE = 4448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 7320ba958..7651915a3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -358,4 +358,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 5444 SYS_LANDLOCK_ADD_RULE = 5445 SYS_LANDLOCK_RESTRICT_SELF = 5446 + SYS_PROCESS_MRELEASE = 5448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 45082dd67..a26a2c050 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -358,4 +358,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 5444 SYS_LANDLOCK_ADD_RULE = 5445 SYS_LANDLOCK_RESTRICT_SELF = 5446 + SYS_PROCESS_MRELEASE = 5448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 570a857a5..fda9a6a99 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -428,4 +428,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 4444 SYS_LANDLOCK_ADD_RULE = 4445 SYS_LANDLOCK_RESTRICT_SELF = 4446 + SYS_PROCESS_MRELEASE = 4448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index 638498d62..e8496150d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -435,4 +435,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index 702beebfe..5ee0678a3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -407,4 +407,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index bfc87ea44..29c0f9a39 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -407,4 +407,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index a390e147d..5c9a9a3b6 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -309,4 +309,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 3e791e6cd..913f50f98 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -372,4 +372,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 78802a5cf..0de03a722 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -386,4 +386,5 @@ const ( SYS_LANDLOCK_CREATE_RULESET = 444 SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_PROCESS_MRELEASE = 448 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 7efe5ccba..885842c0e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -641,13 +641,13 @@ type Eproc struct { Tdev int32 Tpgid int32 Tsess uintptr - Wmesg [8]int8 + Wmesg [8]byte Xsize int32 Xrssize int16 Xccount int16 Xswrss int16 Flag int32 - Login [12]int8 + Login [12]byte Spare [4]int32 _ [4]byte } @@ -688,7 +688,7 @@ type ExternProc struct { P_priority uint8 P_usrpri uint8 P_nice int8 - P_comm [17]int8 + P_comm [17]byte P_pgrp uintptr P_addr uintptr P_xstat uint16 diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index b23a2efe8..b23c02337 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -641,13 +641,13 @@ type Eproc struct { Tdev int32 Tpgid int32 Tsess uintptr - Wmesg [8]int8 + Wmesg [8]byte Xsize int32 Xrssize int16 Xccount int16 Xswrss int16 Flag int32 - Login [12]int8 + Login [12]byte Spare [4]int32 _ [4]byte } @@ -688,7 +688,7 @@ type ExternProc struct { P_priority uint8 P_usrpri uint8 P_nice int8 - P_comm [17]int8 + P_comm [17]byte P_pgrp uintptr P_addr uintptr P_xstat uint16 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 249ecfcd4..37b521436 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux @@ -743,6 +743,8 @@ const ( AT_STATX_FORCE_SYNC = 0x2000 AT_STATX_DONT_SYNC = 0x4000 + AT_RECURSIVE = 0x8000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 @@ -3264,7 +3266,8 @@ const ( LWTUNNEL_ENCAP_BPF = 0x6 LWTUNNEL_ENCAP_SEG6_LOCAL = 0x7 LWTUNNEL_ENCAP_RPL = 0x8 - LWTUNNEL_ENCAP_MAX = 0x8 + LWTUNNEL_ENCAP_IOAM6 = 0x9 + LWTUNNEL_ENCAP_MAX = 0x9 MPLS_IPTUNNEL_UNSPEC = 0x0 MPLS_IPTUNNEL_DST = 0x1 @@ -3617,7 +3620,9 @@ const ( ETHTOOL_A_COALESCE_TX_USECS_HIGH = 0x15 ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH = 0x16 ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17 - ETHTOOL_A_COALESCE_MAX = 0x17 + ETHTOOL_A_COALESCE_USE_CQE_MODE_TX = 0x18 + ETHTOOL_A_COALESCE_USE_CQE_MODE_RX = 0x19 + ETHTOOL_A_COALESCE_MAX = 0x19 ETHTOOL_A_PAUSE_UNSPEC = 0x0 ETHTOOL_A_PAUSE_HEADER = 0x1 ETHTOOL_A_PAUSE_AUTONEG = 0x2 @@ -3956,3 +3961,10 @@ const ( SHM_RDONLY = 0x1000 SHM_RND = 0x2000 ) + +type MountAttr struct { + Attr_set uint64 + Attr_clr uint64 + Propagation uint64 + Userns_fd uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index eeeb9aa39..bea254945 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index d30e1155c..b8c8f2894 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 69d029752..4db443016 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 28a0455bc..3ebcad8a8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 64a845483..3eb33e48a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index a1b7dee41..79a944672 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 936fa6a26..8f4b107ca 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 5dd546fbf..e4eb21798 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 947b32e43..d5b21f0f7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 2a606151b..5188d142b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index d0d735d02..de4dd4c73 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 95e3d6d06..dccbf9b06 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index cccf1ef26..635880610 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 44fcbe4e9..765edc13f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 2a8b1e6f7..baf5fe650 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -564,12 +564,11 @@ type Uvmexp struct { Kmapent int32 } -const SizeofClockinfo = 0x14 +const SizeofClockinfo = 0x10 type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 + Hz int32 + Tick int32 + Stathz int32 + Profhz int32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index b1759cf70..e21ae8ecf 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -564,12 +564,11 @@ type Uvmexp struct { Kmapent int32 } -const SizeofClockinfo = 0x14 +const SizeofClockinfo = 0x10 type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 + Hz int32 + Tick int32 + Stathz int32 + Profhz int32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index e807de206..f190651cd 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -565,12 +565,11 @@ type Uvmexp struct { Kmapent int32 } -const SizeofClockinfo = 0x14 +const SizeofClockinfo = 0x10 type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 + Hz int32 + Tick int32 + Stathz int32 + Profhz int32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go index ff3aecaee..84747c582 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go @@ -558,12 +558,11 @@ type Uvmexp struct { Kmapent int32 } -const SizeofClockinfo = 0x14 +const SizeofClockinfo = 0x10 type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 + Hz int32 + Tick int32 + Stathz int32 + Profhz int32 } diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go index 9ecda6917..ac5c8b637 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go @@ -558,12 +558,11 @@ type Uvmexp struct { Kmapent int32 } -const SizeofClockinfo = 0x14 +const SizeofClockinfo = 0x10 type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 + Hz int32 + Tick int32 + Stathz int32 + Profhz int32 } diff --git a/vendor/golang.org/x/sys/windows/mksyscall.go b/vendor/golang.org/x/sys/windows/mksyscall.go index 610291098..8563f79c5 100644 --- a/vendor/golang.org/x/sys/windows/mksyscall.go +++ b/vendor/golang.org/x/sys/windows/mksyscall.go @@ -7,4 +7,4 @@ package windows -//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go +//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go setupapi_windows.go diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go index 5b28ae168..f8deca839 100644 --- a/vendor/golang.org/x/sys/windows/service.go +++ b/vendor/golang.org/x/sys/windows/service.go @@ -17,8 +17,6 @@ const ( SC_MANAGER_ALL_ACCESS = 0xf003f ) -//sys OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenSCManagerW - const ( SERVICE_KERNEL_DRIVER = 1 SERVICE_FILE_SYSTEM_DRIVER = 2 @@ -133,6 +131,14 @@ const ( SC_EVENT_DATABASE_CHANGE = 0 SC_EVENT_PROPERTY_CHANGE = 1 SC_EVENT_STATUS_CHANGE = 2 + + SERVICE_START_REASON_DEMAND = 0x00000001 + SERVICE_START_REASON_AUTO = 0x00000002 + SERVICE_START_REASON_TRIGGER = 0x00000004 + SERVICE_START_REASON_RESTART_ON_FAILURE = 0x00000008 + SERVICE_START_REASON_DELAYEDAUTO = 0x00000010 + + SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON = 1 ) type SERVICE_STATUS struct { @@ -217,6 +223,7 @@ type QUERY_SERVICE_LOCK_STATUS struct { LockDuration uint32 } +//sys OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenSCManagerW //sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle //sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW //sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW @@ -237,3 +244,4 @@ type QUERY_SERVICE_LOCK_STATUS struct { //sys SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) = sechost.SubscribeServiceChangeNotifications? //sys UnsubscribeServiceChangeNotifications(subscription uintptr) = sechost.UnsubscribeServiceChangeNotifications? //sys RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) = advapi32.RegisterServiceCtrlHandlerExW +//sys QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) = advapi32.QueryServiceDynamicInformation? diff --git a/vendor/golang.org/x/sys/windows/setupapi_windows.go b/vendor/golang.org/x/sys/windows/setupapi_windows.go new file mode 100644 index 000000000..14027da3f --- /dev/null +++ b/vendor/golang.org/x/sys/windows/setupapi_windows.go @@ -0,0 +1,1425 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +import ( + "encoding/binary" + "errors" + "fmt" + "runtime" + "strings" + "syscall" + "unsafe" +) + +// This file contains functions that wrap SetupAPI.dll and CfgMgr32.dll, +// core system functions for managing hardware devices, drivers, and the PnP tree. +// Information about these APIs can be found at: +// https://docs.microsoft.com/en-us/windows-hardware/drivers/install/setupapi +// https://docs.microsoft.com/en-us/windows/win32/devinst/cfgmgr32- + +const ( + ERROR_EXPECTED_SECTION_NAME Errno = 0x20000000 | 0xC0000000 | 0 + ERROR_BAD_SECTION_NAME_LINE Errno = 0x20000000 | 0xC0000000 | 1 + ERROR_SECTION_NAME_TOO_LONG Errno = 0x20000000 | 0xC0000000 | 2 + ERROR_GENERAL_SYNTAX Errno = 0x20000000 | 0xC0000000 | 3 + ERROR_WRONG_INF_STYLE Errno = 0x20000000 | 0xC0000000 | 0x100 + ERROR_SECTION_NOT_FOUND Errno = 0x20000000 | 0xC0000000 | 0x101 + ERROR_LINE_NOT_FOUND Errno = 0x20000000 | 0xC0000000 | 0x102 + ERROR_NO_BACKUP Errno = 0x20000000 | 0xC0000000 | 0x103 + ERROR_NO_ASSOCIATED_CLASS Errno = 0x20000000 | 0xC0000000 | 0x200 + ERROR_CLASS_MISMATCH Errno = 0x20000000 | 0xC0000000 | 0x201 + ERROR_DUPLICATE_FOUND Errno = 0x20000000 | 0xC0000000 | 0x202 + ERROR_NO_DRIVER_SELECTED Errno = 0x20000000 | 0xC0000000 | 0x203 + ERROR_KEY_DOES_NOT_EXIST Errno = 0x20000000 | 0xC0000000 | 0x204 + ERROR_INVALID_DEVINST_NAME Errno = 0x20000000 | 0xC0000000 | 0x205 + ERROR_INVALID_CLASS Errno = 0x20000000 | 0xC0000000 | 0x206 + ERROR_DEVINST_ALREADY_EXISTS Errno = 0x20000000 | 0xC0000000 | 0x207 + ERROR_DEVINFO_NOT_REGISTERED Errno = 0x20000000 | 0xC0000000 | 0x208 + ERROR_INVALID_REG_PROPERTY Errno = 0x20000000 | 0xC0000000 | 0x209 + ERROR_NO_INF Errno = 0x20000000 | 0xC0000000 | 0x20A + ERROR_NO_SUCH_DEVINST Errno = 0x20000000 | 0xC0000000 | 0x20B + ERROR_CANT_LOAD_CLASS_ICON Errno = 0x20000000 | 0xC0000000 | 0x20C + ERROR_INVALID_CLASS_INSTALLER Errno = 0x20000000 | 0xC0000000 | 0x20D + ERROR_DI_DO_DEFAULT Errno = 0x20000000 | 0xC0000000 | 0x20E + ERROR_DI_NOFILECOPY Errno = 0x20000000 | 0xC0000000 | 0x20F + ERROR_INVALID_HWPROFILE Errno = 0x20000000 | 0xC0000000 | 0x210 + ERROR_NO_DEVICE_SELECTED Errno = 0x20000000 | 0xC0000000 | 0x211 + ERROR_DEVINFO_LIST_LOCKED Errno = 0x20000000 | 0xC0000000 | 0x212 + ERROR_DEVINFO_DATA_LOCKED Errno = 0x20000000 | 0xC0000000 | 0x213 + ERROR_DI_BAD_PATH Errno = 0x20000000 | 0xC0000000 | 0x214 + ERROR_NO_CLASSINSTALL_PARAMS Errno = 0x20000000 | 0xC0000000 | 0x215 + ERROR_FILEQUEUE_LOCKED Errno = 0x20000000 | 0xC0000000 | 0x216 + ERROR_BAD_SERVICE_INSTALLSECT Errno = 0x20000000 | 0xC0000000 | 0x217 + ERROR_NO_CLASS_DRIVER_LIST Errno = 0x20000000 | 0xC0000000 | 0x218 + ERROR_NO_ASSOCIATED_SERVICE Errno = 0x20000000 | 0xC0000000 | 0x219 + ERROR_NO_DEFAULT_DEVICE_INTERFACE Errno = 0x20000000 | 0xC0000000 | 0x21A + ERROR_DEVICE_INTERFACE_ACTIVE Errno = 0x20000000 | 0xC0000000 | 0x21B + ERROR_DEVICE_INTERFACE_REMOVED Errno = 0x20000000 | 0xC0000000 | 0x21C + ERROR_BAD_INTERFACE_INSTALLSECT Errno = 0x20000000 | 0xC0000000 | 0x21D + ERROR_NO_SUCH_INTERFACE_CLASS Errno = 0x20000000 | 0xC0000000 | 0x21E + ERROR_INVALID_REFERENCE_STRING Errno = 0x20000000 | 0xC0000000 | 0x21F + ERROR_INVALID_MACHINENAME Errno = 0x20000000 | 0xC0000000 | 0x220 + ERROR_REMOTE_COMM_FAILURE Errno = 0x20000000 | 0xC0000000 | 0x221 + ERROR_MACHINE_UNAVAILABLE Errno = 0x20000000 | 0xC0000000 | 0x222 + ERROR_NO_CONFIGMGR_SERVICES Errno = 0x20000000 | 0xC0000000 | 0x223 + ERROR_INVALID_PROPPAGE_PROVIDER Errno = 0x20000000 | 0xC0000000 | 0x224 + ERROR_NO_SUCH_DEVICE_INTERFACE Errno = 0x20000000 | 0xC0000000 | 0x225 + ERROR_DI_POSTPROCESSING_REQUIRED Errno = 0x20000000 | 0xC0000000 | 0x226 + ERROR_INVALID_COINSTALLER Errno = 0x20000000 | 0xC0000000 | 0x227 + ERROR_NO_COMPAT_DRIVERS Errno = 0x20000000 | 0xC0000000 | 0x228 + ERROR_NO_DEVICE_ICON Errno = 0x20000000 | 0xC0000000 | 0x229 + ERROR_INVALID_INF_LOGCONFIG Errno = 0x20000000 | 0xC0000000 | 0x22A + ERROR_DI_DONT_INSTALL Errno = 0x20000000 | 0xC0000000 | 0x22B + ERROR_INVALID_FILTER_DRIVER Errno = 0x20000000 | 0xC0000000 | 0x22C + ERROR_NON_WINDOWS_NT_DRIVER Errno = 0x20000000 | 0xC0000000 | 0x22D + ERROR_NON_WINDOWS_DRIVER Errno = 0x20000000 | 0xC0000000 | 0x22E + ERROR_NO_CATALOG_FOR_OEM_INF Errno = 0x20000000 | 0xC0000000 | 0x22F + ERROR_DEVINSTALL_QUEUE_NONNATIVE Errno = 0x20000000 | 0xC0000000 | 0x230 + ERROR_NOT_DISABLEABLE Errno = 0x20000000 | 0xC0000000 | 0x231 + ERROR_CANT_REMOVE_DEVINST Errno = 0x20000000 | 0xC0000000 | 0x232 + ERROR_INVALID_TARGET Errno = 0x20000000 | 0xC0000000 | 0x233 + ERROR_DRIVER_NONNATIVE Errno = 0x20000000 | 0xC0000000 | 0x234 + ERROR_IN_WOW64 Errno = 0x20000000 | 0xC0000000 | 0x235 + ERROR_SET_SYSTEM_RESTORE_POINT Errno = 0x20000000 | 0xC0000000 | 0x236 + ERROR_SCE_DISABLED Errno = 0x20000000 | 0xC0000000 | 0x238 + ERROR_UNKNOWN_EXCEPTION Errno = 0x20000000 | 0xC0000000 | 0x239 + ERROR_PNP_REGISTRY_ERROR Errno = 0x20000000 | 0xC0000000 | 0x23A + ERROR_REMOTE_REQUEST_UNSUPPORTED Errno = 0x20000000 | 0xC0000000 | 0x23B + ERROR_NOT_AN_INSTALLED_OEM_INF Errno = 0x20000000 | 0xC0000000 | 0x23C + ERROR_INF_IN_USE_BY_DEVICES Errno = 0x20000000 | 0xC0000000 | 0x23D + ERROR_DI_FUNCTION_OBSOLETE Errno = 0x20000000 | 0xC0000000 | 0x23E + ERROR_NO_AUTHENTICODE_CATALOG Errno = 0x20000000 | 0xC0000000 | 0x23F + ERROR_AUTHENTICODE_DISALLOWED Errno = 0x20000000 | 0xC0000000 | 0x240 + ERROR_AUTHENTICODE_TRUSTED_PUBLISHER Errno = 0x20000000 | 0xC0000000 | 0x241 + ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED Errno = 0x20000000 | 0xC0000000 | 0x242 + ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED Errno = 0x20000000 | 0xC0000000 | 0x243 + ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH Errno = 0x20000000 | 0xC0000000 | 0x244 + ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE Errno = 0x20000000 | 0xC0000000 | 0x245 + ERROR_DEVICE_INSTALLER_NOT_READY Errno = 0x20000000 | 0xC0000000 | 0x246 + ERROR_DRIVER_STORE_ADD_FAILED Errno = 0x20000000 | 0xC0000000 | 0x247 + ERROR_DEVICE_INSTALL_BLOCKED Errno = 0x20000000 | 0xC0000000 | 0x248 + ERROR_DRIVER_INSTALL_BLOCKED Errno = 0x20000000 | 0xC0000000 | 0x249 + ERROR_WRONG_INF_TYPE Errno = 0x20000000 | 0xC0000000 | 0x24A + ERROR_FILE_HASH_NOT_IN_CATALOG Errno = 0x20000000 | 0xC0000000 | 0x24B + ERROR_DRIVER_STORE_DELETE_FAILED Errno = 0x20000000 | 0xC0000000 | 0x24C + ERROR_UNRECOVERABLE_STACK_OVERFLOW Errno = 0x20000000 | 0xC0000000 | 0x300 + EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW Errno = ERROR_UNRECOVERABLE_STACK_OVERFLOW + ERROR_NO_DEFAULT_INTERFACE_DEVICE Errno = ERROR_NO_DEFAULT_DEVICE_INTERFACE + ERROR_INTERFACE_DEVICE_ACTIVE Errno = ERROR_DEVICE_INTERFACE_ACTIVE + ERROR_INTERFACE_DEVICE_REMOVED Errno = ERROR_DEVICE_INTERFACE_REMOVED + ERROR_NO_SUCH_INTERFACE_DEVICE Errno = ERROR_NO_SUCH_DEVICE_INTERFACE +) + +const ( + MAX_DEVICE_ID_LEN = 200 + MAX_DEVNODE_ID_LEN = MAX_DEVICE_ID_LEN + MAX_GUID_STRING_LEN = 39 // 38 chars + terminator null + MAX_CLASS_NAME_LEN = 32 + MAX_PROFILE_LEN = 80 + MAX_CONFIG_VALUE = 9999 + MAX_INSTANCE_VALUE = 9999 + CONFIGMG_VERSION = 0x0400 +) + +// Maximum string length constants +const ( + LINE_LEN = 256 // Windows 9x-compatible maximum for displayable strings coming from a device INF. + MAX_INF_STRING_LENGTH = 4096 // Actual maximum size of an INF string (including string substitutions). + MAX_INF_SECTION_NAME_LENGTH = 255 // For Windows 9x compatibility, INF section names should be constrained to 32 characters. + MAX_TITLE_LEN = 60 + MAX_INSTRUCTION_LEN = 256 + MAX_LABEL_LEN = 30 + MAX_SERVICE_NAME_LEN = 256 + MAX_SUBTITLE_LEN = 256 +) + +const ( + // SP_MAX_MACHINENAME_LENGTH defines maximum length of a machine name in the format expected by ConfigMgr32 CM_Connect_Machine (i.e., "\\\\MachineName\0"). + SP_MAX_MACHINENAME_LENGTH = MAX_PATH + 3 +) + +// HSPFILEQ is type for setup file queue +type HSPFILEQ uintptr + +// DevInfo holds reference to device information set +type DevInfo Handle + +// DEVINST is a handle usually recognized by cfgmgr32 APIs +type DEVINST uint32 + +// DevInfoData is a device information structure (references a device instance that is a member of a device information set) +type DevInfoData struct { + size uint32 + ClassGUID GUID + DevInst DEVINST + _ uintptr +} + +// DevInfoListDetailData is a structure for detailed information on a device information set (used for SetupDiGetDeviceInfoListDetail which supersedes the functionality of SetupDiGetDeviceInfoListClass). +type DevInfoListDetailData struct { + size uint32 // Use unsafeSizeOf method + ClassGUID GUID + RemoteMachineHandle Handle + remoteMachineName [SP_MAX_MACHINENAME_LENGTH]uint16 +} + +func (*DevInfoListDetailData) unsafeSizeOf() uint32 { + if unsafe.Sizeof(uintptr(0)) == 4 { + // Windows declares this with pshpack1.h + return uint32(unsafe.Offsetof(DevInfoListDetailData{}.remoteMachineName) + unsafe.Sizeof(DevInfoListDetailData{}.remoteMachineName)) + } + return uint32(unsafe.Sizeof(DevInfoListDetailData{})) +} + +func (data *DevInfoListDetailData) RemoteMachineName() string { + return UTF16ToString(data.remoteMachineName[:]) +} + +func (data *DevInfoListDetailData) SetRemoteMachineName(remoteMachineName string) error { + str, err := UTF16FromString(remoteMachineName) + if err != nil { + return err + } + copy(data.remoteMachineName[:], str) + return nil +} + +// DI_FUNCTION is function type for device installer +type DI_FUNCTION uint32 + +const ( + DIF_SELECTDEVICE DI_FUNCTION = 0x00000001 + DIF_INSTALLDEVICE DI_FUNCTION = 0x00000002 + DIF_ASSIGNRESOURCES DI_FUNCTION = 0x00000003 + DIF_PROPERTIES DI_FUNCTION = 0x00000004 + DIF_REMOVE DI_FUNCTION = 0x00000005 + DIF_FIRSTTIMESETUP DI_FUNCTION = 0x00000006 + DIF_FOUNDDEVICE DI_FUNCTION = 0x00000007 + DIF_SELECTCLASSDRIVERS DI_FUNCTION = 0x00000008 + DIF_VALIDATECLASSDRIVERS DI_FUNCTION = 0x00000009 + DIF_INSTALLCLASSDRIVERS DI_FUNCTION = 0x0000000A + DIF_CALCDISKSPACE DI_FUNCTION = 0x0000000B + DIF_DESTROYPRIVATEDATA DI_FUNCTION = 0x0000000C + DIF_VALIDATEDRIVER DI_FUNCTION = 0x0000000D + DIF_DETECT DI_FUNCTION = 0x0000000F + DIF_INSTALLWIZARD DI_FUNCTION = 0x00000010 + DIF_DESTROYWIZARDDATA DI_FUNCTION = 0x00000011 + DIF_PROPERTYCHANGE DI_FUNCTION = 0x00000012 + DIF_ENABLECLASS DI_FUNCTION = 0x00000013 + DIF_DETECTVERIFY DI_FUNCTION = 0x00000014 + DIF_INSTALLDEVICEFILES DI_FUNCTION = 0x00000015 + DIF_UNREMOVE DI_FUNCTION = 0x00000016 + DIF_SELECTBESTCOMPATDRV DI_FUNCTION = 0x00000017 + DIF_ALLOW_INSTALL DI_FUNCTION = 0x00000018 + DIF_REGISTERDEVICE DI_FUNCTION = 0x00000019 + DIF_NEWDEVICEWIZARD_PRESELECT DI_FUNCTION = 0x0000001A + DIF_NEWDEVICEWIZARD_SELECT DI_FUNCTION = 0x0000001B + DIF_NEWDEVICEWIZARD_PREANALYZE DI_FUNCTION = 0x0000001C + DIF_NEWDEVICEWIZARD_POSTANALYZE DI_FUNCTION = 0x0000001D + DIF_NEWDEVICEWIZARD_FINISHINSTALL DI_FUNCTION = 0x0000001E + DIF_INSTALLINTERFACES DI_FUNCTION = 0x00000020 + DIF_DETECTCANCEL DI_FUNCTION = 0x00000021 + DIF_REGISTER_COINSTALLERS DI_FUNCTION = 0x00000022 + DIF_ADDPROPERTYPAGE_ADVANCED DI_FUNCTION = 0x00000023 + DIF_ADDPROPERTYPAGE_BASIC DI_FUNCTION = 0x00000024 + DIF_TROUBLESHOOTER DI_FUNCTION = 0x00000026 + DIF_POWERMESSAGEWAKE DI_FUNCTION = 0x00000027 + DIF_ADDREMOTEPROPERTYPAGE_ADVANCED DI_FUNCTION = 0x00000028 + DIF_UPDATEDRIVER_UI DI_FUNCTION = 0x00000029 + DIF_FINISHINSTALL_ACTION DI_FUNCTION = 0x0000002A +) + +// DevInstallParams is device installation parameters structure (associated with a particular device information element, or globally with a device information set) +type DevInstallParams struct { + size uint32 + Flags DI_FLAGS + FlagsEx DI_FLAGSEX + hwndParent uintptr + InstallMsgHandler uintptr + InstallMsgHandlerContext uintptr + FileQueue HSPFILEQ + _ uintptr + _ uint32 + driverPath [MAX_PATH]uint16 +} + +func (params *DevInstallParams) DriverPath() string { + return UTF16ToString(params.driverPath[:]) +} + +func (params *DevInstallParams) SetDriverPath(driverPath string) error { + str, err := UTF16FromString(driverPath) + if err != nil { + return err + } + copy(params.driverPath[:], str) + return nil +} + +// DI_FLAGS is SP_DEVINSTALL_PARAMS.Flags values +type DI_FLAGS uint32 + +const ( + // Flags for choosing a device + DI_SHOWOEM DI_FLAGS = 0x00000001 // support Other... button + DI_SHOWCOMPAT DI_FLAGS = 0x00000002 // show compatibility list + DI_SHOWCLASS DI_FLAGS = 0x00000004 // show class list + DI_SHOWALL DI_FLAGS = 0x00000007 // both class & compat list shown + DI_NOVCP DI_FLAGS = 0x00000008 // don't create a new copy queue--use caller-supplied FileQueue + DI_DIDCOMPAT DI_FLAGS = 0x00000010 // Searched for compatible devices + DI_DIDCLASS DI_FLAGS = 0x00000020 // Searched for class devices + DI_AUTOASSIGNRES DI_FLAGS = 0x00000040 // No UI for resources if possible + + // Flags returned by DiInstallDevice to indicate need to reboot/restart + DI_NEEDRESTART DI_FLAGS = 0x00000080 // Reboot required to take effect + DI_NEEDREBOOT DI_FLAGS = 0x00000100 // "" + + // Flags for device installation + DI_NOBROWSE DI_FLAGS = 0x00000200 // no Browse... in InsertDisk + + // Flags set by DiBuildDriverInfoList + DI_MULTMFGS DI_FLAGS = 0x00000400 // Set if multiple manufacturers in class driver list + + // Flag indicates that device is disabled + DI_DISABLED DI_FLAGS = 0x00000800 // Set if device disabled + + // Flags for Device/Class Properties + DI_GENERALPAGE_ADDED DI_FLAGS = 0x00001000 + DI_RESOURCEPAGE_ADDED DI_FLAGS = 0x00002000 + + // Flag to indicate the setting properties for this Device (or class) caused a change so the Dev Mgr UI probably needs to be updated. + DI_PROPERTIES_CHANGE DI_FLAGS = 0x00004000 + + // Flag to indicate that the sorting from the INF file should be used. + DI_INF_IS_SORTED DI_FLAGS = 0x00008000 + + // Flag to indicate that only the the INF specified by SP_DEVINSTALL_PARAMS.DriverPath should be searched. + DI_ENUMSINGLEINF DI_FLAGS = 0x00010000 + + // Flag that prevents ConfigMgr from removing/re-enumerating devices during device + // registration, installation, and deletion. + DI_DONOTCALLCONFIGMG DI_FLAGS = 0x00020000 + + // The following flag can be used to install a device disabled + DI_INSTALLDISABLED DI_FLAGS = 0x00040000 + + // Flag that causes SetupDiBuildDriverInfoList to build a device's compatible driver + // list from its existing class driver list, instead of the normal INF search. + DI_COMPAT_FROM_CLASS DI_FLAGS = 0x00080000 + + // This flag is set if the Class Install params should be used. + DI_CLASSINSTALLPARAMS DI_FLAGS = 0x00100000 + + // This flag is set if the caller of DiCallClassInstaller does NOT want the internal default action performed if the Class installer returns ERROR_DI_DO_DEFAULT. + DI_NODI_DEFAULTACTION DI_FLAGS = 0x00200000 + + // Flags for device installation + DI_QUIETINSTALL DI_FLAGS = 0x00800000 // don't confuse the user with questions or excess info + DI_NOFILECOPY DI_FLAGS = 0x01000000 // No file Copy necessary + DI_FORCECOPY DI_FLAGS = 0x02000000 // Force files to be copied from install path + DI_DRIVERPAGE_ADDED DI_FLAGS = 0x04000000 // Prop provider added Driver page. + DI_USECI_SELECTSTRINGS DI_FLAGS = 0x08000000 // Use Class Installer Provided strings in the Select Device Dlg + DI_OVERRIDE_INFFLAGS DI_FLAGS = 0x10000000 // Override INF flags + DI_PROPS_NOCHANGEUSAGE DI_FLAGS = 0x20000000 // No Enable/Disable in General Props + + DI_NOSELECTICONS DI_FLAGS = 0x40000000 // No small icons in select device dialogs + + DI_NOWRITE_IDS DI_FLAGS = 0x80000000 // Don't write HW & Compat IDs on install +) + +// DI_FLAGSEX is SP_DEVINSTALL_PARAMS.FlagsEx values +type DI_FLAGSEX uint32 + +const ( + DI_FLAGSEX_CI_FAILED DI_FLAGSEX = 0x00000004 // Failed to Load/Call class installer + DI_FLAGSEX_FINISHINSTALL_ACTION DI_FLAGSEX = 0x00000008 // Class/co-installer wants to get a DIF_FINISH_INSTALL action in client context. + DI_FLAGSEX_DIDINFOLIST DI_FLAGSEX = 0x00000010 // Did the Class Info List + DI_FLAGSEX_DIDCOMPATINFO DI_FLAGSEX = 0x00000020 // Did the Compat Info List + DI_FLAGSEX_FILTERCLASSES DI_FLAGSEX = 0x00000040 + DI_FLAGSEX_SETFAILEDINSTALL DI_FLAGSEX = 0x00000080 + DI_FLAGSEX_DEVICECHANGE DI_FLAGSEX = 0x00000100 + DI_FLAGSEX_ALWAYSWRITEIDS DI_FLAGSEX = 0x00000200 + DI_FLAGSEX_PROPCHANGE_PENDING DI_FLAGSEX = 0x00000400 // One or more device property sheets have had changes made to them, and need to have a DIF_PROPERTYCHANGE occur. + DI_FLAGSEX_ALLOWEXCLUDEDDRVS DI_FLAGSEX = 0x00000800 + DI_FLAGSEX_NOUIONQUERYREMOVE DI_FLAGSEX = 0x00001000 + DI_FLAGSEX_USECLASSFORCOMPAT DI_FLAGSEX = 0x00002000 // Use the device's class when building compat drv list. (Ignored if DI_COMPAT_FROM_CLASS flag is specified.) + DI_FLAGSEX_NO_DRVREG_MODIFY DI_FLAGSEX = 0x00008000 // Don't run AddReg and DelReg for device's software (driver) key. + DI_FLAGSEX_IN_SYSTEM_SETUP DI_FLAGSEX = 0x00010000 // Installation is occurring during initial system setup. + DI_FLAGSEX_INET_DRIVER DI_FLAGSEX = 0x00020000 // Driver came from Windows Update + DI_FLAGSEX_APPENDDRIVERLIST DI_FLAGSEX = 0x00040000 // Cause SetupDiBuildDriverInfoList to append a new driver list to an existing list. + DI_FLAGSEX_PREINSTALLBACKUP DI_FLAGSEX = 0x00080000 // not used + DI_FLAGSEX_BACKUPONREPLACE DI_FLAGSEX = 0x00100000 // not used + DI_FLAGSEX_DRIVERLIST_FROM_URL DI_FLAGSEX = 0x00200000 // build driver list from INF(s) retrieved from URL specified in SP_DEVINSTALL_PARAMS.DriverPath (empty string means Windows Update website) + DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS DI_FLAGSEX = 0x00800000 // Don't include old Internet drivers when building a driver list. Ignored on Windows Vista and later. + DI_FLAGSEX_POWERPAGE_ADDED DI_FLAGSEX = 0x01000000 // class installer added their own power page + DI_FLAGSEX_FILTERSIMILARDRIVERS DI_FLAGSEX = 0x02000000 // only include similar drivers in class list + DI_FLAGSEX_INSTALLEDDRIVER DI_FLAGSEX = 0x04000000 // only add the installed driver to the class or compat driver list. Used in calls to SetupDiBuildDriverInfoList + DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE DI_FLAGSEX = 0x08000000 // Don't remove identical driver nodes from the class list + DI_FLAGSEX_ALTPLATFORM_DRVSEARCH DI_FLAGSEX = 0x10000000 // Build driver list based on alternate platform information specified in associated file queue + DI_FLAGSEX_RESTART_DEVICE_ONLY DI_FLAGSEX = 0x20000000 // only restart the device drivers are being installed on as opposed to restarting all devices using those drivers. + DI_FLAGSEX_RECURSIVESEARCH DI_FLAGSEX = 0x40000000 // Tell SetupDiBuildDriverInfoList to do a recursive search + DI_FLAGSEX_SEARCH_PUBLISHED_INFS DI_FLAGSEX = 0x80000000 // Tell SetupDiBuildDriverInfoList to do a "published INF" search +) + +// ClassInstallHeader is the first member of any class install parameters structure. It contains the device installation request code that defines the format of the rest of the install parameters structure. +type ClassInstallHeader struct { + size uint32 + InstallFunction DI_FUNCTION +} + +func MakeClassInstallHeader(installFunction DI_FUNCTION) *ClassInstallHeader { + hdr := &ClassInstallHeader{InstallFunction: installFunction} + hdr.size = uint32(unsafe.Sizeof(*hdr)) + return hdr +} + +// DICS_STATE specifies values indicating a change in a device's state +type DICS_STATE uint32 + +const ( + DICS_ENABLE DICS_STATE = 0x00000001 // The device is being enabled. + DICS_DISABLE DICS_STATE = 0x00000002 // The device is being disabled. + DICS_PROPCHANGE DICS_STATE = 0x00000003 // The properties of the device have changed. + DICS_START DICS_STATE = 0x00000004 // The device is being started (if the request is for the currently active hardware profile). + DICS_STOP DICS_STATE = 0x00000005 // The device is being stopped. The driver stack will be unloaded and the CSCONFIGFLAG_DO_NOT_START flag will be set for the device. +) + +// DICS_FLAG specifies the scope of a device property change +type DICS_FLAG uint32 + +const ( + DICS_FLAG_GLOBAL DICS_FLAG = 0x00000001 // make change in all hardware profiles + DICS_FLAG_CONFIGSPECIFIC DICS_FLAG = 0x00000002 // make change in specified profile only + DICS_FLAG_CONFIGGENERAL DICS_FLAG = 0x00000004 // 1 or more hardware profile-specific changes to follow (obsolete) +) + +// PropChangeParams is a structure corresponding to a DIF_PROPERTYCHANGE install function. +type PropChangeParams struct { + ClassInstallHeader ClassInstallHeader + StateChange DICS_STATE + Scope DICS_FLAG + HwProfile uint32 +} + +// DI_REMOVEDEVICE specifies the scope of the device removal +type DI_REMOVEDEVICE uint32 + +const ( + DI_REMOVEDEVICE_GLOBAL DI_REMOVEDEVICE = 0x00000001 // Make this change in all hardware profiles. Remove information about the device from the registry. + DI_REMOVEDEVICE_CONFIGSPECIFIC DI_REMOVEDEVICE = 0x00000002 // Make this change to only the hardware profile specified by HwProfile. this flag only applies to root-enumerated devices. When Windows removes the device from the last hardware profile in which it was configured, Windows performs a global removal. +) + +// RemoveDeviceParams is a structure corresponding to a DIF_REMOVE install function. +type RemoveDeviceParams struct { + ClassInstallHeader ClassInstallHeader + Scope DI_REMOVEDEVICE + HwProfile uint32 +} + +// DrvInfoData is driver information structure (member of a driver info list that may be associated with a particular device instance, or (globally) with a device information set) +type DrvInfoData struct { + size uint32 + DriverType uint32 + _ uintptr + description [LINE_LEN]uint16 + mfgName [LINE_LEN]uint16 + providerName [LINE_LEN]uint16 + DriverDate Filetime + DriverVersion uint64 +} + +func (data *DrvInfoData) Description() string { + return UTF16ToString(data.description[:]) +} + +func (data *DrvInfoData) SetDescription(description string) error { + str, err := UTF16FromString(description) + if err != nil { + return err + } + copy(data.description[:], str) + return nil +} + +func (data *DrvInfoData) MfgName() string { + return UTF16ToString(data.mfgName[:]) +} + +func (data *DrvInfoData) SetMfgName(mfgName string) error { + str, err := UTF16FromString(mfgName) + if err != nil { + return err + } + copy(data.mfgName[:], str) + return nil +} + +func (data *DrvInfoData) ProviderName() string { + return UTF16ToString(data.providerName[:]) +} + +func (data *DrvInfoData) SetProviderName(providerName string) error { + str, err := UTF16FromString(providerName) + if err != nil { + return err + } + copy(data.providerName[:], str) + return nil +} + +// IsNewer method returns true if DrvInfoData date and version is newer than supplied parameters. +func (data *DrvInfoData) IsNewer(driverDate Filetime, driverVersion uint64) bool { + if data.DriverDate.HighDateTime > driverDate.HighDateTime { + return true + } + if data.DriverDate.HighDateTime < driverDate.HighDateTime { + return false + } + + if data.DriverDate.LowDateTime > driverDate.LowDateTime { + return true + } + if data.DriverDate.LowDateTime < driverDate.LowDateTime { + return false + } + + if data.DriverVersion > driverVersion { + return true + } + if data.DriverVersion < driverVersion { + return false + } + + return false +} + +// DrvInfoDetailData is driver information details structure (provides detailed information about a particular driver information structure) +type DrvInfoDetailData struct { + size uint32 // Use unsafeSizeOf method + InfDate Filetime + compatIDsOffset uint32 + compatIDsLength uint32 + _ uintptr + sectionName [LINE_LEN]uint16 + infFileName [MAX_PATH]uint16 + drvDescription [LINE_LEN]uint16 + hardwareID [1]uint16 +} + +func (*DrvInfoDetailData) unsafeSizeOf() uint32 { + if unsafe.Sizeof(uintptr(0)) == 4 { + // Windows declares this with pshpack1.h + return uint32(unsafe.Offsetof(DrvInfoDetailData{}.hardwareID) + unsafe.Sizeof(DrvInfoDetailData{}.hardwareID)) + } + return uint32(unsafe.Sizeof(DrvInfoDetailData{})) +} + +func (data *DrvInfoDetailData) SectionName() string { + return UTF16ToString(data.sectionName[:]) +} + +func (data *DrvInfoDetailData) InfFileName() string { + return UTF16ToString(data.infFileName[:]) +} + +func (data *DrvInfoDetailData) DrvDescription() string { + return UTF16ToString(data.drvDescription[:]) +} + +func (data *DrvInfoDetailData) HardwareID() string { + if data.compatIDsOffset > 1 { + bufW := data.getBuf() + return UTF16ToString(bufW[:wcslen(bufW)]) + } + + return "" +} + +func (data *DrvInfoDetailData) CompatIDs() []string { + a := make([]string, 0) + + if data.compatIDsLength > 0 { + bufW := data.getBuf() + bufW = bufW[data.compatIDsOffset : data.compatIDsOffset+data.compatIDsLength] + for i := 0; i < len(bufW); { + j := i + wcslen(bufW[i:]) + if i < j { + a = append(a, UTF16ToString(bufW[i:j])) + } + i = j + 1 + } + } + + return a +} + +func (data *DrvInfoDetailData) getBuf() []uint16 { + len := (data.size - uint32(unsafe.Offsetof(data.hardwareID))) / 2 + sl := struct { + addr *uint16 + len int + cap int + }{&data.hardwareID[0], int(len), int(len)} + return *(*[]uint16)(unsafe.Pointer(&sl)) +} + +// IsCompatible method tests if given hardware ID matches the driver or is listed on the compatible ID list. +func (data *DrvInfoDetailData) IsCompatible(hwid string) bool { + hwidLC := strings.ToLower(hwid) + if strings.ToLower(data.HardwareID()) == hwidLC { + return true + } + a := data.CompatIDs() + for i := range a { + if strings.ToLower(a[i]) == hwidLC { + return true + } + } + + return false +} + +// DICD flags control SetupDiCreateDeviceInfo +type DICD uint32 + +const ( + DICD_GENERATE_ID DICD = 0x00000001 + DICD_INHERIT_CLASSDRVS DICD = 0x00000002 +) + +// SUOI flags control SetupUninstallOEMInf +type SUOI uint32 + +const ( + SUOI_FORCEDELETE SUOI = 0x0001 +) + +// SPDIT flags to distinguish between class drivers and +// device drivers. (Passed in 'DriverType' parameter of +// driver information list APIs) +type SPDIT uint32 + +const ( + SPDIT_NODRIVER SPDIT = 0x00000000 + SPDIT_CLASSDRIVER SPDIT = 0x00000001 + SPDIT_COMPATDRIVER SPDIT = 0x00000002 +) + +// DIGCF flags control what is included in the device information set built by SetupDiGetClassDevs +type DIGCF uint32 + +const ( + DIGCF_DEFAULT DIGCF = 0x00000001 // only valid with DIGCF_DEVICEINTERFACE + DIGCF_PRESENT DIGCF = 0x00000002 + DIGCF_ALLCLASSES DIGCF = 0x00000004 + DIGCF_PROFILE DIGCF = 0x00000008 + DIGCF_DEVICEINTERFACE DIGCF = 0x00000010 +) + +// DIREG specifies values for SetupDiCreateDevRegKey, SetupDiOpenDevRegKey, and SetupDiDeleteDevRegKey. +type DIREG uint32 + +const ( + DIREG_DEV DIREG = 0x00000001 // Open/Create/Delete device key + DIREG_DRV DIREG = 0x00000002 // Open/Create/Delete driver key + DIREG_BOTH DIREG = 0x00000004 // Delete both driver and Device key +) + +// SPDRP specifies device registry property codes +// (Codes marked as read-only (R) may only be used for +// SetupDiGetDeviceRegistryProperty) +// +// These values should cover the same set of registry properties +// as defined by the CM_DRP codes in cfgmgr32.h. +// +// Note that SPDRP codes are zero based while CM_DRP codes are one based! +type SPDRP uint32 + +const ( + SPDRP_DEVICEDESC SPDRP = 0x00000000 // DeviceDesc (R/W) + SPDRP_HARDWAREID SPDRP = 0x00000001 // HardwareID (R/W) + SPDRP_COMPATIBLEIDS SPDRP = 0x00000002 // CompatibleIDs (R/W) + SPDRP_SERVICE SPDRP = 0x00000004 // Service (R/W) + SPDRP_CLASS SPDRP = 0x00000007 // Class (R--tied to ClassGUID) + SPDRP_CLASSGUID SPDRP = 0x00000008 // ClassGUID (R/W) + SPDRP_DRIVER SPDRP = 0x00000009 // Driver (R/W) + SPDRP_CONFIGFLAGS SPDRP = 0x0000000A // ConfigFlags (R/W) + SPDRP_MFG SPDRP = 0x0000000B // Mfg (R/W) + SPDRP_FRIENDLYNAME SPDRP = 0x0000000C // FriendlyName (R/W) + SPDRP_LOCATION_INFORMATION SPDRP = 0x0000000D // LocationInformation (R/W) + SPDRP_PHYSICAL_DEVICE_OBJECT_NAME SPDRP = 0x0000000E // PhysicalDeviceObjectName (R) + SPDRP_CAPABILITIES SPDRP = 0x0000000F // Capabilities (R) + SPDRP_UI_NUMBER SPDRP = 0x00000010 // UiNumber (R) + SPDRP_UPPERFILTERS SPDRP = 0x00000011 // UpperFilters (R/W) + SPDRP_LOWERFILTERS SPDRP = 0x00000012 // LowerFilters (R/W) + SPDRP_BUSTYPEGUID SPDRP = 0x00000013 // BusTypeGUID (R) + SPDRP_LEGACYBUSTYPE SPDRP = 0x00000014 // LegacyBusType (R) + SPDRP_BUSNUMBER SPDRP = 0x00000015 // BusNumber (R) + SPDRP_ENUMERATOR_NAME SPDRP = 0x00000016 // Enumerator Name (R) + SPDRP_SECURITY SPDRP = 0x00000017 // Security (R/W, binary form) + SPDRP_SECURITY_SDS SPDRP = 0x00000018 // Security (W, SDS form) + SPDRP_DEVTYPE SPDRP = 0x00000019 // Device Type (R/W) + SPDRP_EXCLUSIVE SPDRP = 0x0000001A // Device is exclusive-access (R/W) + SPDRP_CHARACTERISTICS SPDRP = 0x0000001B // Device Characteristics (R/W) + SPDRP_ADDRESS SPDRP = 0x0000001C // Device Address (R) + SPDRP_UI_NUMBER_DESC_FORMAT SPDRP = 0x0000001D // UiNumberDescFormat (R/W) + SPDRP_DEVICE_POWER_DATA SPDRP = 0x0000001E // Device Power Data (R) + SPDRP_REMOVAL_POLICY SPDRP = 0x0000001F // Removal Policy (R) + SPDRP_REMOVAL_POLICY_HW_DEFAULT SPDRP = 0x00000020 // Hardware Removal Policy (R) + SPDRP_REMOVAL_POLICY_OVERRIDE SPDRP = 0x00000021 // Removal Policy Override (RW) + SPDRP_INSTALL_STATE SPDRP = 0x00000022 // Device Install State (R) + SPDRP_LOCATION_PATHS SPDRP = 0x00000023 // Device Location Paths (R) + SPDRP_BASE_CONTAINERID SPDRP = 0x00000024 // Base ContainerID (R) + + SPDRP_MAXIMUM_PROPERTY SPDRP = 0x00000025 // Upper bound on ordinals +) + +// DEVPROPTYPE represents the property-data-type identifier that specifies the +// data type of a device property value in the unified device property model. +type DEVPROPTYPE uint32 + +const ( + DEVPROP_TYPEMOD_ARRAY DEVPROPTYPE = 0x00001000 + DEVPROP_TYPEMOD_LIST DEVPROPTYPE = 0x00002000 + + DEVPROP_TYPE_EMPTY DEVPROPTYPE = 0x00000000 + DEVPROP_TYPE_NULL DEVPROPTYPE = 0x00000001 + DEVPROP_TYPE_SBYTE DEVPROPTYPE = 0x00000002 + DEVPROP_TYPE_BYTE DEVPROPTYPE = 0x00000003 + DEVPROP_TYPE_INT16 DEVPROPTYPE = 0x00000004 + DEVPROP_TYPE_UINT16 DEVPROPTYPE = 0x00000005 + DEVPROP_TYPE_INT32 DEVPROPTYPE = 0x00000006 + DEVPROP_TYPE_UINT32 DEVPROPTYPE = 0x00000007 + DEVPROP_TYPE_INT64 DEVPROPTYPE = 0x00000008 + DEVPROP_TYPE_UINT64 DEVPROPTYPE = 0x00000009 + DEVPROP_TYPE_FLOAT DEVPROPTYPE = 0x0000000A + DEVPROP_TYPE_DOUBLE DEVPROPTYPE = 0x0000000B + DEVPROP_TYPE_DECIMAL DEVPROPTYPE = 0x0000000C + DEVPROP_TYPE_GUID DEVPROPTYPE = 0x0000000D + DEVPROP_TYPE_CURRENCY DEVPROPTYPE = 0x0000000E + DEVPROP_TYPE_DATE DEVPROPTYPE = 0x0000000F + DEVPROP_TYPE_FILETIME DEVPROPTYPE = 0x00000010 + DEVPROP_TYPE_BOOLEAN DEVPROPTYPE = 0x00000011 + DEVPROP_TYPE_STRING DEVPROPTYPE = 0x00000012 + DEVPROP_TYPE_STRING_LIST DEVPROPTYPE = DEVPROP_TYPE_STRING | DEVPROP_TYPEMOD_LIST + DEVPROP_TYPE_SECURITY_DESCRIPTOR DEVPROPTYPE = 0x00000013 + DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING DEVPROPTYPE = 0x00000014 + DEVPROP_TYPE_DEVPROPKEY DEVPROPTYPE = 0x00000015 + DEVPROP_TYPE_DEVPROPTYPE DEVPROPTYPE = 0x00000016 + DEVPROP_TYPE_BINARY DEVPROPTYPE = DEVPROP_TYPE_BYTE | DEVPROP_TYPEMOD_ARRAY + DEVPROP_TYPE_ERROR DEVPROPTYPE = 0x00000017 + DEVPROP_TYPE_NTSTATUS DEVPROPTYPE = 0x00000018 + DEVPROP_TYPE_STRING_INDIRECT DEVPROPTYPE = 0x00000019 + + MAX_DEVPROP_TYPE DEVPROPTYPE = 0x00000019 + MAX_DEVPROP_TYPEMOD DEVPROPTYPE = 0x00002000 + + DEVPROP_MASK_TYPE DEVPROPTYPE = 0x00000FFF + DEVPROP_MASK_TYPEMOD DEVPROPTYPE = 0x0000F000 +) + +// DEVPROPGUID specifies a property category. +type DEVPROPGUID GUID + +// DEVPROPID uniquely identifies the property within the property category. +type DEVPROPID uint32 + +const DEVPROPID_FIRST_USABLE DEVPROPID = 2 + +// DEVPROPKEY represents a device property key for a device property in the +// unified device property model. +type DEVPROPKEY struct { + FmtID DEVPROPGUID + PID DEVPROPID +} + +// CONFIGRET is a return value or error code from cfgmgr32 APIs +type CONFIGRET uint32 + +func (ret CONFIGRET) Error() string { + if win32Error, ok := ret.Unwrap().(Errno); ok { + return fmt.Sprintf("%s (CfgMgr error: 0x%08x)", win32Error.Error(), uint32(ret)) + } + return fmt.Sprintf("CfgMgr error: 0x%08x", uint32(ret)) +} + +func (ret CONFIGRET) Win32Error(defaultError Errno) Errno { + return cm_MapCrToWin32Err(ret, defaultError) +} + +func (ret CONFIGRET) Unwrap() error { + const noMatch = Errno(^uintptr(0)) + win32Error := ret.Win32Error(noMatch) + if win32Error == noMatch { + return nil + } + return win32Error +} + +const ( + CR_SUCCESS CONFIGRET = 0x00000000 + CR_DEFAULT CONFIGRET = 0x00000001 + CR_OUT_OF_MEMORY CONFIGRET = 0x00000002 + CR_INVALID_POINTER CONFIGRET = 0x00000003 + CR_INVALID_FLAG CONFIGRET = 0x00000004 + CR_INVALID_DEVNODE CONFIGRET = 0x00000005 + CR_INVALID_DEVINST = CR_INVALID_DEVNODE + CR_INVALID_RES_DES CONFIGRET = 0x00000006 + CR_INVALID_LOG_CONF CONFIGRET = 0x00000007 + CR_INVALID_ARBITRATOR CONFIGRET = 0x00000008 + CR_INVALID_NODELIST CONFIGRET = 0x00000009 + CR_DEVNODE_HAS_REQS CONFIGRET = 0x0000000A + CR_DEVINST_HAS_REQS = CR_DEVNODE_HAS_REQS + CR_INVALID_RESOURCEID CONFIGRET = 0x0000000B + CR_DLVXD_NOT_FOUND CONFIGRET = 0x0000000C + CR_NO_SUCH_DEVNODE CONFIGRET = 0x0000000D + CR_NO_SUCH_DEVINST = CR_NO_SUCH_DEVNODE + CR_NO_MORE_LOG_CONF CONFIGRET = 0x0000000E + CR_NO_MORE_RES_DES CONFIGRET = 0x0000000F + CR_ALREADY_SUCH_DEVNODE CONFIGRET = 0x00000010 + CR_ALREADY_SUCH_DEVINST = CR_ALREADY_SUCH_DEVNODE + CR_INVALID_RANGE_LIST CONFIGRET = 0x00000011 + CR_INVALID_RANGE CONFIGRET = 0x00000012 + CR_FAILURE CONFIGRET = 0x00000013 + CR_NO_SUCH_LOGICAL_DEV CONFIGRET = 0x00000014 + CR_CREATE_BLOCKED CONFIGRET = 0x00000015 + CR_NOT_SYSTEM_VM CONFIGRET = 0x00000016 + CR_REMOVE_VETOED CONFIGRET = 0x00000017 + CR_APM_VETOED CONFIGRET = 0x00000018 + CR_INVALID_LOAD_TYPE CONFIGRET = 0x00000019 + CR_BUFFER_SMALL CONFIGRET = 0x0000001A + CR_NO_ARBITRATOR CONFIGRET = 0x0000001B + CR_NO_REGISTRY_HANDLE CONFIGRET = 0x0000001C + CR_REGISTRY_ERROR CONFIGRET = 0x0000001D + CR_INVALID_DEVICE_ID CONFIGRET = 0x0000001E + CR_INVALID_DATA CONFIGRET = 0x0000001F + CR_INVALID_API CONFIGRET = 0x00000020 + CR_DEVLOADER_NOT_READY CONFIGRET = 0x00000021 + CR_NEED_RESTART CONFIGRET = 0x00000022 + CR_NO_MORE_HW_PROFILES CONFIGRET = 0x00000023 + CR_DEVICE_NOT_THERE CONFIGRET = 0x00000024 + CR_NO_SUCH_VALUE CONFIGRET = 0x00000025 + CR_WRONG_TYPE CONFIGRET = 0x00000026 + CR_INVALID_PRIORITY CONFIGRET = 0x00000027 + CR_NOT_DISABLEABLE CONFIGRET = 0x00000028 + CR_FREE_RESOURCES CONFIGRET = 0x00000029 + CR_QUERY_VETOED CONFIGRET = 0x0000002A + CR_CANT_SHARE_IRQ CONFIGRET = 0x0000002B + CR_NO_DEPENDENT CONFIGRET = 0x0000002C + CR_SAME_RESOURCES CONFIGRET = 0x0000002D + CR_NO_SUCH_REGISTRY_KEY CONFIGRET = 0x0000002E + CR_INVALID_MACHINENAME CONFIGRET = 0x0000002F + CR_REMOTE_COMM_FAILURE CONFIGRET = 0x00000030 + CR_MACHINE_UNAVAILABLE CONFIGRET = 0x00000031 + CR_NO_CM_SERVICES CONFIGRET = 0x00000032 + CR_ACCESS_DENIED CONFIGRET = 0x00000033 + CR_CALL_NOT_IMPLEMENTED CONFIGRET = 0x00000034 + CR_INVALID_PROPERTY CONFIGRET = 0x00000035 + CR_DEVICE_INTERFACE_ACTIVE CONFIGRET = 0x00000036 + CR_NO_SUCH_DEVICE_INTERFACE CONFIGRET = 0x00000037 + CR_INVALID_REFERENCE_STRING CONFIGRET = 0x00000038 + CR_INVALID_CONFLICT_LIST CONFIGRET = 0x00000039 + CR_INVALID_INDEX CONFIGRET = 0x0000003A + CR_INVALID_STRUCTURE_SIZE CONFIGRET = 0x0000003B + NUM_CR_RESULTS CONFIGRET = 0x0000003C +) + +const ( + CM_GET_DEVICE_INTERFACE_LIST_PRESENT = 0 // only currently 'live' device interfaces + CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES = 1 // all registered device interfaces, live or not +) + +const ( + DN_ROOT_ENUMERATED = 0x00000001 // Was enumerated by ROOT + DN_DRIVER_LOADED = 0x00000002 // Has Register_Device_Driver + DN_ENUM_LOADED = 0x00000004 // Has Register_Enumerator + DN_STARTED = 0x00000008 // Is currently configured + DN_MANUAL = 0x00000010 // Manually installed + DN_NEED_TO_ENUM = 0x00000020 // May need reenumeration + DN_NOT_FIRST_TIME = 0x00000040 // Has received a config + DN_HARDWARE_ENUM = 0x00000080 // Enum generates hardware ID + DN_LIAR = 0x00000100 // Lied about can reconfig once + DN_HAS_MARK = 0x00000200 // Not CM_Create_DevInst lately + DN_HAS_PROBLEM = 0x00000400 // Need device installer + DN_FILTERED = 0x00000800 // Is filtered + DN_MOVED = 0x00001000 // Has been moved + DN_DISABLEABLE = 0x00002000 // Can be disabled + DN_REMOVABLE = 0x00004000 // Can be removed + DN_PRIVATE_PROBLEM = 0x00008000 // Has a private problem + DN_MF_PARENT = 0x00010000 // Multi function parent + DN_MF_CHILD = 0x00020000 // Multi function child + DN_WILL_BE_REMOVED = 0x00040000 // DevInst is being removed + DN_NOT_FIRST_TIMEE = 0x00080000 // Has received a config enumerate + DN_STOP_FREE_RES = 0x00100000 // When child is stopped, free resources + DN_REBAL_CANDIDATE = 0x00200000 // Don't skip during rebalance + DN_BAD_PARTIAL = 0x00400000 // This devnode's log_confs do not have same resources + DN_NT_ENUMERATOR = 0x00800000 // This devnode's is an NT enumerator + DN_NT_DRIVER = 0x01000000 // This devnode's is an NT driver + DN_NEEDS_LOCKING = 0x02000000 // Devnode need lock resume processing + DN_ARM_WAKEUP = 0x04000000 // Devnode can be the wakeup device + DN_APM_ENUMERATOR = 0x08000000 // APM aware enumerator + DN_APM_DRIVER = 0x10000000 // APM aware driver + DN_SILENT_INSTALL = 0x20000000 // Silent install + DN_NO_SHOW_IN_DM = 0x40000000 // No show in device manager + DN_BOOT_LOG_PROB = 0x80000000 // Had a problem during preassignment of boot log conf + DN_NEED_RESTART = DN_LIAR // System needs to be restarted for this Devnode to work properly + DN_DRIVER_BLOCKED = DN_NOT_FIRST_TIME // One or more drivers are blocked from loading for this Devnode + DN_LEGACY_DRIVER = DN_MOVED // This device is using a legacy driver + DN_CHILD_WITH_INVALID_ID = DN_HAS_MARK // One or more children have invalid IDs + DN_DEVICE_DISCONNECTED = DN_NEEDS_LOCKING // The function driver for a device reported that the device is not connected. Typically this means a wireless device is out of range. + DN_QUERY_REMOVE_PENDING = DN_MF_PARENT // Device is part of a set of related devices collectively pending query-removal + DN_QUERY_REMOVE_ACTIVE = DN_MF_CHILD // Device is actively engaged in a query-remove IRP + DN_CHANGEABLE_FLAGS = DN_NOT_FIRST_TIME | DN_HARDWARE_ENUM | DN_HAS_MARK | DN_DISABLEABLE | DN_REMOVABLE | DN_MF_CHILD | DN_MF_PARENT | DN_NOT_FIRST_TIMEE | DN_STOP_FREE_RES | DN_REBAL_CANDIDATE | DN_NT_ENUMERATOR | DN_NT_DRIVER | DN_SILENT_INSTALL | DN_NO_SHOW_IN_DM +) + +//sys setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) [failretval==DevInfo(InvalidHandle)] = setupapi.SetupDiCreateDeviceInfoListExW + +// SetupDiCreateDeviceInfoListEx function creates an empty device information set on a remote or a local computer and optionally associates the set with a device setup class. +func SetupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName string) (deviceInfoSet DevInfo, err error) { + var machineNameUTF16 *uint16 + if machineName != "" { + machineNameUTF16, err = UTF16PtrFromString(machineName) + if err != nil { + return + } + } + return setupDiCreateDeviceInfoListEx(classGUID, hwndParent, machineNameUTF16, 0) +} + +//sys setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) = setupapi.SetupDiGetDeviceInfoListDetailW + +// SetupDiGetDeviceInfoListDetail function retrieves information associated with a device information set including the class GUID, remote computer handle, and remote computer name. +func SetupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo) (deviceInfoSetDetailData *DevInfoListDetailData, err error) { + data := &DevInfoListDetailData{} + data.size = data.unsafeSizeOf() + + return data, setupDiGetDeviceInfoListDetail(deviceInfoSet, data) +} + +// DeviceInfoListDetail method retrieves information associated with a device information set including the class GUID, remote computer handle, and remote computer name. +func (deviceInfoSet DevInfo) DeviceInfoListDetail() (*DevInfoListDetailData, error) { + return SetupDiGetDeviceInfoListDetail(deviceInfoSet) +} + +//sys setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiCreateDeviceInfoW + +// SetupDiCreateDeviceInfo function creates a new device information element and adds it as a new member to the specified device information set. +func SetupDiCreateDeviceInfo(deviceInfoSet DevInfo, deviceName string, classGUID *GUID, deviceDescription string, hwndParent uintptr, creationFlags DICD) (deviceInfoData *DevInfoData, err error) { + deviceNameUTF16, err := UTF16PtrFromString(deviceName) + if err != nil { + return + } + + var deviceDescriptionUTF16 *uint16 + if deviceDescription != "" { + deviceDescriptionUTF16, err = UTF16PtrFromString(deviceDescription) + if err != nil { + return + } + } + + data := &DevInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiCreateDeviceInfo(deviceInfoSet, deviceNameUTF16, classGUID, deviceDescriptionUTF16, hwndParent, creationFlags, data) +} + +// CreateDeviceInfo method creates a new device information element and adds it as a new member to the specified device information set. +func (deviceInfoSet DevInfo) CreateDeviceInfo(deviceName string, classGUID *GUID, deviceDescription string, hwndParent uintptr, creationFlags DICD) (*DevInfoData, error) { + return SetupDiCreateDeviceInfo(deviceInfoSet, deviceName, classGUID, deviceDescription, hwndParent, creationFlags) +} + +//sys setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiEnumDeviceInfo + +// SetupDiEnumDeviceInfo function returns a DevInfoData structure that specifies a device information element in a device information set. +func SetupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex int) (*DevInfoData, error) { + data := &DevInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiEnumDeviceInfo(deviceInfoSet, uint32(memberIndex), data) +} + +// EnumDeviceInfo method returns a DevInfoData structure that specifies a device information element in a device information set. +func (deviceInfoSet DevInfo) EnumDeviceInfo(memberIndex int) (*DevInfoData, error) { + return SetupDiEnumDeviceInfo(deviceInfoSet, memberIndex) +} + +// SetupDiDestroyDeviceInfoList function deletes a device information set and frees all associated memory. +//sys SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) = setupapi.SetupDiDestroyDeviceInfoList + +// Close method deletes a device information set and frees all associated memory. +func (deviceInfoSet DevInfo) Close() error { + return SetupDiDestroyDeviceInfoList(deviceInfoSet) +} + +//sys SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) = setupapi.SetupDiBuildDriverInfoList + +// BuildDriverInfoList method builds a list of drivers that is associated with a specific device or with the global class driver list for a device information set. +func (deviceInfoSet DevInfo) BuildDriverInfoList(deviceInfoData *DevInfoData, driverType SPDIT) error { + return SetupDiBuildDriverInfoList(deviceInfoSet, deviceInfoData, driverType) +} + +//sys SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) = setupapi.SetupDiCancelDriverInfoSearch + +// CancelDriverInfoSearch method cancels a driver list search that is currently in progress in a different thread. +func (deviceInfoSet DevInfo) CancelDriverInfoSearch() error { + return SetupDiCancelDriverInfoSearch(deviceInfoSet) +} + +//sys setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) = setupapi.SetupDiEnumDriverInfoW + +// SetupDiEnumDriverInfo function enumerates the members of a driver list. +func SetupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex int) (*DrvInfoData, error) { + data := &DrvInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiEnumDriverInfo(deviceInfoSet, deviceInfoData, driverType, uint32(memberIndex), data) +} + +// EnumDriverInfo method enumerates the members of a driver list. +func (deviceInfoSet DevInfo) EnumDriverInfo(deviceInfoData *DevInfoData, driverType SPDIT, memberIndex int) (*DrvInfoData, error) { + return SetupDiEnumDriverInfo(deviceInfoSet, deviceInfoData, driverType, memberIndex) +} + +//sys setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) = setupapi.SetupDiGetSelectedDriverW + +// SetupDiGetSelectedDriver function retrieves the selected driver for a device information set or a particular device information element. +func SetupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (*DrvInfoData, error) { + data := &DrvInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiGetSelectedDriver(deviceInfoSet, deviceInfoData, data) +} + +// SelectedDriver method retrieves the selected driver for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) SelectedDriver(deviceInfoData *DevInfoData) (*DrvInfoData, error) { + return SetupDiGetSelectedDriver(deviceInfoSet, deviceInfoData) +} + +//sys SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) = setupapi.SetupDiSetSelectedDriverW + +// SetSelectedDriver method sets, or resets, the selected driver for a device information element or the selected class driver for a device information set. +func (deviceInfoSet DevInfo) SetSelectedDriver(deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) error { + return SetupDiSetSelectedDriver(deviceInfoSet, deviceInfoData, driverInfoData) +} + +//sys setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetDriverInfoDetailW + +// SetupDiGetDriverInfoDetail function retrieves driver information detail for a device information set or a particular device information element in the device information set. +func SetupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (*DrvInfoDetailData, error) { + reqSize := uint32(2048) + for { + buf := make([]byte, reqSize) + data := (*DrvInfoDetailData)(unsafe.Pointer(&buf[0])) + data.size = data.unsafeSizeOf() + err := setupDiGetDriverInfoDetail(deviceInfoSet, deviceInfoData, driverInfoData, data, uint32(len(buf)), &reqSize) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return nil, err + } + data.size = reqSize + return data, nil + } +} + +// DriverInfoDetail method retrieves driver information detail for a device information set or a particular device information element in the device information set. +func (deviceInfoSet DevInfo) DriverInfoDetail(deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (*DrvInfoDetailData, error) { + return SetupDiGetDriverInfoDetail(deviceInfoSet, deviceInfoData, driverInfoData) +} + +//sys SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) = setupapi.SetupDiDestroyDriverInfoList + +// DestroyDriverInfoList method deletes a driver list. +func (deviceInfoSet DevInfo) DestroyDriverInfoList(deviceInfoData *DevInfoData, driverType SPDIT) error { + return SetupDiDestroyDriverInfoList(deviceInfoSet, deviceInfoData, driverType) +} + +//sys setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) [failretval==DevInfo(InvalidHandle)] = setupapi.SetupDiGetClassDevsExW + +// SetupDiGetClassDevsEx function returns a handle to a device information set that contains requested device information elements for a local or a remote computer. +func SetupDiGetClassDevsEx(classGUID *GUID, enumerator string, hwndParent uintptr, flags DIGCF, deviceInfoSet DevInfo, machineName string) (handle DevInfo, err error) { + var enumeratorUTF16 *uint16 + if enumerator != "" { + enumeratorUTF16, err = UTF16PtrFromString(enumerator) + if err != nil { + return + } + } + var machineNameUTF16 *uint16 + if machineName != "" { + machineNameUTF16, err = UTF16PtrFromString(machineName) + if err != nil { + return + } + } + return setupDiGetClassDevsEx(classGUID, enumeratorUTF16, hwndParent, flags, deviceInfoSet, machineNameUTF16, 0) +} + +// SetupDiCallClassInstaller function calls the appropriate class installer, and any registered co-installers, with the specified installation request (DIF code). +//sys SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiCallClassInstaller + +// CallClassInstaller member calls the appropriate class installer, and any registered co-installers, with the specified installation request (DIF code). +func (deviceInfoSet DevInfo) CallClassInstaller(installFunction DI_FUNCTION, deviceInfoData *DevInfoData) error { + return SetupDiCallClassInstaller(installFunction, deviceInfoSet, deviceInfoData) +} + +// SetupDiOpenDevRegKey function opens a registry key for device-specific configuration information. +//sys SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) [failretval==InvalidHandle] = setupapi.SetupDiOpenDevRegKey + +// OpenDevRegKey method opens a registry key for device-specific configuration information. +func (deviceInfoSet DevInfo) OpenDevRegKey(DeviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (Handle, error) { + return SetupDiOpenDevRegKey(deviceInfoSet, DeviceInfoData, Scope, HwProfile, KeyType, samDesired) +} + +//sys setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) = setupapi.SetupDiGetDevicePropertyW + +// SetupDiGetDeviceProperty function retrieves a specified device instance property. +func SetupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY) (value interface{}, err error) { + reqSize := uint32(256) + for { + var dataType DEVPROPTYPE + buf := make([]byte, reqSize) + err = setupDiGetDeviceProperty(deviceInfoSet, deviceInfoData, propertyKey, &dataType, &buf[0], uint32(len(buf)), &reqSize, 0) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return + } + switch dataType { + case DEVPROP_TYPE_STRING: + ret := UTF16ToString(bufToUTF16(buf)) + runtime.KeepAlive(buf) + return ret, nil + } + return nil, errors.New("unimplemented property type") + } +} + +//sys setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetDeviceRegistryPropertyW + +// SetupDiGetDeviceRegistryProperty function retrieves a specified Plug and Play device property. +func SetupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP) (value interface{}, err error) { + reqSize := uint32(256) + for { + var dataType uint32 + buf := make([]byte, reqSize) + err = setupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, &dataType, &buf[0], uint32(len(buf)), &reqSize) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return + } + return getRegistryValue(buf[:reqSize], dataType) + } +} + +func getRegistryValue(buf []byte, dataType uint32) (interface{}, error) { + switch dataType { + case REG_SZ: + ret := UTF16ToString(bufToUTF16(buf)) + runtime.KeepAlive(buf) + return ret, nil + case REG_EXPAND_SZ: + value := UTF16ToString(bufToUTF16(buf)) + if value == "" { + return "", nil + } + p, err := syscall.UTF16PtrFromString(value) + if err != nil { + return "", err + } + ret := make([]uint16, 100) + for { + n, err := ExpandEnvironmentStrings(p, &ret[0], uint32(len(ret))) + if err != nil { + return "", err + } + if n <= uint32(len(ret)) { + return UTF16ToString(ret[:n]), nil + } + ret = make([]uint16, n) + } + case REG_BINARY: + return buf, nil + case REG_DWORD_LITTLE_ENDIAN: + return binary.LittleEndian.Uint32(buf), nil + case REG_DWORD_BIG_ENDIAN: + return binary.BigEndian.Uint32(buf), nil + case REG_MULTI_SZ: + bufW := bufToUTF16(buf) + a := []string{} + for i := 0; i < len(bufW); { + j := i + wcslen(bufW[i:]) + if i < j { + a = append(a, UTF16ToString(bufW[i:j])) + } + i = j + 1 + } + runtime.KeepAlive(buf) + return a, nil + case REG_QWORD_LITTLE_ENDIAN: + return binary.LittleEndian.Uint64(buf), nil + default: + return nil, fmt.Errorf("Unsupported registry value type: %v", dataType) + } +} + +// bufToUTF16 function reinterprets []byte buffer as []uint16 +func bufToUTF16(buf []byte) []uint16 { + sl := struct { + addr *uint16 + len int + cap int + }{(*uint16)(unsafe.Pointer(&buf[0])), len(buf) / 2, cap(buf) / 2} + return *(*[]uint16)(unsafe.Pointer(&sl)) +} + +// utf16ToBuf function reinterprets []uint16 as []byte +func utf16ToBuf(buf []uint16) []byte { + sl := struct { + addr *byte + len int + cap int + }{(*byte)(unsafe.Pointer(&buf[0])), len(buf) * 2, cap(buf) * 2} + return *(*[]byte)(unsafe.Pointer(&sl)) +} + +func wcslen(str []uint16) int { + for i := 0; i < len(str); i++ { + if str[i] == 0 { + return i + } + } + return len(str) +} + +// DeviceRegistryProperty method retrieves a specified Plug and Play device property. +func (deviceInfoSet DevInfo) DeviceRegistryProperty(deviceInfoData *DevInfoData, property SPDRP) (interface{}, error) { + return SetupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property) +} + +//sys setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) = setupapi.SetupDiSetDeviceRegistryPropertyW + +// SetupDiSetDeviceRegistryProperty function sets a Plug and Play device property for a device. +func SetupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffers []byte) error { + return setupDiSetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, &propertyBuffers[0], uint32(len(propertyBuffers))) +} + +// SetDeviceRegistryProperty function sets a Plug and Play device property for a device. +func (deviceInfoSet DevInfo) SetDeviceRegistryProperty(deviceInfoData *DevInfoData, property SPDRP, propertyBuffers []byte) error { + return SetupDiSetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, propertyBuffers) +} + +// SetDeviceRegistryPropertyString method sets a Plug and Play device property string for a device. +func (deviceInfoSet DevInfo) SetDeviceRegistryPropertyString(deviceInfoData *DevInfoData, property SPDRP, str string) error { + str16, err := UTF16FromString(str) + if err != nil { + return err + } + err = SetupDiSetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, utf16ToBuf(append(str16, 0))) + runtime.KeepAlive(str16) + return err +} + +//sys setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) = setupapi.SetupDiGetDeviceInstallParamsW + +// SetupDiGetDeviceInstallParams function retrieves device installation parameters for a device information set or a particular device information element. +func SetupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (*DevInstallParams, error) { + params := &DevInstallParams{} + params.size = uint32(unsafe.Sizeof(*params)) + + return params, setupDiGetDeviceInstallParams(deviceInfoSet, deviceInfoData, params) +} + +// DeviceInstallParams method retrieves device installation parameters for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) DeviceInstallParams(deviceInfoData *DevInfoData) (*DevInstallParams, error) { + return SetupDiGetDeviceInstallParams(deviceInfoSet, deviceInfoData) +} + +//sys setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) = setupapi.SetupDiGetDeviceInstanceIdW + +// SetupDiGetDeviceInstanceId function retrieves the instance ID of the device. +func SetupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (string, error) { + reqSize := uint32(1024) + for { + buf := make([]uint16, reqSize) + err := setupDiGetDeviceInstanceId(deviceInfoSet, deviceInfoData, &buf[0], uint32(len(buf)), &reqSize) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return "", err + } + return UTF16ToString(buf), nil + } +} + +// DeviceInstanceID method retrieves the instance ID of the device. +func (deviceInfoSet DevInfo) DeviceInstanceID(deviceInfoData *DevInfoData) (string, error) { + return SetupDiGetDeviceInstanceId(deviceInfoSet, deviceInfoData) +} + +// SetupDiGetClassInstallParams function retrieves class installation parameters for a device information set or a particular device information element. +//sys SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) = setupapi.SetupDiGetClassInstallParamsW + +// ClassInstallParams method retrieves class installation parameters for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) ClassInstallParams(deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) error { + return SetupDiGetClassInstallParams(deviceInfoSet, deviceInfoData, classInstallParams, classInstallParamsSize, requiredSize) +} + +//sys SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) = setupapi.SetupDiSetDeviceInstallParamsW + +// SetDeviceInstallParams member sets device installation parameters for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) SetDeviceInstallParams(deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) error { + return SetupDiSetDeviceInstallParams(deviceInfoSet, deviceInfoData, deviceInstallParams) +} + +// SetupDiSetClassInstallParams function sets or clears class install parameters for a device information set or a particular device information element. +//sys SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) = setupapi.SetupDiSetClassInstallParamsW + +// SetClassInstallParams method sets or clears class install parameters for a device information set or a particular device information element. +func (deviceInfoSet DevInfo) SetClassInstallParams(deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) error { + return SetupDiSetClassInstallParams(deviceInfoSet, deviceInfoData, classInstallParams, classInstallParamsSize) +} + +//sys setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) = setupapi.SetupDiClassNameFromGuidExW + +// SetupDiClassNameFromGuidEx function retrieves the class name associated with a class GUID. The class can be installed on a local or remote computer. +func SetupDiClassNameFromGuidEx(classGUID *GUID, machineName string) (className string, err error) { + var classNameUTF16 [MAX_CLASS_NAME_LEN]uint16 + + var machineNameUTF16 *uint16 + if machineName != "" { + machineNameUTF16, err = UTF16PtrFromString(machineName) + if err != nil { + return + } + } + + err = setupDiClassNameFromGuidEx(classGUID, &classNameUTF16[0], MAX_CLASS_NAME_LEN, nil, machineNameUTF16, 0) + if err != nil { + return + } + + className = UTF16ToString(classNameUTF16[:]) + return +} + +//sys setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) = setupapi.SetupDiClassGuidsFromNameExW + +// SetupDiClassGuidsFromNameEx function retrieves the GUIDs associated with the specified class name. This resulting list contains the classes currently installed on a local or remote computer. +func SetupDiClassGuidsFromNameEx(className string, machineName string) ([]GUID, error) { + classNameUTF16, err := UTF16PtrFromString(className) + if err != nil { + return nil, err + } + + var machineNameUTF16 *uint16 + if machineName != "" { + machineNameUTF16, err = UTF16PtrFromString(machineName) + if err != nil { + return nil, err + } + } + + reqSize := uint32(4) + for { + buf := make([]GUID, reqSize) + err = setupDiClassGuidsFromNameEx(classNameUTF16, &buf[0], uint32(len(buf)), &reqSize, machineNameUTF16, 0) + if err == ERROR_INSUFFICIENT_BUFFER { + continue + } + if err != nil { + return nil, err + } + return buf[:reqSize], nil + } +} + +//sys setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiGetSelectedDevice + +// SetupDiGetSelectedDevice function retrieves the selected device information element in a device information set. +func SetupDiGetSelectedDevice(deviceInfoSet DevInfo) (*DevInfoData, error) { + data := &DevInfoData{} + data.size = uint32(unsafe.Sizeof(*data)) + + return data, setupDiGetSelectedDevice(deviceInfoSet, data) +} + +// SelectedDevice method retrieves the selected device information element in a device information set. +func (deviceInfoSet DevInfo) SelectedDevice() (*DevInfoData, error) { + return SetupDiGetSelectedDevice(deviceInfoSet) +} + +// SetupDiSetSelectedDevice function sets a device information element as the selected member of a device information set. This function is typically used by an installation wizard. +//sys SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) = setupapi.SetupDiSetSelectedDevice + +// SetSelectedDevice method sets a device information element as the selected member of a device information set. This function is typically used by an installation wizard. +func (deviceInfoSet DevInfo) SetSelectedDevice(deviceInfoData *DevInfoData) error { + return SetupDiSetSelectedDevice(deviceInfoSet, deviceInfoData) +} + +//sys setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) = setupapi.SetupUninstallOEMInfW + +// SetupUninstallOEMInf uninstalls the specified driver. +func SetupUninstallOEMInf(infFileName string, flags SUOI) error { + infFileName16, err := UTF16PtrFromString(infFileName) + if err != nil { + return err + } + return setupUninstallOEMInf(infFileName16, flags, 0) +} + +//sys cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) = CfgMgr32.CM_MapCrToWin32Err + +//sys cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) = CfgMgr32.CM_Get_Device_Interface_List_SizeW +//sys cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) = CfgMgr32.CM_Get_Device_Interface_ListW + +func CM_Get_Device_Interface_List(deviceID string, interfaceClass *GUID, flags uint32) ([]string, error) { + deviceID16, err := UTF16PtrFromString(deviceID) + if err != nil { + return nil, err + } + var buf []uint16 + var buflen uint32 + for { + if ret := cm_Get_Device_Interface_List_Size(&buflen, interfaceClass, deviceID16, flags); ret != CR_SUCCESS { + return nil, ret + } + buf = make([]uint16, buflen) + if ret := cm_Get_Device_Interface_List(interfaceClass, deviceID16, &buf[0], buflen, flags); ret == CR_SUCCESS { + break + } else if ret != CR_BUFFER_SMALL { + return nil, ret + } + } + var interfaces []string + for i := 0; i < len(buf); { + j := i + wcslen(buf[i:]) + if i < j { + interfaces = append(interfaces, UTF16ToString(buf[i:j])) + } + i = j + 1 + } + if interfaces == nil { + return nil, ERROR_NO_SUCH_DEVICE_INTERFACE + } + return interfaces, nil +} + +//sys cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) = CfgMgr32.CM_Get_DevNode_Status + +func CM_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) error { + ret := cm_Get_DevNode_Status(status, problemNumber, devInst, flags) + if ret == CR_SUCCESS { + return nil + } + return ret +} diff --git a/vendor/golang.org/x/sys/windows/setupapierrors_windows.go b/vendor/golang.org/x/sys/windows/setupapierrors_windows.go deleted file mode 100644 index 1681810e0..000000000 --- a/vendor/golang.org/x/sys/windows/setupapierrors_windows.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -import "syscall" - -const ( - ERROR_EXPECTED_SECTION_NAME syscall.Errno = 0x20000000 | 0xC0000000 | 0 - ERROR_BAD_SECTION_NAME_LINE syscall.Errno = 0x20000000 | 0xC0000000 | 1 - ERROR_SECTION_NAME_TOO_LONG syscall.Errno = 0x20000000 | 0xC0000000 | 2 - ERROR_GENERAL_SYNTAX syscall.Errno = 0x20000000 | 0xC0000000 | 3 - ERROR_WRONG_INF_STYLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x100 - ERROR_SECTION_NOT_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x101 - ERROR_LINE_NOT_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x102 - ERROR_NO_BACKUP syscall.Errno = 0x20000000 | 0xC0000000 | 0x103 - ERROR_NO_ASSOCIATED_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x200 - ERROR_CLASS_MISMATCH syscall.Errno = 0x20000000 | 0xC0000000 | 0x201 - ERROR_DUPLICATE_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x202 - ERROR_NO_DRIVER_SELECTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x203 - ERROR_KEY_DOES_NOT_EXIST syscall.Errno = 0x20000000 | 0xC0000000 | 0x204 - ERROR_INVALID_DEVINST_NAME syscall.Errno = 0x20000000 | 0xC0000000 | 0x205 - ERROR_INVALID_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x206 - ERROR_DEVINST_ALREADY_EXISTS syscall.Errno = 0x20000000 | 0xC0000000 | 0x207 - ERROR_DEVINFO_NOT_REGISTERED syscall.Errno = 0x20000000 | 0xC0000000 | 0x208 - ERROR_INVALID_REG_PROPERTY syscall.Errno = 0x20000000 | 0xC0000000 | 0x209 - ERROR_NO_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x20A - ERROR_NO_SUCH_DEVINST syscall.Errno = 0x20000000 | 0xC0000000 | 0x20B - ERROR_CANT_LOAD_CLASS_ICON syscall.Errno = 0x20000000 | 0xC0000000 | 0x20C - ERROR_INVALID_CLASS_INSTALLER syscall.Errno = 0x20000000 | 0xC0000000 | 0x20D - ERROR_DI_DO_DEFAULT syscall.Errno = 0x20000000 | 0xC0000000 | 0x20E - ERROR_DI_NOFILECOPY syscall.Errno = 0x20000000 | 0xC0000000 | 0x20F - ERROR_INVALID_HWPROFILE syscall.Errno = 0x20000000 | 0xC0000000 | 0x210 - ERROR_NO_DEVICE_SELECTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x211 - ERROR_DEVINFO_LIST_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x212 - ERROR_DEVINFO_DATA_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x213 - ERROR_DI_BAD_PATH syscall.Errno = 0x20000000 | 0xC0000000 | 0x214 - ERROR_NO_CLASSINSTALL_PARAMS syscall.Errno = 0x20000000 | 0xC0000000 | 0x215 - ERROR_FILEQUEUE_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x216 - ERROR_BAD_SERVICE_INSTALLSECT syscall.Errno = 0x20000000 | 0xC0000000 | 0x217 - ERROR_NO_CLASS_DRIVER_LIST syscall.Errno = 0x20000000 | 0xC0000000 | 0x218 - ERROR_NO_ASSOCIATED_SERVICE syscall.Errno = 0x20000000 | 0xC0000000 | 0x219 - ERROR_NO_DEFAULT_DEVICE_INTERFACE syscall.Errno = 0x20000000 | 0xC0000000 | 0x21A - ERROR_DEVICE_INTERFACE_ACTIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x21B - ERROR_DEVICE_INTERFACE_REMOVED syscall.Errno = 0x20000000 | 0xC0000000 | 0x21C - ERROR_BAD_INTERFACE_INSTALLSECT syscall.Errno = 0x20000000 | 0xC0000000 | 0x21D - ERROR_NO_SUCH_INTERFACE_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x21E - ERROR_INVALID_REFERENCE_STRING syscall.Errno = 0x20000000 | 0xC0000000 | 0x21F - ERROR_INVALID_MACHINENAME syscall.Errno = 0x20000000 | 0xC0000000 | 0x220 - ERROR_REMOTE_COMM_FAILURE syscall.Errno = 0x20000000 | 0xC0000000 | 0x221 - ERROR_MACHINE_UNAVAILABLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x222 - ERROR_NO_CONFIGMGR_SERVICES syscall.Errno = 0x20000000 | 0xC0000000 | 0x223 - ERROR_INVALID_PROPPAGE_PROVIDER syscall.Errno = 0x20000000 | 0xC0000000 | 0x224 - ERROR_NO_SUCH_DEVICE_INTERFACE syscall.Errno = 0x20000000 | 0xC0000000 | 0x225 - ERROR_DI_POSTPROCESSING_REQUIRED syscall.Errno = 0x20000000 | 0xC0000000 | 0x226 - ERROR_INVALID_COINSTALLER syscall.Errno = 0x20000000 | 0xC0000000 | 0x227 - ERROR_NO_COMPAT_DRIVERS syscall.Errno = 0x20000000 | 0xC0000000 | 0x228 - ERROR_NO_DEVICE_ICON syscall.Errno = 0x20000000 | 0xC0000000 | 0x229 - ERROR_INVALID_INF_LOGCONFIG syscall.Errno = 0x20000000 | 0xC0000000 | 0x22A - ERROR_DI_DONT_INSTALL syscall.Errno = 0x20000000 | 0xC0000000 | 0x22B - ERROR_INVALID_FILTER_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22C - ERROR_NON_WINDOWS_NT_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22D - ERROR_NON_WINDOWS_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22E - ERROR_NO_CATALOG_FOR_OEM_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x22F - ERROR_DEVINSTALL_QUEUE_NONNATIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x230 - ERROR_NOT_DISABLEABLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x231 - ERROR_CANT_REMOVE_DEVINST syscall.Errno = 0x20000000 | 0xC0000000 | 0x232 - ERROR_INVALID_TARGET syscall.Errno = 0x20000000 | 0xC0000000 | 0x233 - ERROR_DRIVER_NONNATIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x234 - ERROR_IN_WOW64 syscall.Errno = 0x20000000 | 0xC0000000 | 0x235 - ERROR_SET_SYSTEM_RESTORE_POINT syscall.Errno = 0x20000000 | 0xC0000000 | 0x236 - ERROR_SCE_DISABLED syscall.Errno = 0x20000000 | 0xC0000000 | 0x238 - ERROR_UNKNOWN_EXCEPTION syscall.Errno = 0x20000000 | 0xC0000000 | 0x239 - ERROR_PNP_REGISTRY_ERROR syscall.Errno = 0x20000000 | 0xC0000000 | 0x23A - ERROR_REMOTE_REQUEST_UNSUPPORTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x23B - ERROR_NOT_AN_INSTALLED_OEM_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x23C - ERROR_INF_IN_USE_BY_DEVICES syscall.Errno = 0x20000000 | 0xC0000000 | 0x23D - ERROR_DI_FUNCTION_OBSOLETE syscall.Errno = 0x20000000 | 0xC0000000 | 0x23E - ERROR_NO_AUTHENTICODE_CATALOG syscall.Errno = 0x20000000 | 0xC0000000 | 0x23F - ERROR_AUTHENTICODE_DISALLOWED syscall.Errno = 0x20000000 | 0xC0000000 | 0x240 - ERROR_AUTHENTICODE_TRUSTED_PUBLISHER syscall.Errno = 0x20000000 | 0xC0000000 | 0x241 - ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED syscall.Errno = 0x20000000 | 0xC0000000 | 0x242 - ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x243 - ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH syscall.Errno = 0x20000000 | 0xC0000000 | 0x244 - ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE syscall.Errno = 0x20000000 | 0xC0000000 | 0x245 - ERROR_DEVICE_INSTALLER_NOT_READY syscall.Errno = 0x20000000 | 0xC0000000 | 0x246 - ERROR_DRIVER_STORE_ADD_FAILED syscall.Errno = 0x20000000 | 0xC0000000 | 0x247 - ERROR_DEVICE_INSTALL_BLOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x248 - ERROR_DRIVER_INSTALL_BLOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x249 - ERROR_WRONG_INF_TYPE syscall.Errno = 0x20000000 | 0xC0000000 | 0x24A - ERROR_FILE_HASH_NOT_IN_CATALOG syscall.Errno = 0x20000000 | 0xC0000000 | 0x24B - ERROR_DRIVER_STORE_DELETE_FAILED syscall.Errno = 0x20000000 | 0xC0000000 | 0x24C - ERROR_UNRECOVERABLE_STACK_OVERFLOW syscall.Errno = 0x20000000 | 0xC0000000 | 0x300 - EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW syscall.Errno = ERROR_UNRECOVERABLE_STACK_OVERFLOW - ERROR_NO_DEFAULT_INTERFACE_DEVICE syscall.Errno = ERROR_NO_DEFAULT_DEVICE_INTERFACE - ERROR_INTERFACE_DEVICE_ACTIVE syscall.Errno = ERROR_DEVICE_INTERFACE_ACTIVE - ERROR_INTERFACE_DEVICE_REMOVED syscall.Errno = ERROR_DEVICE_INTERFACE_REMOVED - ERROR_NO_SUCH_INTERFACE_DEVICE syscall.Errno = ERROR_NO_SUCH_DEVICE_INTERFACE -) diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 53ee74e08..7702bbb8d 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -248,6 +248,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys FreeEnvironmentStrings(envs *uint16) (err error) = kernel32.FreeEnvironmentStringsW //sys GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) = kernel32.GetEnvironmentVariableW //sys SetEnvironmentVariable(name *uint16, value *uint16) (err error) = kernel32.SetEnvironmentVariableW +//sys ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) = kernel32.ExpandEnvironmentStringsW //sys CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock //sys DestroyEnvironmentBlock(block *uint16) (err error) = userenv.DestroyEnvironmentBlock //sys getTickCount64() (ms uint64) = kernel32.GetTickCount64 @@ -893,9 +894,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, int32, error) { p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil } @@ -915,9 +914,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, int32, error) { p[0] = byte(sa.Port >> 8) p[1] = byte(sa.Port) sa.raw.Scope_id = sa.ZoneId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } + sa.raw.Addr = sa.Addr return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil } @@ -990,9 +987,7 @@ func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) { sa := new(SockaddrInet4) p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil case AF_INET6: @@ -1001,9 +996,7 @@ func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) { p := (*[2]byte)(unsafe.Pointer(&pp.Port)) sa.Port = int(p[0])<<8 + int(p[1]) sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } + sa.Addr = pp.Addr return sa, nil } return nil, syscall.EAFNOSUPPORT diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index ef3cfcfb2..bf0dd8fca 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -36,6 +36,7 @@ func errnoErr(e syscall.Errno) error { } var ( + modCfgMgr32 = NewLazySystemDLL("CfgMgr32.dll") modadvapi32 = NewLazySystemDLL("advapi32.dll") modcrypt32 = NewLazySystemDLL("crypt32.dll") moddnsapi = NewLazySystemDLL("dnsapi.dll") @@ -48,6 +49,7 @@ var ( modpsapi = NewLazySystemDLL("psapi.dll") modsechost = NewLazySystemDLL("sechost.dll") modsecur32 = NewLazySystemDLL("secur32.dll") + modsetupapi = NewLazySystemDLL("setupapi.dll") modshell32 = NewLazySystemDLL("shell32.dll") moduser32 = NewLazySystemDLL("user32.dll") moduserenv = NewLazySystemDLL("userenv.dll") @@ -56,6 +58,10 @@ var ( modws2_32 = NewLazySystemDLL("ws2_32.dll") modwtsapi32 = NewLazySystemDLL("wtsapi32.dll") + procCM_Get_DevNode_Status = modCfgMgr32.NewProc("CM_Get_DevNode_Status") + procCM_Get_Device_Interface_ListW = modCfgMgr32.NewProc("CM_Get_Device_Interface_ListW") + procCM_Get_Device_Interface_List_SizeW = modCfgMgr32.NewProc("CM_Get_Device_Interface_List_SizeW") + procCM_MapCrToWin32Err = modCfgMgr32.NewProc("CM_MapCrToWin32Err") procAdjustTokenGroups = modadvapi32.NewProc("AdjustTokenGroups") procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges") procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid") @@ -115,6 +121,7 @@ var ( procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken") procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W") procQueryServiceConfigW = modadvapi32.NewProc("QueryServiceConfigW") + procQueryServiceDynamicInformation = modadvapi32.NewProc("QueryServiceDynamicInformation") procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW") procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus") procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx") @@ -198,6 +205,7 @@ var ( procDeviceIoControl = modkernel32.NewProc("DeviceIoControl") procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") procExitProcess = modkernel32.NewProc("ExitProcess") + procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW") procFindClose = modkernel32.NewProc("FindClose") procFindCloseChangeNotification = modkernel32.NewProc("FindCloseChangeNotification") procFindFirstChangeNotificationW = modkernel32.NewProc("FindFirstChangeNotificationW") @@ -366,9 +374,9 @@ var ( procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo") procNtCreateFile = modntdll.NewProc("NtCreateFile") procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile") - procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile") procNtQueryInformationProcess = modntdll.NewProc("NtQueryInformationProcess") procNtQuerySystemInformation = modntdll.NewProc("NtQuerySystemInformation") + procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile") procNtSetInformationProcess = modntdll.NewProc("NtSetInformationProcess") procNtSetSystemInformation = modntdll.NewProc("NtSetSystemInformation") procRtlAddFunctionTable = modntdll.NewProc("RtlAddFunctionTable") @@ -399,6 +407,34 @@ var ( procUnsubscribeServiceChangeNotifications = modsechost.NewProc("UnsubscribeServiceChangeNotifications") procGetUserNameExW = modsecur32.NewProc("GetUserNameExW") procTranslateNameW = modsecur32.NewProc("TranslateNameW") + procSetupDiBuildDriverInfoList = modsetupapi.NewProc("SetupDiBuildDriverInfoList") + procSetupDiCallClassInstaller = modsetupapi.NewProc("SetupDiCallClassInstaller") + procSetupDiCancelDriverInfoSearch = modsetupapi.NewProc("SetupDiCancelDriverInfoSearch") + procSetupDiClassGuidsFromNameExW = modsetupapi.NewProc("SetupDiClassGuidsFromNameExW") + procSetupDiClassNameFromGuidExW = modsetupapi.NewProc("SetupDiClassNameFromGuidExW") + procSetupDiCreateDeviceInfoListExW = modsetupapi.NewProc("SetupDiCreateDeviceInfoListExW") + procSetupDiCreateDeviceInfoW = modsetupapi.NewProc("SetupDiCreateDeviceInfoW") + procSetupDiDestroyDeviceInfoList = modsetupapi.NewProc("SetupDiDestroyDeviceInfoList") + procSetupDiDestroyDriverInfoList = modsetupapi.NewProc("SetupDiDestroyDriverInfoList") + procSetupDiEnumDeviceInfo = modsetupapi.NewProc("SetupDiEnumDeviceInfo") + procSetupDiEnumDriverInfoW = modsetupapi.NewProc("SetupDiEnumDriverInfoW") + procSetupDiGetClassDevsExW = modsetupapi.NewProc("SetupDiGetClassDevsExW") + procSetupDiGetClassInstallParamsW = modsetupapi.NewProc("SetupDiGetClassInstallParamsW") + procSetupDiGetDeviceInfoListDetailW = modsetupapi.NewProc("SetupDiGetDeviceInfoListDetailW") + procSetupDiGetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiGetDeviceInstallParamsW") + procSetupDiGetDeviceInstanceIdW = modsetupapi.NewProc("SetupDiGetDeviceInstanceIdW") + procSetupDiGetDevicePropertyW = modsetupapi.NewProc("SetupDiGetDevicePropertyW") + procSetupDiGetDeviceRegistryPropertyW = modsetupapi.NewProc("SetupDiGetDeviceRegistryPropertyW") + procSetupDiGetDriverInfoDetailW = modsetupapi.NewProc("SetupDiGetDriverInfoDetailW") + procSetupDiGetSelectedDevice = modsetupapi.NewProc("SetupDiGetSelectedDevice") + procSetupDiGetSelectedDriverW = modsetupapi.NewProc("SetupDiGetSelectedDriverW") + procSetupDiOpenDevRegKey = modsetupapi.NewProc("SetupDiOpenDevRegKey") + procSetupDiSetClassInstallParamsW = modsetupapi.NewProc("SetupDiSetClassInstallParamsW") + procSetupDiSetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiSetDeviceInstallParamsW") + procSetupDiSetDeviceRegistryPropertyW = modsetupapi.NewProc("SetupDiSetDeviceRegistryPropertyW") + procSetupDiSetSelectedDevice = modsetupapi.NewProc("SetupDiSetSelectedDevice") + procSetupDiSetSelectedDriverW = modsetupapi.NewProc("SetupDiSetSelectedDriverW") + procSetupUninstallOEMInfW = modsetupapi.NewProc("SetupUninstallOEMInfW") procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW") procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath") procShellExecuteW = modshell32.NewProc("ShellExecuteW") @@ -446,6 +482,30 @@ var ( procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken") ) +func cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) { + r0, _, _ := syscall.Syscall6(procCM_Get_DevNode_Status.Addr(), 4, uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags), 0, 0) + ret = CONFIGRET(r0) + return +} + +func cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) { + r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_ListW.Addr(), 5, uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags), 0) + ret = CONFIGRET(r0) + return +} + +func cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) { + r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_List_SizeW.Addr(), 4, uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags), 0, 0) + ret = CONFIGRET(r0) + return +} + +func cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) { + r0, _, _ := syscall.Syscall(procCM_MapCrToWin32Err.Addr(), 2, uintptr(configRet), uintptr(defaultWin32Error), 0) + ret = Errno(r0) + return +} + func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) { var _p0 uint32 if resetToDefault { @@ -976,6 +1036,18 @@ func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, buf return } +func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) { + err = procQueryServiceDynamicInformation.Find() + if err != nil { + return + } + r1, _, e1 := syscall.Syscall(procQueryServiceDynamicInformation.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) if r1 == 0 { @@ -1703,6 +1775,15 @@ func ExitProcess(exitcode uint32) { return } +func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { + r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } + return +} + func FindClose(handle Handle) (err error) { r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { @@ -3171,24 +3252,24 @@ func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, i return } -func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0) +func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) { + r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0) if r0 != 0 { ntstatus = NTStatus(r0) } return } -func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0) +func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) { + r0, _, _ := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen)), 0, 0) if r0 != 0 { ntstatus = NTStatus(r0) } return } -func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) { - r0, _, _ := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen)), 0, 0) +func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) { + r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3419,6 +3500,233 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint return } +func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiBuildDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiCallClassInstaller.Addr(), 3, uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiCancelDriverInfoSearch.Addr(), 1, uintptr(deviceInfoSet), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procSetupDiClassGuidsFromNameExW.Addr(), 6, uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procSetupDiClassNameFromGuidExW.Addr(), 6, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { + r0, _, e1 := syscall.Syscall6(procSetupDiCreateDeviceInfoListExW.Addr(), 4, uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0) + handle = DevInfo(r0) + if handle == DevInfo(InvalidHandle) { + err = errnoErr(e1) + } + return +} + +func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.Syscall9(procSetupDiCreateDeviceInfoW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiDestroyDeviceInfoList.Addr(), 1, uintptr(deviceInfoSet), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiDestroyDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiEnumDeviceInfo.Addr(), 3, uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) { + r1, _, e1 := syscall.Syscall6(procSetupDiEnumDriverInfoW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { + r0, _, e1 := syscall.Syscall9(procSetupDiGetClassDevsExW.Addr(), 7, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0) + handle = DevInfo(r0) + if handle == DevInfo(InvalidHandle) { + err = errnoErr(e1) + } + return +} + +func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetupDiGetClassInstallParamsW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInfoListDetailW.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetupDiGetDeviceInstanceIdW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) { + r1, _, e1 := syscall.Syscall9(procSetupDiGetDevicePropertyW.Addr(), 8, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall9(procSetupDiGetDeviceRegistryPropertyW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetupDiGetDriverInfoDetailW.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) { + r0, _, e1 := syscall.Syscall6(procSetupDiOpenDevRegKey.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired)) + key = Handle(r0) + if key == InvalidHandle { + err = errnoErr(e1) + } + return +} + +func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetupDiSetClassInstallParamsW.Addr(), 4, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiSetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetupDiSetDeviceRegistryPropertyW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { + r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + +func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procSetupUninstallOEMInfW.Addr(), 3, uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved)) + if r1 == 0 { + err = errnoErr(e1) + } + return +} + func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go index fc8beea5d..cec819d64 100644 --- a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go +++ b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go @@ -50,11 +50,24 @@ func Find(importPath, srcDir string) (filename, path string) { // additional trailing data beyond the end of the export data. func NewReader(r io.Reader) (io.Reader, error) { buf := bufio.NewReader(r) - _, err := gcimporter.FindExportData(buf) - // If we ever switch to a zip-like archive format with the ToC - // at the end, we can return the correct portion of export data, - // but for now we must return the entire rest of the file. - return buf, err + _, size, err := gcimporter.FindExportData(buf) + if err != nil { + return nil, err + } + + if size >= 0 { + // We were given an archive and found the __.PKGDEF in it. + // This tells us the size of the export data, and we don't + // need to return the entire file. + return &io.LimitedReader{ + R: buf, + N: size, + }, nil + } else { + // We were given an object file. As such, we don't know how large + // the export data is and must return the entire file. + return buf, nil + } } // Read reads export data from in, decodes it, and returns type diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go index 072005af8..0a3cdb9a3 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go @@ -34,9 +34,6 @@ import ( // (suspected) format errors, and whenever a change is made to the format. const debugFormat = false // default: false -// If trace is set, debugging output is printed to std out. -const trace = false // default: false - // Current export format version. Increase with each format change. // Note: The latest binary (non-indexed) export format is at version 6. // This exporter is still at level 4, but it doesn't matter since diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go index b02312000..b85de0147 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go @@ -74,9 +74,10 @@ func BImportData(fset *token.FileSet, imports map[string]*types.Package, data [] pathList: []string{""}, // empty string is mapped to 0 fake: fakeFileSet{ fset: fset, - files: make(map[string]*token.File), + files: make(map[string]*fileInfo), }, } + defer p.fake.setLines() // set lines for files in fset // read version info var versionstr string @@ -338,37 +339,49 @@ func (p *importer) pos() token.Pos { // Synthesize a token.Pos type fakeFileSet struct { fset *token.FileSet - files map[string]*token.File + files map[string]*fileInfo } +type fileInfo struct { + file *token.File + lastline int +} + +const maxlines = 64 * 1024 + func (s *fakeFileSet) pos(file string, line, column int) token.Pos { // TODO(mdempsky): Make use of column. - // Since we don't know the set of needed file positions, we - // reserve maxlines positions per file. - const maxlines = 64 * 1024 + // Since we don't know the set of needed file positions, we reserve maxlines + // positions per file. We delay calling token.File.SetLines until all + // positions have been calculated (by way of fakeFileSet.setLines), so that + // we can avoid setting unnecessary lines. See also golang/go#46586. f := s.files[file] if f == nil { - f = s.fset.AddFile(file, -1, maxlines) + f = &fileInfo{file: s.fset.AddFile(file, -1, maxlines)} s.files[file] = f - // Allocate the fake linebreak indices on first use. - // TODO(adonovan): opt: save ~512KB using a more complex scheme? - fakeLinesOnce.Do(func() { - fakeLines = make([]int, maxlines) - for i := range fakeLines { - fakeLines[i] = i - } - }) - f.SetLines(fakeLines) } - if line > maxlines { line = 1 } + if line > f.lastline { + f.lastline = line + } - // Treat the file as if it contained only newlines - // and column=1: use the line number as the offset. - return f.Pos(line - 1) + // Return a fake position assuming that f.file consists only of newlines. + return token.Pos(f.file.Base() + line - 1) +} + +func (s *fakeFileSet) setLines() { + fakeLinesOnce.Do(func() { + fakeLines = make([]int, maxlines) + for i := range fakeLines { + fakeLines[i] = i + } + }) + for _, f := range s.files { + f.file.SetLines(fakeLines[:f.lastline]) + } } var ( diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go b/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go index f33dc5613..f6437feb1 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go @@ -16,7 +16,7 @@ import ( "strings" ) -func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { +func readGopackHeader(r *bufio.Reader) (name string, size int64, err error) { // See $GOROOT/include/ar.h. hdr := make([]byte, 16+12+6+6+8+10+2) _, err = io.ReadFull(r, hdr) @@ -28,7 +28,8 @@ func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { fmt.Printf("header: %s", hdr) } s := strings.TrimSpace(string(hdr[16+12+6+6+8:][:10])) - size, err = strconv.Atoi(s) + length, err := strconv.Atoi(s) + size = int64(length) if err != nil || hdr[len(hdr)-2] != '`' || hdr[len(hdr)-1] != '\n' { err = fmt.Errorf("invalid archive header") return @@ -42,8 +43,8 @@ func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { // file by reading from it. The reader must be positioned at the // start of the file before calling this function. The hdr result // is the string before the export data, either "$$" or "$$B". -// -func FindExportData(r *bufio.Reader) (hdr string, err error) { +// The size result is the length of the export data in bytes, or -1 if not known. +func FindExportData(r *bufio.Reader) (hdr string, size int64, err error) { // Read first line to make sure this is an object file. line, err := r.ReadSlice('\n') if err != nil { @@ -54,7 +55,7 @@ func FindExportData(r *bufio.Reader) (hdr string, err error) { if string(line) == "!\n" { // Archive file. Scan to __.PKGDEF. var name string - if name, _, err = readGopackHeader(r); err != nil { + if name, size, err = readGopackHeader(r); err != nil { return } @@ -70,6 +71,7 @@ func FindExportData(r *bufio.Reader) (hdr string, err error) { err = fmt.Errorf("can't find export data (%v)", err) return } + size -= int64(len(line)) } // Now at __.PKGDEF in archive or still at beginning of file. @@ -86,8 +88,12 @@ func FindExportData(r *bufio.Reader) (hdr string, err error) { err = fmt.Errorf("can't find export data (%v)", err) return } + size -= int64(len(line)) } hdr = string(line) + if size < 0 { + size = -1 + } return } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go index e8cba6b23..3ab66830d 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go @@ -29,8 +29,14 @@ import ( "text/scanner" ) -// debugging/development support -const debug = false +const ( + // Enable debug during development: it adds some additional checks, and + // prevents errors from being recovered. + debug = false + + // If trace is set, debugging output is printed to std out. + trace = false +) var pkgExts = [...]string{".a", ".o"} @@ -179,7 +185,7 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func var hdr string buf := bufio.NewReader(rc) - if hdr, err = FindExportData(buf); err != nil { + if hdr, _, err = FindExportData(buf); err != nil { return } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go index be8b7459a..b4d51f352 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go @@ -11,6 +11,7 @@ package gcimporter import ( "bytes" "encoding/binary" + "fmt" "go/ast" "go/constant" "go/token" @@ -19,6 +20,7 @@ import ( "math/big" "reflect" "sort" + "strings" "golang.org/x/tools/internal/typeparams" ) @@ -33,15 +35,15 @@ const bundleVersion = 0 // The package path of the top-level package will not be recorded, // so that calls to IImportData can override with a provided package path. func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error { - return iexportCommon(out, fset, false, []*types.Package{pkg}) + return iexportCommon(out, fset, false, iexportVersion, []*types.Package{pkg}) } // IExportBundle writes an indexed export bundle for pkgs to out. func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error { - return iexportCommon(out, fset, true, pkgs) + return iexportCommon(out, fset, true, iexportVersion, pkgs) } -func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, pkgs []*types.Package) (err error) { +func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, version int, pkgs []*types.Package) (err error) { if !debug { defer func() { if e := recover(); e != nil { @@ -57,9 +59,11 @@ func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, pkgs []*type p := iexporter{ fset: fset, + version: version, allPkgs: map[*types.Package]bool{}, stringIndex: map[string]uint64{}, declIndex: map[types.Object]uint64{}, + tparamNames: map[types.Object]string{}, typIndex: map[types.Type]uint64{}, } if !bundle { @@ -119,7 +123,7 @@ func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, pkgs []*type if bundle { hdr.uint64(bundleVersion) } - hdr.uint64(iexportVersion) + hdr.uint64(uint64(p.version)) hdr.uint64(uint64(p.strings.Len())) hdr.uint64(dataLen) @@ -136,8 +140,12 @@ func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, pkgs []*type // non-compiler tools and includes a complete package description // (i.e., name and height). func (w *exportWriter) writeIndex(index map[types.Object]uint64) { + type pkgObj struct { + obj types.Object + name string // qualified name; differs from obj.Name for type params + } // Build a map from packages to objects from that package. - pkgObjs := map[*types.Package][]types.Object{} + pkgObjs := map[*types.Package][]pkgObj{} // For the main index, make sure to include every package that // we reference, even if we're not exporting (or reexporting) @@ -150,7 +158,8 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { } for obj := range index { - pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], obj) + name := w.p.indexName(obj) + pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], pkgObj{obj, name}) } var pkgs []*types.Package @@ -158,7 +167,7 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { pkgs = append(pkgs, pkg) sort.Slice(objs, func(i, j int) bool { - return indexName(objs[i]) < indexName(objs[j]) + return objs[i].name < objs[j].name }) } @@ -175,29 +184,26 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { objs := pkgObjs[pkg] w.uint64(uint64(len(objs))) for _, obj := range objs { - w.string(indexName(obj)) - w.uint64(index[obj]) + w.string(obj.name) + w.uint64(index[obj.obj]) } } } // indexName returns the 'indexed' name of an object. It differs from -// obj.Name() only for type parameter names, where we include the subscripted -// type parameter ID. -// -// TODO(rfindley): remove this once we no longer need subscripts. -func indexName(obj types.Object) (res string) { - if _, ok := obj.(*types.TypeName); ok { - if tparam, ok := obj.Type().(*typeparams.TypeParam); ok { - return types.TypeString(tparam, func(*types.Package) string { return "" }) - } +// obj.Name() only for type parameter names, where the name is qualified by +// owner. +func (p *iexporter) indexName(obj types.Object) (res string) { + if name := p.tparamNames[obj]; name != "" { + return name } return obj.Name() } type iexporter struct { - fset *token.FileSet - out *bytes.Buffer + fset *token.FileSet + out *bytes.Buffer + version int localpkg *types.Package @@ -211,9 +217,21 @@ type iexporter struct { strings intWriter stringIndex map[string]uint64 - data0 intWriter - declIndex map[types.Object]uint64 - typIndex map[types.Type]uint64 + data0 intWriter + declIndex map[types.Object]uint64 + tparamNames map[types.Object]string // typeparam->qualified name + typIndex map[types.Type]uint64 + + indent int // for tracing support +} + +func (p *iexporter) trace(format string, args ...interface{}) { + if !trace { + // Call sites should also be guarded, but having this check here allows + // easily enabling/disabling debug trace statements. + return + } + fmt.Printf(strings.Repeat("..", p.indent)+format+"\n", args...) } // stringOff returns the offset of s within the string section. @@ -239,7 +257,7 @@ func (p *iexporter) pushDecl(obj types.Object) { return } - p.declIndex[obj] = ^uint64(0) // mark n present in work queue + p.declIndex[obj] = ^uint64(0) // mark obj present in work queue p.declTodo.pushTail(obj) } @@ -262,6 +280,14 @@ func (w *exportWriter) exportPath(pkg *types.Package) string { } func (p *iexporter) doDecl(obj types.Object) { + if trace { + p.trace("exporting decl %v (%T)", obj, obj) + p.indent++ + defer func() { + p.indent-- + p.trace("=> %s", obj) + }() + } w := p.newWriter() w.setPkg(obj.Pkg(), false) @@ -291,7 +317,7 @@ func (p *iexporter) doDecl(obj types.Object) { // other places in the signature and function that they // are used. if tparams := typeparams.ForSignature(sig); tparams.Len() > 0 { - w.tparamList(tparams, obj.Pkg()) + w.tparamList(obj, tparams, obj.Pkg()) } w.signature(sig) @@ -306,7 +332,15 @@ func (p *iexporter) doDecl(obj types.Object) { if tparam, ok := t.(*typeparams.TypeParam); ok { w.tag('P') w.pos(obj.Pos()) - w.typ(tparam.Constraint(), obj.Pkg()) + constraint := tparam.Constraint() + if p.version >= iexportVersionGo1_18 { + implicit := false + if iface, _ := constraint.(*types.Interface); iface != nil { + implicit = typeparams.IsImplicit(iface) + } + w.bool(implicit) + } + w.typ(constraint, obj.Pkg()) break } @@ -331,7 +365,7 @@ func (p *iexporter) doDecl(obj types.Object) { w.pos(obj.Pos()) if typeparams.ForNamed(named).Len() > 0 { - w.tparamList(typeparams.ForNamed(named), obj.Pkg()) + w.tparamList(obj, typeparams.ForNamed(named), obj.Pkg()) } underlying := obj.Type().Underlying() @@ -348,6 +382,15 @@ func (p *iexporter) doDecl(obj types.Object) { w.pos(m.Pos()) w.string(m.Name()) sig, _ := m.Type().(*types.Signature) + + // Receiver type parameters are type arguments of the receiver type, so + // their name must be qualified before exporting recv. + rparams := typeparams.RecvTypeParams(sig) + for i := 0; i < rparams.Len(); i++ { + rparam := rparams.At(i) + name := obj.Name() + "." + m.Name() + "." + rparam.Obj().Name() + w.p.tparamNames[rparam.Obj()] = name + } w.param(sig.Recv()) w.signature(sig) } @@ -364,7 +407,7 @@ func (w *exportWriter) tag(tag byte) { } func (w *exportWriter) pos(pos token.Pos) { - if iexportVersion >= iexportVersionPosCol { + if w.p.version >= iexportVersionPosCol { w.posV1(pos) } else { w.posV0(pos) @@ -447,9 +490,11 @@ func (w *exportWriter) pkg(pkg *types.Package) { } func (w *exportWriter) qualifiedIdent(obj types.Object) { + name := w.p.indexName(obj) + // Ensure any referenced declarations are written out too. w.p.pushDecl(obj) - w.string(indexName(obj)) + w.string(name) w.pkg(obj.Pkg()) } @@ -483,6 +528,14 @@ func (w *exportWriter) startType(k itag) { } func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { + if trace { + w.p.trace("exporting type %s (%T)", t, t) + w.p.indent++ + defer func() { + w.p.indent-- + w.p.trace("=> %s", t) + }() + } switch t := t.(type) { case *types.Named: if targs := typeparams.NamedTypeArgs(t); targs.Len() > 0 { @@ -619,10 +672,14 @@ func (w *exportWriter) typeList(ts *typeparams.TypeList, pkg *types.Package) { } } -func (w *exportWriter) tparamList(list *typeparams.TypeParamList, pkg *types.Package) { +func (w *exportWriter) tparamList(owner types.Object, list *typeparams.TypeParamList, pkg *types.Package) { ll := uint64(list.Len()) w.uint64(ll) for i := 0; i < list.Len(); i++ { + tparam := list.At(i) + // Qualify the type parameter name before exporting its type. + name := owner.Name() + "." + tparam.Obj().Name() + w.p.tparamNames[tparam.Obj()] = name w.typ(list.At(i), pkg) } } @@ -643,6 +700,9 @@ func (w *exportWriter) param(obj types.Object) { func (w *exportWriter) value(typ types.Type, v constant.Value) { w.typ(typ, nil) + if w.p.version >= iexportVersionGo1_18 { + w.int64(int64(v.Kind())) + } switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { case types.IsBoolean: @@ -832,7 +892,7 @@ func (w *exportWriter) localIdent(obj types.Object) { return } - name := indexName(obj) + name := obj.Name() if name == "_" { w.string("_") return diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go index 1fcc87e58..cdb332cd1 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go @@ -18,6 +18,7 @@ import ( "go/types" "io" "sort" + "strings" "golang.org/x/tools/internal/typeparams" ) @@ -44,13 +45,20 @@ func (r *intReader) uint64() uint64 { } // Keep this in sync with constants in iexport.go. +// +// Temporarily, the x/tools importer accepts generic code at both version 1 and +// 2. However, version 2 contains some breaking changes on top of version 1: +// - the 'implicit' bit is added to exported constraints +// - a 'kind' byte is added to constant values (not yet done) +// +// Once we've completed the bump to version 2 in the standard library, we'll +// remove support for generics here at version 1. const ( iexportVersionGo1_11 = 0 iexportVersionPosCol = 1 + iexportVersionGo1_18 = 2 // TODO: before release, change this back to 2. iexportVersionGenerics = iexportVersionPosCol - - iexportVersionCurrent = iexportVersionGenerics ) type ident struct { @@ -123,9 +131,9 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data version = int64(r.uint64()) switch version { - case /* iexportVersionGenerics, */ iexportVersionPosCol, iexportVersionGo1_11: + case iexportVersionGo1_18, iexportVersionPosCol, iexportVersionGo1_11: default: - if version > iexportVersionGenerics { + if version > iexportVersionGo1_18 { errorf("unstable iexport format version %d, just rebuild compiler and std library", version) } else { errorf("unknown iexport format version %d", version) @@ -141,9 +149,8 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data r.Seek(sLen+dLen, io.SeekCurrent) p := iimporter{ - exportVersion: version, - ipath: path, - version: int(version), + version: int(version), + ipath: path, stringData: stringData, stringCache: make(map[uint64]string), @@ -153,14 +160,15 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data pkgIndex: make(map[*types.Package]map[string]uint64), typCache: make(map[uint64]types.Type), // Separate map for typeparams, keyed by their package and unique - // name (name with subscript). + // name. tparamIndex: make(map[ident]types.Type), fake: fakeFileSet{ fset: fset, - files: make(map[string]*token.File), + files: make(map[string]*fileInfo), }, } + defer p.fake.setLines() // set lines for files in fset for i, pt := range predeclared() { p.typCache[uint64(i)] = pt @@ -246,9 +254,8 @@ func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data } type iimporter struct { - exportVersion int64 - ipath string - version int + version int + ipath string stringData []byte stringCache map[uint64]string @@ -261,9 +268,28 @@ type iimporter struct { fake fakeFileSet interfaceList []*types.Interface + + indent int // for tracing support +} + +func (p *iimporter) trace(format string, args ...interface{}) { + if !trace { + // Call sites should also be guarded, but having this check here allows + // easily enabling/disabling debug trace statements. + return + } + fmt.Printf(strings.Repeat("..", p.indent)+format+"\n", args...) } func (p *iimporter) doDecl(pkg *types.Package, name string) { + if debug { + p.trace("import decl %s", name) + p.indent++ + defer func() { + p.indent-- + p.trace("=> %s", name) + }() + } // See if we've already imported this declaration. if obj := pkg.Scope().Lookup(name); obj != nil { return @@ -305,7 +331,7 @@ func (p *iimporter) pkgAt(off uint64) *types.Package { } func (p *iimporter) typAt(off uint64, base *types.Named) types.Type { - if t, ok := p.typCache[off]; ok && (base == nil || !isInterface(t)) { + if t, ok := p.typCache[off]; ok && canReuse(base, t) { return t } @@ -317,12 +343,30 @@ func (p *iimporter) typAt(off uint64, base *types.Named) types.Type { r.declReader.Reset(p.declData[off-predeclReserved:]) t := r.doType(base) - if base == nil || !isInterface(t) { + if canReuse(base, t) { p.typCache[off] = t } return t } +// canReuse reports whether the type rhs on the RHS of the declaration for def +// may be re-used. +// +// Specifically, if def is non-nil and rhs is an interface type with methods, it +// may not be re-used because we have a convention of setting the receiver type +// for interface methods to def. +func canReuse(def *types.Named, rhs types.Type) bool { + if def == nil { + return true + } + iface, _ := rhs.(*types.Interface) + if iface == nil { + return true + } + // Don't use iface.Empty() here as iface may not be complete. + return iface.NumEmbeddeds() == 0 && iface.NumExplicitMethods() == 0 +} + type importReader struct { p *iimporter declReader bytes.Reader @@ -352,8 +396,7 @@ func (r *importReader) obj(name string) { if tag == 'G' { tparams = r.tparamList() } - sig := r.signature(nil) - typeparams.SetForSignature(sig, tparams) + sig := r.signature(nil, nil, tparams) r.declare(types.NewFunc(pos, r.currPkg, name, sig)) case 'T', 'U': @@ -377,23 +420,21 @@ func (r *importReader) obj(name string) { mpos := r.pos() mname := r.ident() recv := r.param() - msig := r.signature(recv) // If the receiver has any targs, set those as the // rparams of the method (since those are the // typeparams being used in the method sig/body). - targs := typeparams.NamedTypeArgs(baseType(msig.Recv().Type())) + base := baseType(recv.Type()) + assert(base != nil) + targs := typeparams.NamedTypeArgs(base) + var rparams []*typeparams.TypeParam if targs.Len() > 0 { - rparams := make([]*typeparams.TypeParam, targs.Len()) + rparams = make([]*typeparams.TypeParam, targs.Len()) for i := range rparams { - // TODO(rfindley): this is less tolerant than the standard library - // go/internal/gcimporter, which calls under(...) and is tolerant - // of nil rparams. Bring them in sync by making the standard - // library importer stricter. rparams[i] = targs.At(i).(*typeparams.TypeParam) } - typeparams.SetRecvTypeParams(msig, rparams) } + msig := r.signature(recv, rparams, nil) named.AddMethod(types.NewFunc(mpos, r.currPkg, mname, msig)) } @@ -403,25 +444,35 @@ func (r *importReader) obj(name string) { // We need to "declare" a typeparam in order to have a name that // can be referenced recursively (if needed) in the type param's // bound. - if r.p.exportVersion < iexportVersionGenerics { + if r.p.version < iexportVersionGenerics { errorf("unexpected type param type") } - name0, sub := parseSubscript(name) + // Remove the "path" from the type param name that makes it unique + ix := strings.LastIndex(name, ".") + if ix < 0 { + errorf("missing path for type param") + } + name0 := name[ix+1:] tn := types.NewTypeName(pos, r.currPkg, name0, nil) t := typeparams.NewTypeParam(tn, nil) - if sub == 0 { - errorf("name %q missing subscript", name) - } - - // TODO(rfindley): can we use a different, stable ID? - // t.SetId(sub) // To handle recursive references to the typeparam within its // bound, save the partial type in tparamIndex before reading the bounds. id := ident{r.currPkg.Name(), name} r.p.tparamIndex[id] = t - - typeparams.SetTypeParamConstraint(t, r.typ()) + var implicit bool + if r.p.version >= iexportVersionGo1_18 { + implicit = r.bool() + } + constraint := r.typ() + if implicit { + iface, _ := constraint.(*types.Interface) + if iface == nil { + errorf("non-interface constraint marked implicit") + } + typeparams.MarkImplicit(iface) + } + typeparams.SetTypeParamConstraint(t, constraint) case 'V': typ := r.typ() @@ -439,6 +490,10 @@ func (r *importReader) declare(obj types.Object) { func (r *importReader) value() (typ types.Type, val constant.Value) { typ = r.typ() + if r.p.version >= iexportVersionGo1_18 { + // TODO: add support for using the kind. + _ = constant.Kind(r.int64()) + } switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { case types.IsBoolean: @@ -581,7 +636,7 @@ func (r *importReader) qualifiedIdent() (*types.Package, string) { } func (r *importReader) pos() token.Pos { - if r.p.exportVersion >= iexportVersionPosCol { + if r.p.version >= iexportVersionPosCol { r.posv1() } else { r.posv0() @@ -629,8 +684,17 @@ func isInterface(t types.Type) bool { func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) } func (r *importReader) string() string { return r.p.stringAt(r.uint64()) } -func (r *importReader) doType(base *types.Named) types.Type { - switch k := r.kind(); k { +func (r *importReader) doType(base *types.Named) (res types.Type) { + k := r.kind() + if debug { + r.p.trace("importing type %d (base: %s)", k, base) + r.p.indent++ + defer func() { + r.p.indent-- + r.p.trace("=> %s", res) + }() + } + switch k { default: errorf("unexpected kind tag in %q: %v", r.p.ipath, k) return nil @@ -653,7 +717,7 @@ func (r *importReader) doType(base *types.Named) types.Type { return types.NewMap(r.typ(), r.typ()) case signatureType: r.currPkg = r.pkg() - return r.signature(nil) + return r.signature(nil, nil, nil) case structType: r.currPkg = r.pkg() @@ -693,7 +757,7 @@ func (r *importReader) doType(base *types.Named) types.Type { recv = types.NewVar(token.NoPos, r.currPkg, "", base) } - msig := r.signature(recv) + msig := r.signature(recv, nil, nil) methods[i] = types.NewFunc(mpos, r.currPkg, mname, msig) } @@ -702,7 +766,7 @@ func (r *importReader) doType(base *types.Named) types.Type { return typ case typeParamType: - if r.p.exportVersion < iexportVersionGenerics { + if r.p.version < iexportVersionGenerics { errorf("unexpected type param type") } pkg, name := r.qualifiedIdent() @@ -716,7 +780,7 @@ func (r *importReader) doType(base *types.Named) types.Type { return r.p.tparamIndex[id] case instanceType: - if r.p.exportVersion < iexportVersionGenerics { + if r.p.version < iexportVersionGenerics { errorf("unexpected instantiation type") } // pos does not matter for instances: they are positioned on the original @@ -735,7 +799,7 @@ func (r *importReader) doType(base *types.Named) types.Type { return t case unionType: - if r.p.exportVersion < iexportVersionGenerics { + if r.p.version < iexportVersionGenerics { errorf("unexpected instantiation type") } terms := make([]*typeparams.Term, r.uint64()) @@ -750,11 +814,11 @@ func (r *importReader) kind() itag { return itag(r.uint64()) } -func (r *importReader) signature(recv *types.Var) *types.Signature { +func (r *importReader) signature(recv *types.Var, rparams []*typeparams.TypeParam, tparams []*typeparams.TypeParam) *types.Signature { params := r.paramList() results := r.paramList() variadic := params.Len() > 0 && r.bool() - return types.NewSignature(recv, params, results, variadic) + return typeparams.NewSignatureType(recv, rparams, tparams, params, results, variadic) } func (r *importReader) tparamList() []*typeparams.TypeParam { @@ -823,23 +887,3 @@ func baseType(typ types.Type) *types.Named { n, _ := typ.(*types.Named) return n } - -func parseSubscript(name string) (string, uint64) { - // Extract the subscript value from the type param name. We export - // and import the subscript value, so that all type params have - // unique names. - sub := uint64(0) - startsub := -1 - for i, r := range name { - if '₀' <= r && r < '₀'+10 { - if startsub == -1 { - startsub = i - } - sub = sub*10 + uint64(r-'₀') - } - } - if startsub >= 0 { - name = name[:startsub] - } - return name, sub -} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go index 817a147ef..d892273ef 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !typeparams || !go1.18 -// +build !typeparams !go1.18 +//go:build !go1.18 +// +build !go1.18 package gcimporter diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go index e6b81fc50..a99384323 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build typeparams && go1.18 -// +build typeparams,go1.18 +//go:build go1.18 +// +build go1.18 package gcimporter @@ -16,5 +16,8 @@ func additionalPredeclared() []types.Type { return []types.Type{ // comparable types.Universe.Lookup("comparable").Type(), + + // any + types.Universe.Lookup("any").Type(), } } diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index 8a1a2d681..d545b1375 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -26,6 +26,7 @@ import ( "golang.org/x/tools/go/gcexportdata" "golang.org/x/tools/internal/gocommand" "golang.org/x/tools/internal/packagesinternal" + "golang.org/x/tools/internal/typeparams" "golang.org/x/tools/internal/typesinternal" ) @@ -910,6 +911,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { Scopes: make(map[ast.Node]*types.Scope), Selections: make(map[*ast.SelectorExpr]*types.Selection), } + typeparams.InitInstanceInfo(lpkg.TypesInfo) lpkg.TypesSizes = ld.sizes importer := importerFunc(func(path string) (*types.Package, error) { diff --git a/vendor/golang.org/x/tools/internal/typeparams/common.go b/vendor/golang.org/x/tools/internal/typeparams/common.go index 9fc6b4beb..961d036fd 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/common.go +++ b/vendor/golang.org/x/tools/internal/typeparams/common.go @@ -13,6 +13,7 @@ package typeparams import ( "go/ast" "go/token" + "go/types" ) // A IndexExprData holds data from both ast.IndexExpr and the new @@ -23,3 +24,9 @@ type IndexExprData struct { Indices []ast.Expr // index expressions Rbrack token.Pos // position of "]" } + +// IsTypeParam reports whether t is a type parameter. +func IsTypeParam(t types.Type) bool { + _, ok := t.(*TypeParam) + return ok +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go b/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go index 72d010e51..18212390e 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go +++ b/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !typeparams || !go1.18 -// +build !typeparams !go1.18 +//go:build !go1.18 +// +build !go1.18 package typeparams diff --git a/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go b/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go index 642fc8ee2..d67148823 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go +++ b/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build typeparams && go1.18 -// +build typeparams,go1.18 +//go:build go1.18 +// +build go1.18 package typeparams diff --git a/vendor/golang.org/x/tools/internal/typeparams/normalize.go b/vendor/golang.org/x/tools/internal/typeparams/normalize.go new file mode 100644 index 000000000..090f142a5 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/normalize.go @@ -0,0 +1,216 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package typeparams + +import ( + "errors" + "fmt" + "go/types" + "os" + "strings" +) + +//go:generate go run copytermlist.go + +const debug = false + +var ErrEmptyTypeSet = errors.New("empty type set") + +// StructuralTerms returns a slice of terms representing the normalized +// structural type restrictions of a type parameter, if any. +// +// Structural type restrictions of a type parameter are created via +// non-interface types embedded in its constraint interface (directly, or via a +// chain of interface embeddings). For example, in the declaration +// type T[P interface{~int; m()}] int +// the structural restriction of the type parameter P is ~int. +// +// With interface embedding and unions, the specification of structural type +// restrictions may be arbitrarily complex. For example, consider the +// following: +// +// type A interface{ ~string|~[]byte } +// +// type B interface{ int|string } +// +// type C interface { ~string|~int } +// +// type T[P interface{ A|B; C }] int +// +// In this example, the structural type restriction of P is ~string|int: A|B +// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int, +// which when intersected with C (~string|~int) yields ~string|int. +// +// StructuralTerms computes these expansions and reductions, producing a +// "normalized" form of the embeddings. A structural restriction is normalized +// if it is a single union containing no interface terms, and is minimal in the +// sense that removing any term changes the set of types satisfying the +// constraint. It is left as a proof for the reader that, modulo sorting, there +// is exactly one such normalized form. +// +// Because the minimal representation always takes this form, StructuralTerms +// returns a slice of tilde terms corresponding to the terms of the union in +// the normalized structural restriction. An error is returned if the +// constraint interface is invalid, exceeds complexity bounds, or has an empty +// type set. In the latter case, StructuralTerms returns ErrEmptyTypeSet. +// +// StructuralTerms makes no guarantees about the order of terms, except that it +// is deterministic. +func StructuralTerms(tparam *TypeParam) ([]*Term, error) { + constraint := tparam.Constraint() + if constraint == nil { + return nil, fmt.Errorf("%s has nil constraint", tparam) + } + iface, _ := constraint.Underlying().(*types.Interface) + if iface == nil { + return nil, fmt.Errorf("constraint is %T, not *types.Interface", constraint.Underlying()) + } + return InterfaceTermSet(iface) +} + +// InterfaceTermSet computes the normalized terms for a constraint interface, +// returning an error if the term set cannot be computed or is empty. In the +// latter case, the error will be ErrEmptyTypeSet. +// +// See the documentation of StructuralTerms for more information on +// normalization. +func InterfaceTermSet(iface *types.Interface) ([]*Term, error) { + return computeTermSet(iface) +} + +// UnionTermSet computes the normalized terms for a union, returning an error +// if the term set cannot be computed or is empty. In the latter case, the +// error will be ErrEmptyTypeSet. +// +// See the documentation of StructuralTerms for more information on +// normalization. +func UnionTermSet(union *Union) ([]*Term, error) { + return computeTermSet(union) +} + +func computeTermSet(typ types.Type) ([]*Term, error) { + tset, err := computeTermSetInternal(typ, make(map[types.Type]*termSet), 0) + if err != nil { + return nil, err + } + if tset.terms.isEmpty() { + return nil, ErrEmptyTypeSet + } + if tset.terms.isAll() { + return nil, nil + } + var terms []*Term + for _, term := range tset.terms { + terms = append(terms, NewTerm(term.tilde, term.typ)) + } + return terms, nil +} + +// A termSet holds the normalized set of terms for a given type. +// +// The name termSet is intentionally distinct from 'type set': a type set is +// all types that implement a type (and includes method restrictions), whereas +// a term set just represents the structural restrictions on a type. +type termSet struct { + complete bool + terms termlist +} + +func indentf(depth int, format string, args ...interface{}) { + fmt.Fprintf(os.Stderr, strings.Repeat(".", depth)+format+"\n", args...) +} + +func computeTermSetInternal(t types.Type, seen map[types.Type]*termSet, depth int) (res *termSet, err error) { + if t == nil { + panic("nil type") + } + + if debug { + indentf(depth, "%s", t.String()) + defer func() { + if err != nil { + indentf(depth, "=> %s", err) + } else { + indentf(depth, "=> %s", res.terms.String()) + } + }() + } + + const maxTermCount = 100 + if tset, ok := seen[t]; ok { + if !tset.complete { + return nil, fmt.Errorf("cycle detected in the declaration of %s", t) + } + return tset, nil + } + + // Mark the current type as seen to avoid infinite recursion. + tset := new(termSet) + defer func() { + tset.complete = true + }() + seen[t] = tset + + switch u := t.Underlying().(type) { + case *types.Interface: + // The term set of an interface is the intersection of the term sets of its + // embedded types. + tset.terms = allTermlist + for i := 0; i < u.NumEmbeddeds(); i++ { + embedded := u.EmbeddedType(i) + if _, ok := embedded.Underlying().(*TypeParam); ok { + return nil, fmt.Errorf("invalid embedded type %T", embedded) + } + tset2, err := computeTermSetInternal(embedded, seen, depth+1) + if err != nil { + return nil, err + } + tset.terms = tset.terms.intersect(tset2.terms) + } + case *Union: + // The term set of a union is the union of term sets of its terms. + tset.terms = nil + for i := 0; i < u.Len(); i++ { + t := u.Term(i) + var terms termlist + switch t.Type().Underlying().(type) { + case *types.Interface: + tset2, err := computeTermSetInternal(t.Type(), seen, depth+1) + if err != nil { + return nil, err + } + terms = tset2.terms + case *TypeParam, *Union: + // A stand-alone type parameter or union is not permitted as union + // term. + return nil, fmt.Errorf("invalid union term %T", t) + default: + if t.Type() == types.Typ[types.Invalid] { + continue + } + terms = termlist{{t.Tilde(), t.Type()}} + } + tset.terms = tset.terms.union(terms) + if len(tset.terms) > maxTermCount { + return nil, fmt.Errorf("exceeded max term count %d", maxTermCount) + } + } + case *TypeParam: + panic("unreachable") + default: + // For all other types, the term set is just a single non-tilde term + // holding the type itself. + if u != types.Typ[types.Invalid] { + tset.terms = termlist{{false, t}} + } + } + return tset, nil +} + +// under is a facade for the go/types internal function of the same name. It is +// used by typeterm.go. +func under(t types.Type) types.Type { + return t.Underlying() +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/termlist.go b/vendor/golang.org/x/tools/internal/typeparams/termlist.go new file mode 100644 index 000000000..10857d504 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/termlist.go @@ -0,0 +1,172 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by copytermlist.go DO NOT EDIT. + +package typeparams + +import ( + "bytes" + "go/types" +) + +// A termlist represents the type set represented by the union +// t1 ∪ y2 ∪ ... tn of the type sets of the terms t1 to tn. +// A termlist is in normal form if all terms are disjoint. +// termlist operations don't require the operands to be in +// normal form. +type termlist []*term + +// allTermlist represents the set of all types. +// It is in normal form. +var allTermlist = termlist{new(term)} + +// String prints the termlist exactly (without normalization). +func (xl termlist) String() string { + if len(xl) == 0 { + return "∅" + } + var buf bytes.Buffer + for i, x := range xl { + if i > 0 { + buf.WriteString(" ∪ ") + } + buf.WriteString(x.String()) + } + return buf.String() +} + +// isEmpty reports whether the termlist xl represents the empty set of types. +func (xl termlist) isEmpty() bool { + // If there's a non-nil term, the entire list is not empty. + // If the termlist is in normal form, this requires at most + // one iteration. + for _, x := range xl { + if x != nil { + return false + } + } + return true +} + +// isAll reports whether the termlist xl represents the set of all types. +func (xl termlist) isAll() bool { + // If there's a 𝓤 term, the entire list is 𝓤. + // If the termlist is in normal form, this requires at most + // one iteration. + for _, x := range xl { + if x != nil && x.typ == nil { + return true + } + } + return false +} + +// norm returns the normal form of xl. +func (xl termlist) norm() termlist { + // Quadratic algorithm, but good enough for now. + // TODO(gri) fix asymptotic performance + used := make([]bool, len(xl)) + var rl termlist + for i, xi := range xl { + if xi == nil || used[i] { + continue + } + for j := i + 1; j < len(xl); j++ { + xj := xl[j] + if xj == nil || used[j] { + continue + } + if u1, u2 := xi.union(xj); u2 == nil { + // If we encounter a 𝓤 term, the entire list is 𝓤. + // Exit early. + // (Note that this is not just an optimization; + // if we continue, we may end up with a 𝓤 term + // and other terms and the result would not be + // in normal form.) + if u1.typ == nil { + return allTermlist + } + xi = u1 + used[j] = true // xj is now unioned into xi - ignore it in future iterations + } + } + rl = append(rl, xi) + } + return rl +} + +// If the type set represented by xl is specified by a single (non-𝓤) term, +// structuralType returns that type. Otherwise it returns nil. +func (xl termlist) structuralType() types.Type { + if nl := xl.norm(); len(nl) == 1 { + return nl[0].typ // if nl.isAll() then typ is nil, which is ok + } + return nil +} + +// union returns the union xl ∪ yl. +func (xl termlist) union(yl termlist) termlist { + return append(xl, yl...).norm() +} + +// intersect returns the intersection xl ∩ yl. +func (xl termlist) intersect(yl termlist) termlist { + if xl.isEmpty() || yl.isEmpty() { + return nil + } + + // Quadratic algorithm, but good enough for now. + // TODO(gri) fix asymptotic performance + var rl termlist + for _, x := range xl { + for _, y := range yl { + if r := x.intersect(y); r != nil { + rl = append(rl, r) + } + } + } + return rl.norm() +} + +// equal reports whether xl and yl represent the same type set. +func (xl termlist) equal(yl termlist) bool { + // TODO(gri) this should be more efficient + return xl.subsetOf(yl) && yl.subsetOf(xl) +} + +// includes reports whether t ∈ xl. +func (xl termlist) includes(t types.Type) bool { + for _, x := range xl { + if x.includes(t) { + return true + } + } + return false +} + +// supersetOf reports whether y ⊆ xl. +func (xl termlist) supersetOf(y *term) bool { + for _, x := range xl { + if y.subsetOf(x) { + return true + } + } + return false +} + +// subsetOf reports whether xl ⊆ yl. +func (xl termlist) subsetOf(yl termlist) bool { + if yl.isEmpty() { + return xl.isEmpty() + } + + // each term x of xl must be a subset of yl + for _, x := range xl { + if !yl.supersetOf(x) { + return false // x is not a subset yl + } + } + return true +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go index 12817af85..e509daf7b 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go +++ b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !typeparams || !go1.18 -// +build !typeparams !go1.18 +//go:build !go1.18 +// +build !go1.18 package typeparams import ( "go/ast" + "go/token" "go/types" ) @@ -30,6 +31,34 @@ func GetIndexExprData(n ast.Node) *IndexExprData { return nil } +// PackIndexExpr returns an *ast.IndexExpr with the given index. +// Calling PackIndexExpr with len(indices) != 1 will panic. +func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr { + switch len(indices) { + case 0: + panic("empty indices") + case 1: + return &ast.IndexExpr{ + X: x, + Lbrack: lbrack, + Index: indices[0], + Rbrack: rbrack, + } + default: + panic("cannot pack multiple indices at this go version") + } +} + +// IndexListExpr is a placeholder type, as type parameters are not supported at +// this Go version. Its methods panic on use. +type IndexListExpr struct { + ast.Expr + X ast.Expr // expression + Lbrack token.Pos // position of "[" + Indices []ast.Expr // index expressions + Rbrack token.Pos // position of "]" +} + // ForTypeSpec returns an empty field list, as type parameters on not supported // at this Go version. func ForTypeSpec(*ast.TypeSpec) *ast.FieldList { @@ -46,6 +75,7 @@ func ForFuncType(*ast.FuncType) *ast.FieldList { // this Go version. Its methods panic on use. type TypeParam struct{ types.Type } +func (*TypeParam) Index() int { unsupported(); return 0 } func (*TypeParam) Constraint() types.Type { unsupported(); return nil } func (*TypeParam) Obj() *types.TypeName { unsupported(); return nil } @@ -72,42 +102,46 @@ func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) { unsupported() } +// NewSignatureType calls types.NewSignature, panicking if recvTypeParams or +// typeParams is non-empty. +func NewSignatureType(recv *types.Var, recvTypeParams, typeParams []*TypeParam, params, results *types.Tuple, variadic bool) *types.Signature { + if len(recvTypeParams) != 0 || len(typeParams) != 0 { + panic("signatures cannot have type parameters at this Go version") + } + return types.NewSignature(recv, params, results, variadic) +} + // ForSignature returns an empty slice. func ForSignature(*types.Signature) *TypeParamList { return nil } -// SetForSignature panics if tparams is non-empty. -func SetForSignature(_ *types.Signature, tparams []*TypeParam) { - if len(tparams) > 0 { - unsupported() - } -} - // RecvTypeParams returns a nil slice. func RecvTypeParams(sig *types.Signature) *TypeParamList { return nil } -// SetRecvTypeParams panics if rparams is non-empty. -func SetRecvTypeParams(sig *types.Signature, rparams []*TypeParam) { - if len(rparams) > 0 { - unsupported() - } -} - // IsComparable returns false, as no interfaces are type-restricted at this Go // version. func IsComparable(*types.Interface) bool { return false } -// IsConstraint returns false, as no interfaces are type-restricted at this Go +// IsMethodSet returns true, as no interfaces are type-restricted at this Go // version. -func IsConstraint(*types.Interface) bool { +func IsMethodSet(*types.Interface) bool { + return true +} + +// IsImplicit returns false, as no interfaces are implicit at this Go version. +func IsImplicit(*types.Interface) bool { return false } +// MarkImplicit does nothing, because this Go version does not have implicit +// interfaces. +func MarkImplicit(*types.Interface) {} + // ForNamed returns an empty type parameter list, as type parameters are not // supported at this Go version. func ForNamed(*types.Named) *TypeParamList { @@ -131,19 +165,25 @@ func NamedTypeOrigin(named *types.Named) types.Type { return named } -// Term is a placeholder type, as type parameters are not supported at this Go -// version. Its methods panic on use. -type Term struct{} +// Term holds information about a structural type restriction. +type Term struct { + tilde bool + typ types.Type +} -func (*Term) Tilde() bool { unsupported(); return false } -func (*Term) Type() types.Type { unsupported(); return nil } -func (*Term) String() string { unsupported(); return "" } -func (*Term) Underlying() types.Type { unsupported(); return nil } +func (m *Term) Tilde() bool { return m.tilde } +func (m *Term) Type() types.Type { return m.typ } +func (m *Term) String() string { + pre := "" + if m.tilde { + pre = "~" + } + return pre + m.typ.String() +} // NewTerm is unsupported at this Go version, and panics. func NewTerm(tilde bool, typ types.Type) *Term { - unsupported() - return nil + return &Term{tilde, typ} } // Union is a placeholder type, as type parameters are not supported at this Go @@ -162,16 +202,23 @@ func NewUnion(terms []*Term) *Union { // InitInstanceInfo is a noop at this Go version. func InitInstanceInfo(*types.Info) {} -// GetInstance returns nothing, as type parameters are not supported at this Go -// version. -func GetInstance(*types.Info, *ast.Ident) (*TypeList, types.Type) { return nil, nil } +// Instance is a placeholder type, as type parameters are not supported at this +// Go version. +type Instance struct { + TypeArgs *TypeList + Type types.Type +} + +// GetInstances returns a nil map, as type parameters are not supported at this +// Go version. +func GetInstances(info *types.Info) map[*ast.Ident]Instance { return nil } -// Environment is a placeholder type, as type parameters are not supported at +// Context is a placeholder type, as type parameters are not supported at // this Go version. -type Environment struct{} +type Context struct{} // Instantiate is unsupported on this Go version, and panics. -func Instantiate(env *Environment, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { +func Instantiate(ctxt *Context, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { unsupported() return nil, nil } diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go index 8ab17b777..e45896fb0 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go +++ b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build typeparams && go1.18 -// +build typeparams,go1.18 +//go:build go1.18 +// +build go1.18 package typeparams import ( "go/ast" + "go/token" "go/types" ) @@ -21,6 +22,7 @@ import ( // // For nodes that don't represent index expressions, GetIndexExprData returns // nil. +// TODO(rfindley): remove this function in favor of using the alias below. func GetIndexExprData(n ast.Node) *IndexExprData { switch e := n.(type) { case *ast.IndexExpr: @@ -36,6 +38,33 @@ func GetIndexExprData(n ast.Node) *IndexExprData { return nil } +// PackIndexExpr returns an *ast.IndexExpr or *ast.IndexListExpr, depending on +// the cardinality of indices. Calling PackIndexExpr with len(indices) == 0 +// will panic. +func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr { + switch len(indices) { + case 0: + panic("empty indices") + case 1: + return &ast.IndexExpr{ + X: x, + Lbrack: lbrack, + Index: indices[0], + Rbrack: rbrack, + } + default: + return &ast.IndexListExpr{ + X: x, + Lbrack: lbrack, + Indices: indices, + Rbrack: rbrack, + } + } +} + +// IndexListExpr is an alias for ast.IndexListExpr. +type IndexListExpr = ast.IndexListExpr + // ForTypeSpec returns n.TypeParams. func ForTypeSpec(n *ast.TypeSpec) *ast.FieldList { if n == nil { @@ -71,34 +100,39 @@ func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) { tparam.SetConstraint(constraint) } +// NewSignatureType calls types.NewSignatureType. +func NewSignatureType(recv *types.Var, recvTypeParams, typeParams []*TypeParam, params, results *types.Tuple, variadic bool) *types.Signature { + return types.NewSignatureType(recv, recvTypeParams, typeParams, params, results, variadic) +} + // ForSignature returns sig.TypeParams() func ForSignature(sig *types.Signature) *TypeParamList { return sig.TypeParams() } -// SetForSignature calls sig.SetTypeParams(tparams) -func SetForSignature(sig *types.Signature, tparams []*TypeParam) { - sig.SetTypeParams(tparams) -} - // RecvTypeParams returns sig.RecvTypeParams(). func RecvTypeParams(sig *types.Signature) *TypeParamList { return sig.RecvTypeParams() } -// SetRecvTypeParams calls sig.SetRecvTypeParams(rparams). -func SetRecvTypeParams(sig *types.Signature, rparams []*TypeParam) { - sig.SetRecvTypeParams(rparams) -} - // IsComparable calls iface.IsComparable(). func IsComparable(iface *types.Interface) bool { return iface.IsComparable() } -// IsConstraint calls iface.IsConstraint(). -func IsConstraint(iface *types.Interface) bool { - return iface.IsConstraint() +// IsMethodSet calls iface.IsMethodSet(). +func IsMethodSet(iface *types.Interface) bool { + return iface.IsMethodSet() +} + +// IsImplicit calls iface.IsImplicit(). +func IsImplicit(iface *types.Interface) bool { + return iface.IsImplicit() +} + +// MarkImplicit calls iface.MarkImplicit(). +func MarkImplicit(iface *types.Interface) { + iface.MarkImplicit() } // ForNamed extracts the (possibly empty) type parameter object list from @@ -145,21 +179,18 @@ func InitInstanceInfo(info *types.Info) { info.Instances = make(map[*ast.Ident]types.Instance) } -// GetInstance extracts information about the instantiation occurring at the -// identifier id. id should be the identifier denoting a parameterized type or -// function in an instantiation expression or function call. -func GetInstance(info *types.Info, id *ast.Ident) (*TypeList, types.Type) { - if info.Instances != nil { - inf := info.Instances[id] - return inf.TypeArgs, inf.Type - } - return nil, nil +// Instance is an alias for types.Instance. +type Instance = types.Instance + +// GetInstances returns info.Instances. +func GetInstances(info *types.Info) map[*ast.Ident]Instance { + return info.Instances } -// Environment is an alias for types.Environment. -type Environment = types.Environment +// Context is an alias for types.Context. +type Context = types.Context // Instantiate calls types.Instantiate. -func Instantiate(env *Environment, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { - return types.Instantiate(env, typ, targs, validate) +func Instantiate(ctxt *Context, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { + return types.Instantiate(ctxt, typ, targs, validate) } diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeterm.go b/vendor/golang.org/x/tools/internal/typeparams/typeterm.go new file mode 100644 index 000000000..7ddee28d9 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/typeterm.go @@ -0,0 +1,170 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by copytermlist.go DO NOT EDIT. + +package typeparams + +import "go/types" + +// A term describes elementary type sets: +// +// ∅: (*term)(nil) == ∅ // set of no types (empty set) +// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse) +// T: &term{false, T} == {T} // set of type T +// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t +// +type term struct { + tilde bool // valid if typ != nil + typ types.Type +} + +func (x *term) String() string { + switch { + case x == nil: + return "∅" + case x.typ == nil: + return "𝓤" + case x.tilde: + return "~" + x.typ.String() + default: + return x.typ.String() + } +} + +// equal reports whether x and y represent the same type set. +func (x *term) equal(y *term) bool { + // easy cases + switch { + case x == nil || y == nil: + return x == y + case x.typ == nil || y.typ == nil: + return x.typ == y.typ + } + // ∅ ⊂ x, y ⊂ 𝓤 + + return x.tilde == y.tilde && types.Identical(x.typ, y.typ) +} + +// union returns the union x ∪ y: zero, one, or two non-nil terms. +func (x *term) union(y *term) (_, _ *term) { + // easy cases + switch { + case x == nil && y == nil: + return nil, nil // ∅ ∪ ∅ == ∅ + case x == nil: + return y, nil // ∅ ∪ y == y + case y == nil: + return x, nil // x ∪ ∅ == x + case x.typ == nil: + return x, nil // 𝓤 ∪ y == 𝓤 + case y.typ == nil: + return y, nil // x ∪ 𝓤 == 𝓤 + } + // ∅ ⊂ x, y ⊂ 𝓤 + + if x.disjoint(y) { + return x, y // x ∪ y == (x, y) if x ∩ y == ∅ + } + // x.typ == y.typ + + // ~t ∪ ~t == ~t + // ~t ∪ T == ~t + // T ∪ ~t == ~t + // T ∪ T == T + if x.tilde || !y.tilde { + return x, nil + } + return y, nil +} + +// intersect returns the intersection x ∩ y. +func (x *term) intersect(y *term) *term { + // easy cases + switch { + case x == nil || y == nil: + return nil // ∅ ∩ y == ∅ and ∩ ∅ == ∅ + case x.typ == nil: + return y // 𝓤 ∩ y == y + case y.typ == nil: + return x // x ∩ 𝓤 == x + } + // ∅ ⊂ x, y ⊂ 𝓤 + + if x.disjoint(y) { + return nil // x ∩ y == ∅ if x ∩ y == ∅ + } + // x.typ == y.typ + + // ~t ∩ ~t == ~t + // ~t ∩ T == T + // T ∩ ~t == T + // T ∩ T == T + if !x.tilde || y.tilde { + return x + } + return y +} + +// includes reports whether t ∈ x. +func (x *term) includes(t types.Type) bool { + // easy cases + switch { + case x == nil: + return false // t ∈ ∅ == false + case x.typ == nil: + return true // t ∈ 𝓤 == true + } + // ∅ ⊂ x ⊂ 𝓤 + + u := t + if x.tilde { + u = under(u) + } + return types.Identical(x.typ, u) +} + +// subsetOf reports whether x ⊆ y. +func (x *term) subsetOf(y *term) bool { + // easy cases + switch { + case x == nil: + return true // ∅ ⊆ y == true + case y == nil: + return false // x ⊆ ∅ == false since x != ∅ + case y.typ == nil: + return true // x ⊆ 𝓤 == true + case x.typ == nil: + return false // 𝓤 ⊆ y == false since y != 𝓤 + } + // ∅ ⊂ x, y ⊂ 𝓤 + + if x.disjoint(y) { + return false // x ⊆ y == false if x ∩ y == ∅ + } + // x.typ == y.typ + + // ~t ⊆ ~t == true + // ~t ⊆ T == false + // T ⊆ ~t == true + // T ⊆ T == true + return !x.tilde || y.tilde +} + +// disjoint reports whether x ∩ y == ∅. +// x.typ and y.typ must not be nil. +func (x *term) disjoint(y *term) bool { + if debug && (x.typ == nil || y.typ == nil) { + panic("invalid argument(s)") + } + ux := x.typ + if y.tilde { + ux = under(ux) + } + uy := y.typ + if x.tilde { + uy = under(uy) + } + return !types.Identical(ux, uy) +} diff --git a/vendor/gotest.tools/v3/icmd/command.go b/vendor/gotest.tools/v3/icmd/command.go new file mode 100644 index 000000000..3f0c64893 --- /dev/null +++ b/vendor/gotest.tools/v3/icmd/command.go @@ -0,0 +1,291 @@ +/*Package icmd executes binaries and provides convenient assertions for testing the results. + */ +package icmd // import "gotest.tools/v3/icmd" + +import ( + "bytes" + "fmt" + "io" + "os" + "os/exec" + "strings" + "sync" + "time" + + "gotest.tools/v3/assert" + "gotest.tools/v3/assert/cmp" +) + +type helperT interface { + Helper() +} + +// None is a token to inform Result.Assert that the output should be empty +const None = "[NOTHING]" + +type lockedBuffer struct { + m sync.RWMutex + buf bytes.Buffer +} + +func (buf *lockedBuffer) Write(b []byte) (int, error) { + buf.m.Lock() + defer buf.m.Unlock() + return buf.buf.Write(b) +} + +func (buf *lockedBuffer) String() string { + buf.m.RLock() + defer buf.m.RUnlock() + return buf.buf.String() +} + +// Result stores the result of running a command +type Result struct { + Cmd *exec.Cmd + ExitCode int + Error error + // Timeout is true if the command was killed because it ran for too long + Timeout bool + outBuffer *lockedBuffer + errBuffer *lockedBuffer +} + +// Assert compares the Result against the Expected struct, and fails the test if +// any of the expectations are not met. +// +// This function is equivalent to assert.Assert(t, result.Equal(exp)). +func (r *Result) Assert(t assert.TestingT, exp Expected) *Result { + if ht, ok := t.(helperT); ok { + ht.Helper() + } + assert.Assert(t, r.Equal(exp)) + return r +} + +// Equal compares the result to Expected. If the result doesn't match expected +// returns a formatted failure message with the command, stdout, stderr, exit code, +// and any failed expectations. +func (r *Result) Equal(exp Expected) cmp.Comparison { + return func() cmp.Result { + return cmp.ResultFromError(r.match(exp)) + } +} + +// Compare the result to Expected and return an error if they do not match. +func (r *Result) Compare(exp Expected) error { + return r.match(exp) +} + +// nolint: gocyclo +func (r *Result) match(exp Expected) error { + errors := []string{} + add := func(format string, args ...interface{}) { + errors = append(errors, fmt.Sprintf(format, args...)) + } + + if exp.ExitCode != r.ExitCode { + add("ExitCode was %d expected %d", r.ExitCode, exp.ExitCode) + } + if exp.Timeout != r.Timeout { + if exp.Timeout { + add("Expected command to timeout") + } else { + add("Expected command to finish, but it hit the timeout") + } + } + if !matchOutput(exp.Out, r.Stdout()) { + add("Expected stdout to contain %q", exp.Out) + } + if !matchOutput(exp.Err, r.Stderr()) { + add("Expected stderr to contain %q", exp.Err) + } + switch { + // If a non-zero exit code is expected there is going to be an error. + // Don't require an error message as well as an exit code because the + // error message is going to be "exit status which is not useful + case exp.Error == "" && exp.ExitCode != 0: + case exp.Error == "" && r.Error != nil: + add("Expected no error") + case exp.Error != "" && r.Error == nil: + add("Expected error to contain %q, but there was no error", exp.Error) + case exp.Error != "" && !strings.Contains(r.Error.Error(), exp.Error): + add("Expected error to contain %q", exp.Error) + } + + if len(errors) == 0 { + return nil + } + return fmt.Errorf("%s\nFailures:\n%s", r, strings.Join(errors, "\n")) +} + +func matchOutput(expected string, actual string) bool { + switch expected { + case None: + return actual == "" + default: + return strings.Contains(actual, expected) + } +} + +func (r *Result) String() string { + var timeout string + if r.Timeout { + timeout = " (timeout)" + } + var errString string + if r.Error != nil { + errString = "\nError: " + r.Error.Error() + } + + return fmt.Sprintf(` +Command: %s +ExitCode: %d%s%s +Stdout: %v +Stderr: %v +`, + strings.Join(r.Cmd.Args, " "), + r.ExitCode, + timeout, + errString, + r.Stdout(), + r.Stderr()) +} + +// Expected is the expected output from a Command. This struct is compared to a +// Result struct by Result.Assert(). +type Expected struct { + ExitCode int + Timeout bool + Error string + Out string + Err string +} + +// Success is the default expected result. A Success result is one with a 0 +// ExitCode. +var Success = Expected{} + +// Stdout returns the stdout of the process as a string +func (r *Result) Stdout() string { + return r.outBuffer.String() +} + +// Stderr returns the stderr of the process as a string +func (r *Result) Stderr() string { + return r.errBuffer.String() +} + +// Combined returns the stdout and stderr combined into a single string +func (r *Result) Combined() string { + return r.outBuffer.String() + r.errBuffer.String() +} + +func (r *Result) setExitError(err error) { + if err == nil { + return + } + r.Error = err + r.ExitCode = processExitCode(err) +} + +// Cmd contains the arguments and options for a process to run as part of a test +// suite. +type Cmd struct { + Command []string + Timeout time.Duration + Stdin io.Reader + Stdout io.Writer + Dir string + Env []string + ExtraFiles []*os.File +} + +// Command create a simple Cmd with the specified command and arguments +func Command(command string, args ...string) Cmd { + return Cmd{Command: append([]string{command}, args...)} +} + +// RunCmd runs a command and returns a Result +func RunCmd(cmd Cmd, cmdOperators ...CmdOp) *Result { + for _, op := range cmdOperators { + op(&cmd) + } + result := StartCmd(cmd) + if result.Error != nil { + return result + } + return WaitOnCmd(cmd.Timeout, result) +} + +// RunCommand runs a command with default options, and returns a result +func RunCommand(command string, args ...string) *Result { + return RunCmd(Command(command, args...)) +} + +// StartCmd starts a command, but doesn't wait for it to finish +func StartCmd(cmd Cmd) *Result { + result := buildCmd(cmd) + if result.Error != nil { + return result + } + result.setExitError(result.Cmd.Start()) + return result +} + +// TODO: support exec.CommandContext +func buildCmd(cmd Cmd) *Result { + var execCmd *exec.Cmd + switch len(cmd.Command) { + case 1: + execCmd = exec.Command(cmd.Command[0]) + default: + execCmd = exec.Command(cmd.Command[0], cmd.Command[1:]...) + } + outBuffer := new(lockedBuffer) + errBuffer := new(lockedBuffer) + + execCmd.Stdin = cmd.Stdin + execCmd.Dir = cmd.Dir + execCmd.Env = cmd.Env + if cmd.Stdout != nil { + execCmd.Stdout = io.MultiWriter(outBuffer, cmd.Stdout) + } else { + execCmd.Stdout = outBuffer + } + execCmd.Stderr = errBuffer + execCmd.ExtraFiles = cmd.ExtraFiles + + return &Result{ + Cmd: execCmd, + outBuffer: outBuffer, + errBuffer: errBuffer, + } +} + +// WaitOnCmd waits for a command to complete. If timeout is non-nil then +// only wait until the timeout. +func WaitOnCmd(timeout time.Duration, result *Result) *Result { + if timeout == time.Duration(0) { + result.setExitError(result.Cmd.Wait()) + return result + } + + done := make(chan error, 1) + // Wait for command to exit in a goroutine + go func() { + done <- result.Cmd.Wait() + }() + + select { + case <-time.After(timeout): + killErr := result.Cmd.Process.Kill() + if killErr != nil { + fmt.Printf("failed to kill (pid=%d): %v\n", result.Cmd.Process.Pid, killErr) + } + result.Timeout = true + case err := <-done: + result.setExitError(err) + } + return result +} diff --git a/vendor/gotest.tools/v3/icmd/exitcode.go b/vendor/gotest.tools/v3/icmd/exitcode.go new file mode 100644 index 000000000..9356dbcde --- /dev/null +++ b/vendor/gotest.tools/v3/icmd/exitcode.go @@ -0,0 +1,32 @@ +package icmd + +import ( + "os/exec" + "syscall" + + "github.com/pkg/errors" +) + +// getExitCode returns the ExitStatus of a process from the error returned by +// exec.Run(). If the exit status could not be parsed an error is returned. +func getExitCode(err error) (int, error) { + if exiterr, ok := err.(*exec.ExitError); ok { + if procExit, ok := exiterr.Sys().(syscall.WaitStatus); ok { + return procExit.ExitStatus(), nil + } + } + return 0, errors.Wrap(err, "failed to get exit code") +} + +func processExitCode(err error) (exitCode int) { + if err == nil { + return 0 + } + exitCode, exiterr := getExitCode(err) + if exiterr != nil { + // TODO: Fix this so we check the error's text. + // we've failed to retrieve exit code, so we set it to 127 + return 127 + } + return exitCode +} diff --git a/vendor/gotest.tools/v3/icmd/ops.go b/vendor/gotest.tools/v3/icmd/ops.go new file mode 100644 index 000000000..35c3958d5 --- /dev/null +++ b/vendor/gotest.tools/v3/icmd/ops.go @@ -0,0 +1,46 @@ +package icmd + +import ( + "io" + "os" + "time" +) + +// CmdOp is an operation which modified a Cmd structure used to execute commands +type CmdOp func(*Cmd) + +// WithTimeout sets the timeout duration of the command +func WithTimeout(timeout time.Duration) CmdOp { + return func(c *Cmd) { + c.Timeout = timeout + } +} + +// WithEnv sets the environment variable of the command. +// Each arguments are in the form of KEY=VALUE +func WithEnv(env ...string) CmdOp { + return func(c *Cmd) { + c.Env = env + } +} + +// Dir sets the working directory of the command +func Dir(path string) CmdOp { + return func(c *Cmd) { + c.Dir = path + } +} + +// WithStdin sets the standard input of the command to the specified reader +func WithStdin(r io.Reader) CmdOp { + return func(c *Cmd) { + c.Stdin = r + } +} + +// WithExtraFile adds a file descriptor to the command +func WithExtraFile(f *os.File) CmdOp { + return func(c *Cmd) { + c.ExtraFiles = append(c.ExtraFiles, f) + } +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/interface.go new file mode 100644 index 000000000..14a6db438 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package admissionregistration + +import ( + v1 "k8s.io/client-go/informers/admissionregistration/v1" + v1beta1 "k8s.io/client-go/informers/admissionregistration/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go new file mode 100644 index 000000000..1ecae9ecf --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. + MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer + // ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. + ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. +func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer { + return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. +func (v *version) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer { + return &validatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..b768f6f7f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations. +type MutatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.MutatingWebhookConfigurationLister +} + +type mutatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1.MutatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1.MutatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *mutatingWebhookConfigurationInformer) Lister() v1.MutatingWebhookConfigurationLister { + return v1.NewMutatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..8ddcdf2d9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations. +type ValidatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ValidatingWebhookConfigurationLister +} + +type validatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1.ValidatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1.ValidatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *validatingWebhookConfigurationInformer) Lister() v1.ValidatingWebhookConfigurationLister { + return v1.NewValidatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go new file mode 100644 index 000000000..d1e2b61be --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. + MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer + // ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. + ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. +func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer { + return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ValidatingWebhookConfigurations returns a ValidatingWebhookConfigurationInformer. +func (v *version) ValidatingWebhookConfigurations() ValidatingWebhookConfigurationInformer { + return &validatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..12c8ec1fb --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationInformer provides access to a shared informer and lister for +// MutatingWebhookConfigurations. +type MutatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.MutatingWebhookConfigurationLister +} + +type mutatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1beta1.MutatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1beta1.MutatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *mutatingWebhookConfigurationInformer) Lister() v1beta1.MutatingWebhookConfigurationLister { + return v1beta1.NewMutatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..05eb05097 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/admissionregistration/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationInformer provides access to a shared informer and lister for +// ValidatingWebhookConfigurations. +type ValidatingWebhookConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ValidatingWebhookConfigurationLister +} + +type validatingWebhookConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(context.TODO(), options) + }, + }, + &admissionregistrationv1beta1.ValidatingWebhookConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&admissionregistrationv1beta1.ValidatingWebhookConfiguration{}, f.defaultInformer) +} + +func (f *validatingWebhookConfigurationInformer) Lister() v1beta1.ValidatingWebhookConfigurationLister { + return v1beta1.NewValidatingWebhookConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/interface.go b/vendor/k8s.io/client-go/informers/apiserverinternal/interface.go new file mode 100644 index 000000000..122c03099 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package apiserverinternal + +import ( + v1alpha1 "k8s.io/client-go/informers/apiserverinternal/v1alpha1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go new file mode 100644 index 000000000..9778325c6 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // StorageVersions returns a StorageVersionInformer. + StorageVersions() StorageVersionInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// StorageVersions returns a StorageVersionInformer. +func (v *version) StorageVersions() StorageVersionInformer { + return &storageVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go new file mode 100644 index 000000000..34175b522 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/apiserverinternal/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// StorageVersionInformer provides access to a shared informer and lister for +// StorageVersions. +type StorageVersionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.StorageVersionLister +} + +type storageVersionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageVersionInformer constructs a new informer for StorageVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageVersionInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageVersionInformer constructs a new informer for StorageVersion type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InternalV1alpha1().StorageVersions().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.InternalV1alpha1().StorageVersions().Watch(context.TODO(), options) + }, + }, + &apiserverinternalv1alpha1.StorageVersion{}, + resyncPeriod, + indexers, + ) +} + +func (f *storageVersionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageVersionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storageVersionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiserverinternalv1alpha1.StorageVersion{}, f.defaultInformer) +} + +func (f *storageVersionInformer) Lister() v1alpha1.StorageVersionLister { + return v1alpha1.NewStorageVersionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/interface.go b/vendor/k8s.io/client-go/informers/apps/interface.go new file mode 100644 index 000000000..02eefe584 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/interface.go @@ -0,0 +1,62 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package apps + +import ( + v1 "k8s.io/client-go/informers/apps/v1" + v1beta1 "k8s.io/client-go/informers/apps/v1beta1" + v1beta2 "k8s.io/client-go/informers/apps/v1beta2" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface + // V1beta2 provides access to shared informers for resources in V1beta2. + V1beta2() v1beta2.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta2 returns a new v1beta2.Interface. +func (g *group) V1beta2() v1beta2.Interface { + return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go new file mode 100644 index 000000000..31e2b74d0 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ControllerRevisionLister +} + +type controllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.ControllerRevision{}, f.defaultInformer) +} + +func (f *controllerRevisionInformer) Lister() v1.ControllerRevisionLister { + return v1.NewControllerRevisionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go b/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go new file mode 100644 index 000000000..da7fe9509 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.DaemonSetLister +} + +type daemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.DaemonSet{}, f.defaultInformer) +} + +func (f *daemonSetInformer) Lister() v1.DaemonSetLister { + return v1.NewDaemonSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1/deployment.go new file mode 100644 index 000000000..bd639bb3d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/deployment.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1.DeploymentLister { + return v1.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/interface.go b/vendor/k8s.io/client-go/informers/apps/v1/interface.go new file mode 100644 index 000000000..fab1e76bd --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/interface.go @@ -0,0 +1,73 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ControllerRevisions returns a ControllerRevisionInformer. + ControllerRevisions() ControllerRevisionInformer + // DaemonSets returns a DaemonSetInformer. + DaemonSets() DaemonSetInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // ReplicaSets returns a ReplicaSetInformer. + ReplicaSets() ReplicaSetInformer + // StatefulSets returns a StatefulSetInformer. + StatefulSets() StatefulSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v *version) ControllerRevisions() ControllerRevisionInformer { + return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v *version) DaemonSets() DaemonSetInformer { + return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v *version) ReplicaSets() ReplicaSetInformer { + return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v *version) StatefulSets() StatefulSetInformer { + return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go b/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go new file mode 100644 index 000000000..6d81a471a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ReplicaSetLister +} + +type replicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.ReplicaSet{}, f.defaultInformer) +} + +func (f *replicaSetInformer) Lister() v1.ReplicaSetLister { + return v1.NewReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go new file mode 100644 index 000000000..c99bbb73e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + appsv1 "k8s.io/api/apps/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/apps/v1" + cache "k8s.io/client-go/tools/cache" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.StatefulSetLister +} + +type statefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1.StatefulSet{}, f.defaultInformer) +} + +func (f *statefulSetInformer) Lister() v1.StatefulSetLister { + return v1.NewStatefulSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go new file mode 100644 index 000000000..cb36bd7fd --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ControllerRevisionLister +} + +type controllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.ControllerRevision{}, f.defaultInformer) +} + +func (f *controllerRevisionInformer) Lister() v1beta1.ControllerRevisionLister { + return v1beta1.NewControllerRevisionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go new file mode 100644 index 000000000..e02a13c2f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1beta1.DeploymentLister { + return v1beta1.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go new file mode 100644 index 000000000..326939cd1 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/interface.go @@ -0,0 +1,59 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ControllerRevisions returns a ControllerRevisionInformer. + ControllerRevisions() ControllerRevisionInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // StatefulSets returns a StatefulSetInformer. + StatefulSets() StatefulSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v *version) ControllerRevisions() ControllerRevisionInformer { + return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v *version) StatefulSets() StatefulSetInformer { + return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go new file mode 100644 index 000000000..b845cc99c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/apps/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.StatefulSetLister +} + +type statefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta1().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta1.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta1.StatefulSet{}, f.defaultInformer) +} + +func (f *statefulSetInformer) Lister() v1beta1.StatefulSetLister { + return v1beta1.NewStatefulSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go new file mode 100644 index 000000000..4d0e91320 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionInformer provides access to a shared informer and lister for +// ControllerRevisions. +type ControllerRevisionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.ControllerRevisionLister +} + +type controllerRevisionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ControllerRevisions(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ControllerRevisions(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.ControllerRevision{}, + resyncPeriod, + indexers, + ) +} + +func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.ControllerRevision{}, f.defaultInformer) +} + +func (f *controllerRevisionInformer) Lister() v1beta2.ControllerRevisionLister { + return v1beta2.NewControllerRevisionLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go new file mode 100644 index 000000000..280e2fe46 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.DaemonSetLister +} + +type daemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.DaemonSet{}, f.defaultInformer) +} + +func (f *daemonSetInformer) Lister() v1beta2.DaemonSetLister { + return v1beta2.NewDaemonSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go new file mode 100644 index 000000000..67bdb7972 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1beta2.DeploymentLister { + return v1beta2.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go new file mode 100644 index 000000000..ded89bd5b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/interface.go @@ -0,0 +1,73 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ControllerRevisions returns a ControllerRevisionInformer. + ControllerRevisions() ControllerRevisionInformer + // DaemonSets returns a DaemonSetInformer. + DaemonSets() DaemonSetInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // ReplicaSets returns a ReplicaSetInformer. + ReplicaSets() ReplicaSetInformer + // StatefulSets returns a StatefulSetInformer. + StatefulSets() StatefulSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ControllerRevisions returns a ControllerRevisionInformer. +func (v *version) ControllerRevisions() ControllerRevisionInformer { + return &controllerRevisionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v *version) DaemonSets() DaemonSetInformer { + return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v *version) ReplicaSets() ReplicaSetInformer { + return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StatefulSets returns a StatefulSetInformer. +func (v *version) StatefulSets() StatefulSetInformer { + return &statefulSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go new file mode 100644 index 000000000..85d12bb65 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.ReplicaSetLister +} + +type replicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.ReplicaSet{}, f.defaultInformer) +} + +func (f *replicaSetInformer) Lister() v1beta2.ReplicaSetLister { + return v1beta2.NewReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go new file mode 100644 index 000000000..2fab6f7b2 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + "context" + time "time" + + appsv1beta2 "k8s.io/api/apps/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta2 "k8s.io/client-go/listers/apps/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// StatefulSetInformer provides access to a shared informer and lister for +// StatefulSets. +type StatefulSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta2.StatefulSetLister +} + +type statefulSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().StatefulSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AppsV1beta2().StatefulSets(namespace).Watch(context.TODO(), options) + }, + }, + &appsv1beta2.StatefulSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&appsv1beta2.StatefulSet{}, f.defaultInformer) +} + +func (f *statefulSetInformer) Lister() v1beta2.StatefulSetLister { + return v1beta2.NewStatefulSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/interface.go new file mode 100644 index 000000000..81e839014 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/interface.go @@ -0,0 +1,62 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package autoscaling + +import ( + v1 "k8s.io/client-go/informers/autoscaling/v1" + v2beta1 "k8s.io/client-go/informers/autoscaling/v2beta1" + v2beta2 "k8s.io/client-go/informers/autoscaling/v2beta2" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V2beta1 provides access to shared informers for resources in V2beta1. + V2beta1() v2beta1.Interface + // V2beta2 provides access to shared informers for resources in V2beta2. + V2beta2() v2beta2.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V2beta1 returns a new v2beta1.Interface. +func (g *group) V2beta1() v2beta1.Interface { + return v2beta1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V2beta2 returns a new v2beta2.Interface. +func (g *group) V2beta2() v2beta2.Interface { + return v2beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 000000000..44f041e90 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + autoscalingv1 "k8s.io/api/autoscaling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/autoscaling/v1" + cache "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.HorizontalPodAutoscalerLister +} + +type horizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv1.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv1.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f *horizontalPodAutoscalerInformer) Lister() v1.HorizontalPodAutoscalerLister { + return v1.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go new file mode 100644 index 000000000..601d0f77f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. + HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { + return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go new file mode 100644 index 000000000..6385a2a19 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta1 + +import ( + "context" + time "time" + + autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v2beta1 "k8s.io/client-go/listers/autoscaling/v2beta1" + cache "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta1.HorizontalPodAutoscalerLister +} + +type horizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv2beta1.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv2beta1.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f *horizontalPodAutoscalerInformer) Lister() v2beta1.HorizontalPodAutoscalerLister { + return v2beta1.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go new file mode 100644 index 000000000..ff5d44b09 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. + HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { + return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go new file mode 100644 index 000000000..f1ac3f073 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v2beta2 "k8s.io/client-go/listers/autoscaling/v2beta2" + cache "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for +// HorizontalPodAutoscalers. +type HorizontalPodAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.HorizontalPodAutoscalerLister +} + +type horizontalPodAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv2beta2.HorizontalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv2beta2.HorizontalPodAutoscaler{}, f.defaultInformer) +} + +func (f *horizontalPodAutoscalerInformer) Lister() v2beta2.HorizontalPodAutoscalerLister { + return v2beta2.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go new file mode 100644 index 000000000..e482c5792 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. + HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. +func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { + return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/batch/interface.go b/vendor/k8s.io/client-go/informers/batch/interface.go new file mode 100644 index 000000000..53b81c7ec --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package batch + +import ( + v1 "k8s.io/client-go/informers/batch/v1" + v1beta1 "k8s.io/client-go/informers/batch/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go b/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go new file mode 100644 index 000000000..fdfb65513 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + batchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/batch/v1" + cache "k8s.io/client-go/tools/cache" +) + +// CronJobInformer provides access to a shared informer and lister for +// CronJobs. +type CronJobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CronJobLister +} + +type cronJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().CronJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().CronJobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.CronJob{}, + resyncPeriod, + indexers, + ) +} + +func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cronJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.CronJob{}, f.defaultInformer) +} + +func (f *cronJobInformer) Lister() v1.CronJobLister { + return v1.NewCronJobLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1/interface.go b/vendor/k8s.io/client-go/informers/batch/v1/interface.go new file mode 100644 index 000000000..84567fb59 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CronJobs returns a CronJobInformer. + CronJobs() CronJobInformer + // Jobs returns a JobInformer. + Jobs() JobInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CronJobs returns a CronJobInformer. +func (v *version) CronJobs() CronJobInformer { + return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Jobs returns a JobInformer. +func (v *version) Jobs() JobInformer { + return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1/job.go b/vendor/k8s.io/client-go/informers/batch/v1/job.go new file mode 100644 index 000000000..4992f5228 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1/job.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + batchv1 "k8s.io/api/batch/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/batch/v1" + cache "k8s.io/client-go/tools/cache" +) + +// JobInformer provides access to a shared informer and lister for +// Jobs. +type JobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.JobLister +} + +type jobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredJobInformer constructs a new informer for Job type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1().Jobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1.Job{}, + resyncPeriod, + indexers, + ) +} + +func (f *jobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *jobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1.Job{}, f.defaultInformer) +} + +func (f *jobInformer) Lister() v1.JobLister { + return v1.NewJobLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go b/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go new file mode 100644 index 000000000..820c93eaa --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + batchv1beta1 "k8s.io/api/batch/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/batch/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CronJobInformer provides access to a shared informer and lister for +// CronJobs. +type CronJobInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CronJobLister +} + +type cronJobInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCronJobInformer constructs a new informer for CronJob type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1beta1().CronJobs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BatchV1beta1().CronJobs(namespace).Watch(context.TODO(), options) + }, + }, + &batchv1beta1.CronJob{}, + resyncPeriod, + indexers, + ) +} + +func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cronJobInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&batchv1beta1.CronJob{}, f.defaultInformer) +} + +func (f *cronJobInformer) Lister() v1beta1.CronJobLister { + return v1beta1.NewCronJobLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go new file mode 100644 index 000000000..76cae22d6 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/batch/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CronJobs returns a CronJobInformer. + CronJobs() CronJobInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CronJobs returns a CronJobInformer. +func (v *version) CronJobs() CronJobInformer { + return &cronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/certificates/interface.go b/vendor/k8s.io/client-go/informers/certificates/interface.go new file mode 100644 index 000000000..e38d01177 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package certificates + +import ( + v1 "k8s.io/client-go/informers/certificates/v1" + v1beta1 "k8s.io/client-go/informers/certificates/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go b/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go new file mode 100644 index 000000000..73d33a914 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + certificatesv1 "k8s.io/api/certificates/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/certificates/v1" + cache "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests. +type CertificateSigningRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CertificateSigningRequestLister +} + +type certificateSigningRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().CertificateSigningRequests().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1().CertificateSigningRequests().Watch(context.TODO(), options) + }, + }, + &certificatesv1.CertificateSigningRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certificatesv1.CertificateSigningRequest{}, f.defaultInformer) +} + +func (f *certificateSigningRequestInformer) Lister() v1.CertificateSigningRequestLister { + return v1.NewCertificateSigningRequestLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/interface.go b/vendor/k8s.io/client-go/informers/certificates/v1/interface.go new file mode 100644 index 000000000..91ccfb715 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CertificateSigningRequests returns a CertificateSigningRequestInformer. + CertificateSigningRequests() CertificateSigningRequestInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CertificateSigningRequests returns a CertificateSigningRequestInformer. +func (v *version) CertificateSigningRequests() CertificateSigningRequestInformer { + return &certificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go new file mode 100644 index 000000000..4e167ab8b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/certificates/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestInformer provides access to a shared informer and lister for +// CertificateSigningRequests. +type CertificateSigningRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CertificateSigningRequestLister +} + +type certificateSigningRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1beta1().CertificateSigningRequests().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CertificatesV1beta1().CertificateSigningRequests().Watch(context.TODO(), options) + }, + }, + &certificatesv1beta1.CertificateSigningRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&certificatesv1beta1.CertificateSigningRequest{}, f.defaultInformer) +} + +func (f *certificateSigningRequestInformer) Lister() v1beta1.CertificateSigningRequestLister { + return v1beta1.NewCertificateSigningRequestLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go new file mode 100644 index 000000000..258dd1d0e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CertificateSigningRequests returns a CertificateSigningRequestInformer. + CertificateSigningRequests() CertificateSigningRequestInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CertificateSigningRequests returns a CertificateSigningRequestInformer. +func (v *version) CertificateSigningRequests() CertificateSigningRequestInformer { + return &certificateSigningRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/coordination/interface.go b/vendor/k8s.io/client-go/informers/coordination/interface.go new file mode 100644 index 000000000..54cfd7b9f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package coordination + +import ( + v1 "k8s.io/client-go/informers/coordination/v1" + v1beta1 "k8s.io/client-go/informers/coordination/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1/interface.go b/vendor/k8s.io/client-go/informers/coordination/v1/interface.go new file mode 100644 index 000000000..05c4acbef --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Leases returns a LeaseInformer. + Leases() LeaseInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Leases returns a LeaseInformer. +func (v *version) Leases() LeaseInformer { + return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1/lease.go b/vendor/k8s.io/client-go/informers/coordination/v1/lease.go new file mode 100644 index 000000000..e538923a8 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/v1/lease.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + coordinationv1 "k8s.io/api/coordination/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/coordination/v1" + cache "k8s.io/client-go/tools/cache" +) + +// LeaseInformer provides access to a shared informer and lister for +// Leases. +type LeaseInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.LeaseLister +} + +type leaseInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1().Leases(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1().Leases(namespace).Watch(context.TODO(), options) + }, + }, + &coordinationv1.Lease{}, + resyncPeriod, + indexers, + ) +} + +func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *leaseInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&coordinationv1.Lease{}, f.defaultInformer) +} + +func (f *leaseInformer) Lister() v1.LeaseLister { + return v1.NewLeaseLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go new file mode 100644 index 000000000..360266206 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Leases returns a LeaseInformer. + Leases() LeaseInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Leases returns a LeaseInformer. +func (v *version) Leases() LeaseInformer { + return &leaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go new file mode 100644 index 000000000..5a6959c0b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/coordination/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// LeaseInformer provides access to a shared informer and lister for +// Leases. +type LeaseInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.LeaseLister +} + +type leaseInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLeaseInformer constructs a new informer for Lease type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1beta1().Leases(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoordinationV1beta1().Leases(namespace).Watch(context.TODO(), options) + }, + }, + &coordinationv1beta1.Lease{}, + resyncPeriod, + indexers, + ) +} + +func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *leaseInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&coordinationv1beta1.Lease{}, f.defaultInformer) +} + +func (f *leaseInformer) Lister() v1beta1.LeaseLister { + return v1beta1.NewLeaseLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/interface.go b/vendor/k8s.io/client-go/informers/core/interface.go new file mode 100644 index 000000000..de8396b51 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package core + +import ( + v1 "k8s.io/client-go/informers/core/v1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go b/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go new file mode 100644 index 000000000..ccdee535b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ComponentStatusInformer provides access to a shared informer and lister for +// ComponentStatuses. +type ComponentStatusInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ComponentStatusLister +} + +type componentStatusInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredComponentStatusInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredComponentStatusInformer constructs a new informer for ComponentStatus type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ComponentStatuses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ComponentStatuses().Watch(context.TODO(), options) + }, + }, + &corev1.ComponentStatus{}, + resyncPeriod, + indexers, + ) +} + +func (f *componentStatusInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredComponentStatusInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *componentStatusInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ComponentStatus{}, f.defaultInformer) +} + +func (f *componentStatusInformer) Lister() v1.ComponentStatusLister { + return v1.NewComponentStatusLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/configmap.go b/vendor/k8s.io/client-go/informers/core/v1/configmap.go new file mode 100644 index 000000000..625358178 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/configmap.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ConfigMapInformer provides access to a shared informer and lister for +// ConfigMaps. +type ConfigMapInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ConfigMapLister +} + +type configMapInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredConfigMapInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredConfigMapInformer constructs a new informer for ConfigMap type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ConfigMaps(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ConfigMaps(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ConfigMap{}, + resyncPeriod, + indexers, + ) +} + +func (f *configMapInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredConfigMapInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *configMapInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ConfigMap{}, f.defaultInformer) +} + +func (f *configMapInformer) Lister() v1.ConfigMapLister { + return v1.NewConfigMapLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/endpoints.go b/vendor/k8s.io/client-go/informers/core/v1/endpoints.go new file mode 100644 index 000000000..cd0f25b7f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/endpoints.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointsInformer provides access to a shared informer and lister for +// Endpoints. +type EndpointsInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EndpointsLister +} + +type endpointsInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointsInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointsInformer constructs a new informer for Endpoints type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Endpoints(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Endpoints(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Endpoints{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointsInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointsInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointsInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Endpoints{}, f.defaultInformer) +} + +func (f *endpointsInformer) Lister() v1.EndpointsLister { + return v1.NewEndpointsLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/event.go b/vendor/k8s.io/client-go/informers/core/v1/event.go new file mode 100644 index 000000000..8825e9b7a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/event.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EventLister +} + +type eventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Event{}, f.defaultInformer) +} + +func (f *eventInformer) Lister() v1.EventLister { + return v1.NewEventLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/interface.go b/vendor/k8s.io/client-go/informers/core/v1/interface.go new file mode 100644 index 000000000..b2216a05c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/interface.go @@ -0,0 +1,150 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ComponentStatuses returns a ComponentStatusInformer. + ComponentStatuses() ComponentStatusInformer + // ConfigMaps returns a ConfigMapInformer. + ConfigMaps() ConfigMapInformer + // Endpoints returns a EndpointsInformer. + Endpoints() EndpointsInformer + // Events returns a EventInformer. + Events() EventInformer + // LimitRanges returns a LimitRangeInformer. + LimitRanges() LimitRangeInformer + // Namespaces returns a NamespaceInformer. + Namespaces() NamespaceInformer + // Nodes returns a NodeInformer. + Nodes() NodeInformer + // PersistentVolumes returns a PersistentVolumeInformer. + PersistentVolumes() PersistentVolumeInformer + // PersistentVolumeClaims returns a PersistentVolumeClaimInformer. + PersistentVolumeClaims() PersistentVolumeClaimInformer + // Pods returns a PodInformer. + Pods() PodInformer + // PodTemplates returns a PodTemplateInformer. + PodTemplates() PodTemplateInformer + // ReplicationControllers returns a ReplicationControllerInformer. + ReplicationControllers() ReplicationControllerInformer + // ResourceQuotas returns a ResourceQuotaInformer. + ResourceQuotas() ResourceQuotaInformer + // Secrets returns a SecretInformer. + Secrets() SecretInformer + // Services returns a ServiceInformer. + Services() ServiceInformer + // ServiceAccounts returns a ServiceAccountInformer. + ServiceAccounts() ServiceAccountInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ComponentStatuses returns a ComponentStatusInformer. +func (v *version) ComponentStatuses() ComponentStatusInformer { + return &componentStatusInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ConfigMaps returns a ConfigMapInformer. +func (v *version) ConfigMaps() ConfigMapInformer { + return &configMapInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Endpoints returns a EndpointsInformer. +func (v *version) Endpoints() EndpointsInformer { + return &endpointsInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Events returns a EventInformer. +func (v *version) Events() EventInformer { + return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// LimitRanges returns a LimitRangeInformer. +func (v *version) LimitRanges() LimitRangeInformer { + return &limitRangeInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Namespaces returns a NamespaceInformer. +func (v *version) Namespaces() NamespaceInformer { + return &namespaceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Nodes returns a NodeInformer. +func (v *version) Nodes() NodeInformer { + return &nodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PersistentVolumes returns a PersistentVolumeInformer. +func (v *version) PersistentVolumes() PersistentVolumeInformer { + return &persistentVolumeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PersistentVolumeClaims returns a PersistentVolumeClaimInformer. +func (v *version) PersistentVolumeClaims() PersistentVolumeClaimInformer { + return &persistentVolumeClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Pods returns a PodInformer. +func (v *version) Pods() PodInformer { + return &podInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodTemplates returns a PodTemplateInformer. +func (v *version) PodTemplates() PodTemplateInformer { + return &podTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ReplicationControllers returns a ReplicationControllerInformer. +func (v *version) ReplicationControllers() ReplicationControllerInformer { + return &replicationControllerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ResourceQuotas returns a ResourceQuotaInformer. +func (v *version) ResourceQuotas() ResourceQuotaInformer { + return &resourceQuotaInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Secrets returns a SecretInformer. +func (v *version) Secrets() SecretInformer { + return &secretInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Services returns a ServiceInformer. +func (v *version) Services() ServiceInformer { + return &serviceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// ServiceAccounts returns a ServiceAccountInformer. +func (v *version) ServiceAccounts() ServiceAccountInformer { + return &serviceAccountInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/limitrange.go b/vendor/k8s.io/client-go/informers/core/v1/limitrange.go new file mode 100644 index 000000000..4cbfda1f7 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/limitrange.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// LimitRangeInformer provides access to a shared informer and lister for +// LimitRanges. +type LimitRangeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.LimitRangeLister +} + +type limitRangeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLimitRangeInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLimitRangeInformer constructs a new informer for LimitRange type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().LimitRanges(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().LimitRanges(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.LimitRange{}, + resyncPeriod, + indexers, + ) +} + +func (f *limitRangeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLimitRangeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *limitRangeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.LimitRange{}, f.defaultInformer) +} + +func (f *limitRangeInformer) Lister() v1.LimitRangeLister { + return v1.NewLimitRangeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/namespace.go b/vendor/k8s.io/client-go/informers/core/v1/namespace.go new file mode 100644 index 000000000..506f930a7 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/namespace.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// NamespaceInformer provides access to a shared informer and lister for +// Namespaces. +type NamespaceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NamespaceLister +} + +type namespaceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNamespaceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNamespaceInformer constructs a new informer for Namespace type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Namespaces().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Namespaces().Watch(context.TODO(), options) + }, + }, + &corev1.Namespace{}, + resyncPeriod, + indexers, + ) +} + +func (f *namespaceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNamespaceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *namespaceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Namespace{}, f.defaultInformer) +} + +func (f *namespaceInformer) Lister() v1.NamespaceLister { + return v1.NewNamespaceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/node.go b/vendor/k8s.io/client-go/informers/core/v1/node.go new file mode 100644 index 000000000..9939fc2cb --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/node.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// NodeInformer provides access to a shared informer and lister for +// Nodes. +type NodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NodeLister +} + +type nodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredNodeInformer constructs a new informer for Node type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Nodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Nodes().Watch(context.TODO(), options) + }, + }, + &corev1.Node{}, + resyncPeriod, + indexers, + ) +} + +func (f *nodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *nodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Node{}, f.defaultInformer) +} + +func (f *nodeInformer) Lister() v1.NodeLister { + return v1.NewNodeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go b/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go new file mode 100644 index 000000000..c82445997 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeInformer provides access to a shared informer and lister for +// PersistentVolumes. +type PersistentVolumeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PersistentVolumeLister +} + +type persistentVolumeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPersistentVolumeInformer constructs a new informer for PersistentVolume type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumes().Watch(context.TODO(), options) + }, + }, + &corev1.PersistentVolume{}, + resyncPeriod, + indexers, + ) +} + +func (f *persistentVolumeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *persistentVolumeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PersistentVolume{}, f.defaultInformer) +} + +func (f *persistentVolumeInformer) Lister() v1.PersistentVolumeLister { + return v1.NewPersistentVolumeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go b/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go new file mode 100644 index 000000000..7a7df1cff --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeClaimInformer provides access to a shared informer and lister for +// PersistentVolumeClaims. +type PersistentVolumeClaimInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PersistentVolumeClaimLister +} + +type persistentVolumeClaimInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeClaimInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumeClaims(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PersistentVolumeClaims(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.PersistentVolumeClaim{}, + resyncPeriod, + indexers, + ) +} + +func (f *persistentVolumeClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPersistentVolumeClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *persistentVolumeClaimInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PersistentVolumeClaim{}, f.defaultInformer) +} + +func (f *persistentVolumeClaimInformer) Lister() v1.PersistentVolumeClaimLister { + return v1.NewPersistentVolumeClaimLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/pod.go b/vendor/k8s.io/client-go/informers/core/v1/pod.go new file mode 100644 index 000000000..5c713a9b6 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/pod.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PodInformer provides access to a shared informer and lister for +// Pods. +type PodInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodLister +} + +type podInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodInformer constructs a new informer for Pod type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Pods(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Pods(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Pod{}, + resyncPeriod, + indexers, + ) +} + +func (f *podInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Pod{}, f.defaultInformer) +} + +func (f *podInformer) Lister() v1.PodLister { + return v1.NewPodLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go b/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go new file mode 100644 index 000000000..2a16e910d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PodTemplateInformer provides access to a shared informer and lister for +// PodTemplates. +type PodTemplateInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodTemplateLister +} + +type podTemplateInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodTemplateInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PodTemplates(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().PodTemplates(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.PodTemplate{}, + resyncPeriod, + indexers, + ) +} + +func (f *podTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podTemplateInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.PodTemplate{}, f.defaultInformer) +} + +func (f *podTemplateInformer) Lister() v1.PodTemplateLister { + return v1.NewPodTemplateLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go b/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go new file mode 100644 index 000000000..930beb4cd --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicationControllerInformer provides access to a shared informer and lister for +// ReplicationControllers. +type ReplicationControllerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ReplicationControllerLister +} + +type replicationControllerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicationControllerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicationControllerInformer constructs a new informer for ReplicationController type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ReplicationControllers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ReplicationControllers(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ReplicationController{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicationControllerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicationControllerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicationControllerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ReplicationController{}, f.defaultInformer) +} + +func (f *replicationControllerInformer) Lister() v1.ReplicationControllerLister { + return v1.NewReplicationControllerLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go b/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go new file mode 100644 index 000000000..619262a61 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ResourceQuotaInformer provides access to a shared informer and lister for +// ResourceQuotas. +type ResourceQuotaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ResourceQuotaLister +} + +type resourceQuotaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredResourceQuotaInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredResourceQuotaInformer constructs a new informer for ResourceQuota type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ResourceQuotas(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ResourceQuotas(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ResourceQuota{}, + resyncPeriod, + indexers, + ) +} + +func (f *resourceQuotaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredResourceQuotaInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *resourceQuotaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ResourceQuota{}, f.defaultInformer) +} + +func (f *resourceQuotaInformer) Lister() v1.ResourceQuotaLister { + return v1.NewResourceQuotaLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/secret.go b/vendor/k8s.io/client-go/informers/core/v1/secret.go new file mode 100644 index 000000000..a6be07069 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/secret.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// SecretInformer provides access to a shared informer and lister for +// Secrets. +type SecretInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.SecretLister +} + +type secretInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSecretInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSecretInformer constructs a new informer for Secret type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Secrets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Secrets(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Secret{}, + resyncPeriod, + indexers, + ) +} + +func (f *secretInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSecretInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *secretInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Secret{}, f.defaultInformer) +} + +func (f *secretInformer) Lister() v1.SecretLister { + return v1.NewSecretLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/service.go b/vendor/k8s.io/client-go/informers/core/v1/service.go new file mode 100644 index 000000000..3d9ecc6e9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/service.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ServiceInformer provides access to a shared informer and lister for +// Services. +type ServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ServiceLister +} + +type serviceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceInformer constructs a new informer for Service type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Services(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().Services(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.Service{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.Service{}, f.defaultInformer) +} + +func (f *serviceInformer) Lister() v1.ServiceLister { + return v1.NewServiceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go b/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go new file mode 100644 index 000000000..44371c9fa --- /dev/null +++ b/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ServiceAccountInformer provides access to a shared informer and lister for +// ServiceAccounts. +type ServiceAccountInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ServiceAccountLister +} + +type serviceAccountInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredServiceAccountInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredServiceAccountInformer constructs a new informer for ServiceAccount type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ServiceAccounts(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CoreV1().ServiceAccounts(namespace).Watch(context.TODO(), options) + }, + }, + &corev1.ServiceAccount{}, + resyncPeriod, + indexers, + ) +} + +func (f *serviceAccountInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredServiceAccountInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *serviceAccountInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&corev1.ServiceAccount{}, f.defaultInformer) +} + +func (f *serviceAccountInformer) Lister() v1.ServiceAccountLister { + return v1.NewServiceAccountLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/interface.go b/vendor/k8s.io/client-go/informers/discovery/interface.go new file mode 100644 index 000000000..37da9371f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package discovery + +import ( + v1 "k8s.io/client-go/informers/discovery/v1" + v1beta1 "k8s.io/client-go/informers/discovery/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go b/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go new file mode 100644 index 000000000..6c6c3372b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + discoveryv1 "k8s.io/api/discovery/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/discovery/v1" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices. +type EndpointSliceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EndpointSliceLister +} + +type endpointSliceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1().EndpointSlices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1().EndpointSlices(namespace).Watch(context.TODO(), options) + }, + }, + &discoveryv1.EndpointSlice{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&discoveryv1.EndpointSlice{}, f.defaultInformer) +} + +func (f *endpointSliceInformer) Lister() v1.EndpointSliceLister { + return v1.NewEndpointSliceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1/interface.go b/vendor/k8s.io/client-go/informers/discovery/v1/interface.go new file mode 100644 index 000000000..d90c63c0a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // EndpointSlices returns a EndpointSliceInformer. + EndpointSlices() EndpointSliceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// EndpointSlices returns a EndpointSliceInformer. +func (v *version) EndpointSlices() EndpointSliceInformer { + return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go b/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go new file mode 100644 index 000000000..69ae38a91 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/discovery/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices. +type EndpointSliceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.EndpointSliceLister +} + +type endpointSliceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1beta1().EndpointSlices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(context.TODO(), options) + }, + }, + &discoveryv1beta1.EndpointSlice{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&discoveryv1beta1.EndpointSlice{}, f.defaultInformer) +} + +func (f *endpointSliceInformer) Lister() v1beta1.EndpointSliceLister { + return v1beta1.NewEndpointSliceLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go new file mode 100644 index 000000000..4661646e0 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/discovery/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // EndpointSlices returns a EndpointSliceInformer. + EndpointSlices() EndpointSliceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// EndpointSlices returns a EndpointSliceInformer. +func (v *version) EndpointSlices() EndpointSliceInformer { + return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/events/interface.go b/vendor/k8s.io/client-go/informers/events/interface.go new file mode 100644 index 000000000..b350dde5b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package events + +import ( + v1 "k8s.io/client-go/informers/events/v1" + v1beta1 "k8s.io/client-go/informers/events/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/events/v1/event.go b/vendor/k8s.io/client-go/informers/events/v1/event.go new file mode 100644 index 000000000..f8d35ee15 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/v1/event.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + eventsv1 "k8s.io/api/events/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/events/v1" + cache "k8s.io/client-go/tools/cache" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.EventLister +} + +type eventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &eventsv1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&eventsv1.Event{}, f.defaultInformer) +} + +func (f *eventInformer) Lister() v1.EventLister { + return v1.NewEventLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/events/v1/interface.go b/vendor/k8s.io/client-go/informers/events/v1/interface.go new file mode 100644 index 000000000..cd06e2335 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Events returns a EventInformer. + Events() EventInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Events returns a EventInformer. +func (v *version) Events() EventInformer { + return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/events/v1beta1/event.go b/vendor/k8s.io/client-go/informers/events/v1beta1/event.go new file mode 100644 index 000000000..025f6a5cf --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/v1beta1/event.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + eventsv1beta1 "k8s.io/api/events/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/events/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// EventInformer provides access to a shared informer and lister for +// Events. +type EventInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.EventLister +} + +type eventInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEventInformer constructs a new informer for Event type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1beta1().Events(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.EventsV1beta1().Events(namespace).Watch(context.TODO(), options) + }, + }, + &eventsv1beta1.Event{}, + resyncPeriod, + indexers, + ) +} + +func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *eventInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&eventsv1beta1.Event{}, f.defaultInformer) +} + +func (f *eventInformer) Lister() v1beta1.EventLister { + return v1beta1.NewEventLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go new file mode 100644 index 000000000..c71888c9a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/events/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Events returns a EventInformer. + Events() EventInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Events returns a EventInformer. +func (v *version) Events() EventInformer { + return &eventInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/extensions/interface.go b/vendor/k8s.io/client-go/informers/extensions/interface.go new file mode 100644 index 000000000..94a66d385 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package extensions + +import ( + v1beta1 "k8s.io/client-go/informers/extensions/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go new file mode 100644 index 000000000..050080a59 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// DaemonSetInformer provides access to a shared informer and lister for +// DaemonSets. +type DaemonSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.DaemonSetLister +} + +type daemonSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().DaemonSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().DaemonSets(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.DaemonSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.DaemonSet{}, f.defaultInformer) +} + +func (f *daemonSetInformer) Lister() v1beta1.DaemonSetLister { + return v1beta1.NewDaemonSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go new file mode 100644 index 000000000..1b16c5cc9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// DeploymentInformer provides access to a shared informer and lister for +// Deployments. +type DeploymentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.DeploymentLister +} + +type deploymentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredDeploymentInformer constructs a new informer for Deployment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Deployments(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Deployments(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.Deployment{}, + resyncPeriod, + indexers, + ) +} + +func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *deploymentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.Deployment{}, f.defaultInformer) +} + +func (f *deploymentInformer) Lister() v1beta1.DeploymentLister { + return v1beta1.NewDeploymentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go new file mode 100644 index 000000000..f01a88761 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.IngressLister +} + +type ingressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.Ingress{}, f.defaultInformer) +} + +func (f *ingressInformer) Lister() v1beta1.IngressLister { + return v1beta1.NewIngressLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go new file mode 100644 index 000000000..6f0bea7e8 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/interface.go @@ -0,0 +1,80 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // DaemonSets returns a DaemonSetInformer. + DaemonSets() DaemonSetInformer + // Deployments returns a DeploymentInformer. + Deployments() DeploymentInformer + // Ingresses returns a IngressInformer. + Ingresses() IngressInformer + // NetworkPolicies returns a NetworkPolicyInformer. + NetworkPolicies() NetworkPolicyInformer + // PodSecurityPolicies returns a PodSecurityPolicyInformer. + PodSecurityPolicies() PodSecurityPolicyInformer + // ReplicaSets returns a ReplicaSetInformer. + ReplicaSets() ReplicaSetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// DaemonSets returns a DaemonSetInformer. +func (v *version) DaemonSets() DaemonSetInformer { + return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Deployments returns a DeploymentInformer. +func (v *version) Deployments() DeploymentInformer { + return &deploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v *version) Ingresses() IngressInformer { + return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// NetworkPolicies returns a NetworkPolicyInformer. +func (v *version) NetworkPolicies() NetworkPolicyInformer { + return &networkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodSecurityPolicies returns a PodSecurityPolicyInformer. +func (v *version) PodSecurityPolicies() PodSecurityPolicyInformer { + return &podSecurityPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ReplicaSets returns a ReplicaSetInformer. +func (v *version) ReplicaSets() ReplicaSetInformer { + return &replicaSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go new file mode 100644 index 000000000..4a924619f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// NetworkPolicyInformer provides access to a shared informer and lister for +// NetworkPolicies. +type NetworkPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.NetworkPolicyLister +} + +type networkPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().NetworkPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().NetworkPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.NetworkPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.NetworkPolicy{}, f.defaultInformer) +} + +func (f *networkPolicyInformer) Lister() v1beta1.NetworkPolicyLister { + return v1beta1.NewNetworkPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go new file mode 100644 index 000000000..11be2751c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/podsecuritypolicy.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PodSecurityPolicyInformer provides access to a shared informer and lister for +// PodSecurityPolicies. +type PodSecurityPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PodSecurityPolicyLister +} + +type podSecurityPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().PodSecurityPolicies().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().PodSecurityPolicies().Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.PodSecurityPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *podSecurityPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podSecurityPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.PodSecurityPolicy{}, f.defaultInformer) +} + +func (f *podSecurityPolicyInformer) Lister() v1beta1.PodSecurityPolicyLister { + return v1beta1.NewPodSecurityPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go new file mode 100644 index 000000000..f7e224bcf --- /dev/null +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/extensions/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ReplicaSetInformer provides access to a shared informer and lister for +// ReplicaSets. +type ReplicaSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ReplicaSetLister +} + +type replicaSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().ReplicaSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ExtensionsV1beta1().ReplicaSets(namespace).Watch(context.TODO(), options) + }, + }, + &extensionsv1beta1.ReplicaSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&extensionsv1beta1.ReplicaSet{}, f.defaultInformer) +} + +func (f *replicaSetInformer) Lister() v1beta1.ReplicaSetLister { + return v1beta1.NewReplicaSetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/factory.go b/vendor/k8s.io/client-go/informers/factory.go new file mode 100644 index 000000000..c6e102699 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/factory.go @@ -0,0 +1,282 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package informers + +import ( + reflect "reflect" + sync "sync" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + admissionregistration "k8s.io/client-go/informers/admissionregistration" + apiserverinternal "k8s.io/client-go/informers/apiserverinternal" + apps "k8s.io/client-go/informers/apps" + autoscaling "k8s.io/client-go/informers/autoscaling" + batch "k8s.io/client-go/informers/batch" + certificates "k8s.io/client-go/informers/certificates" + coordination "k8s.io/client-go/informers/coordination" + core "k8s.io/client-go/informers/core" + discovery "k8s.io/client-go/informers/discovery" + events "k8s.io/client-go/informers/events" + extensions "k8s.io/client-go/informers/extensions" + flowcontrol "k8s.io/client-go/informers/flowcontrol" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + networking "k8s.io/client-go/informers/networking" + node "k8s.io/client-go/informers/node" + policy "k8s.io/client-go/informers/policy" + rbac "k8s.io/client-go/informers/rbac" + scheduling "k8s.io/client-go/informers/scheduling" + storage "k8s.io/client-go/informers/storage" + kubernetes "k8s.io/client-go/kubernetes" + cache "k8s.io/client-go/tools/cache" +) + +// SharedInformerOption defines the functional option type for SharedInformerFactory. +type SharedInformerOption func(*sharedInformerFactory) *sharedInformerFactory + +type sharedInformerFactory struct { + client kubernetes.Interface + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc + lock sync.Mutex + defaultResync time.Duration + customResync map[reflect.Type]time.Duration + + informers map[reflect.Type]cache.SharedIndexInformer + // startedInformers is used for tracking which informers have been started. + // This allows Start() to be called multiple times safely. + startedInformers map[reflect.Type]bool +} + +// WithCustomResyncConfig sets a custom resync period for the specified informer types. +func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + for k, v := range resyncConfig { + factory.customResync[reflect.TypeOf(k)] = v + } + return factory + } +} + +// WithTweakListOptions sets a custom filter on all listers of the configured SharedInformerFactory. +func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.tweakListOptions = tweakListOptions + return factory + } +} + +// WithNamespace limits the SharedInformerFactory to the specified namespace. +func WithNamespace(namespace string) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.namespace = namespace + return factory + } +} + +// NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. +func NewSharedInformerFactory(client kubernetes.Interface, defaultResync time.Duration) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync) +} + +// NewFilteredSharedInformerFactory constructs a new instance of sharedInformerFactory. +// Listers obtained via this SharedInformerFactory will be subject to the same filters +// as specified here. +// Deprecated: Please use NewSharedInformerFactoryWithOptions instead +func NewFilteredSharedInformerFactory(client kubernetes.Interface, defaultResync time.Duration, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) SharedInformerFactory { + return NewSharedInformerFactoryWithOptions(client, defaultResync, WithNamespace(namespace), WithTweakListOptions(tweakListOptions)) +} + +// NewSharedInformerFactoryWithOptions constructs a new instance of a SharedInformerFactory with additional options. +func NewSharedInformerFactoryWithOptions(client kubernetes.Interface, defaultResync time.Duration, options ...SharedInformerOption) SharedInformerFactory { + factory := &sharedInformerFactory{ + client: client, + namespace: v1.NamespaceAll, + defaultResync: defaultResync, + informers: make(map[reflect.Type]cache.SharedIndexInformer), + startedInformers: make(map[reflect.Type]bool), + customResync: make(map[reflect.Type]time.Duration), + } + + // Apply all options + for _, opt := range options { + factory = opt(factory) + } + + return factory +} + +// Start initializes all requested informers. +func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.lock.Lock() + defer f.lock.Unlock() + + for informerType, informer := range f.informers { + if !f.startedInformers[informerType] { + go informer.Run(stopCh) + f.startedInformers[informerType] = true + } + } +} + +// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + informers := func() map[reflect.Type]cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[reflect.Type]cache.SharedIndexInformer{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + res := map[reflect.Type]bool{} + for informType, informer := range informers { + res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + } + return res +} + +// InternalInformerFor returns the SharedIndexInformer for obj using an internal +// client. +func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer { + f.lock.Lock() + defer f.lock.Unlock() + + informerType := reflect.TypeOf(obj) + informer, exists := f.informers[informerType] + if exists { + return informer + } + + resyncPeriod, exists := f.customResync[informerType] + if !exists { + resyncPeriod = f.defaultResync + } + + informer = newFunc(f.client, resyncPeriod) + f.informers[informerType] = informer + + return informer +} + +// SharedInformerFactory provides shared informers for resources in all known +// API group versions. +type SharedInformerFactory interface { + internalinterfaces.SharedInformerFactory + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + + Admissionregistration() admissionregistration.Interface + Internal() apiserverinternal.Interface + Apps() apps.Interface + Autoscaling() autoscaling.Interface + Batch() batch.Interface + Certificates() certificates.Interface + Coordination() coordination.Interface + Core() core.Interface + Discovery() discovery.Interface + Events() events.Interface + Extensions() extensions.Interface + Flowcontrol() flowcontrol.Interface + Networking() networking.Interface + Node() node.Interface + Policy() policy.Interface + Rbac() rbac.Interface + Scheduling() scheduling.Interface + Storage() storage.Interface +} + +func (f *sharedInformerFactory) Admissionregistration() admissionregistration.Interface { + return admissionregistration.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Internal() apiserverinternal.Interface { + return apiserverinternal.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Apps() apps.Interface { + return apps.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Autoscaling() autoscaling.Interface { + return autoscaling.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Batch() batch.Interface { + return batch.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Certificates() certificates.Interface { + return certificates.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Coordination() coordination.Interface { + return coordination.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Core() core.Interface { + return core.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Discovery() discovery.Interface { + return discovery.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Events() events.Interface { + return events.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Extensions() extensions.Interface { + return extensions.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Flowcontrol() flowcontrol.Interface { + return flowcontrol.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Networking() networking.Interface { + return networking.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Node() node.Interface { + return node.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Policy() policy.Interface { + return policy.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Rbac() rbac.Interface { + return rbac.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Scheduling() scheduling.Interface { + return scheduling.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Storage() storage.Interface { + return storage.New(f, f.namespace, f.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/interface.go new file mode 100644 index 000000000..b04ca59d3 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package flowcontrol + +import ( + v1alpha1 "k8s.io/client-go/informers/flowcontrol/v1alpha1" + v1beta1 "k8s.io/client-go/informers/flowcontrol/v1beta1" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go new file mode 100644 index 000000000..9a4a90448 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/flowschema.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/flowcontrol/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// FlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas. +type FlowSchemaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.FlowSchemaLister +} + +type flowSchemaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().FlowSchemas().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().FlowSchemas().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1alpha1.FlowSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1alpha1.FlowSchema{}, f.defaultInformer) +} + +func (f *flowSchemaInformer) Lister() v1alpha1.FlowSchemaLister { + return v1alpha1.NewFlowSchemaLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/interface.go new file mode 100644 index 000000000..7097c0058 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // FlowSchemas returns a FlowSchemaInformer. + FlowSchemas() FlowSchemaInformer + // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. + PriorityLevelConfigurations() PriorityLevelConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// FlowSchemas returns a FlowSchemaInformer. +func (v *version) FlowSchemas() FlowSchemaInformer { + return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. +func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { + return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go new file mode 100644 index 000000000..b81f5c9c3 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1alpha1/prioritylevelconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/flowcontrol/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations. +type PriorityLevelConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.PriorityLevelConfigurationLister +} + +type priorityLevelConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().PriorityLevelConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1alpha1().PriorityLevelConfigurations().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1alpha1.PriorityLevelConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1alpha1.PriorityLevelConfiguration{}, f.defaultInformer) +} + +func (f *priorityLevelConfigurationInformer) Lister() v1alpha1.PriorityLevelConfigurationLister { + return v1alpha1.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go new file mode 100644 index 000000000..13f4ff093 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// FlowSchemaInformer provides access to a shared informer and lister for +// FlowSchemas. +type FlowSchemaInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.FlowSchemaLister +} + +type flowSchemaInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().FlowSchemas().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().FlowSchemas().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1beta1.FlowSchema{}, + resyncPeriod, + indexers, + ) +} + +func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1beta1.FlowSchema{}, f.defaultInformer) +} + +func (f *flowSchemaInformer) Lister() v1beta1.FlowSchemaLister { + return v1beta1.NewFlowSchemaLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go new file mode 100644 index 000000000..50329bb0a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // FlowSchemas returns a FlowSchemaInformer. + FlowSchemas() FlowSchemaInformer + // PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. + PriorityLevelConfigurations() PriorityLevelConfigurationInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// FlowSchemas returns a FlowSchemaInformer. +func (v *version) FlowSchemas() FlowSchemaInformer { + return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer. +func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer { + return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go new file mode 100644 index 000000000..fa4835906 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityLevelConfigurationInformer provides access to a shared informer and lister for +// PriorityLevelConfigurations. +type PriorityLevelConfigurationInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PriorityLevelConfigurationLister +} + +type priorityLevelConfigurationInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().Watch(context.TODO(), options) + }, + }, + &flowcontrolv1beta1.PriorityLevelConfiguration{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&flowcontrolv1beta1.PriorityLevelConfiguration{}, f.defaultInformer) +} + +func (f *priorityLevelConfigurationInformer) Lister() v1beta1.PriorityLevelConfigurationLister { + return v1beta1.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/generic.go b/vendor/k8s.io/client-go/informers/generic.go new file mode 100644 index 000000000..aede51a5e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/generic.go @@ -0,0 +1,364 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package informers + +import ( + "fmt" + + v1 "k8s.io/api/admissionregistration/v1" + v1beta1 "k8s.io/api/admissionregistration/v1beta1" + apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + appsv1 "k8s.io/api/apps/v1" + appsv1beta1 "k8s.io/api/apps/v1beta1" + v1beta2 "k8s.io/api/apps/v1beta2" + autoscalingv1 "k8s.io/api/autoscaling/v1" + v2beta1 "k8s.io/api/autoscaling/v2beta1" + v2beta2 "k8s.io/api/autoscaling/v2beta2" + batchv1 "k8s.io/api/batch/v1" + batchv1beta1 "k8s.io/api/batch/v1beta1" + certificatesv1 "k8s.io/api/certificates/v1" + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + coordinationv1 "k8s.io/api/coordination/v1" + coordinationv1beta1 "k8s.io/api/coordination/v1beta1" + corev1 "k8s.io/api/core/v1" + discoveryv1 "k8s.io/api/discovery/v1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + eventsv1 "k8s.io/api/events/v1" + eventsv1beta1 "k8s.io/api/events/v1beta1" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + networkingv1 "k8s.io/api/networking/v1" + networkingv1beta1 "k8s.io/api/networking/v1beta1" + nodev1 "k8s.io/api/node/v1" + nodev1alpha1 "k8s.io/api/node/v1alpha1" + nodev1beta1 "k8s.io/api/node/v1beta1" + policyv1 "k8s.io/api/policy/v1" + policyv1beta1 "k8s.io/api/policy/v1beta1" + rbacv1 "k8s.io/api/rbac/v1" + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + schedulingv1 "k8s.io/api/scheduling/v1" + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + storagev1 "k8s.io/api/storage/v1" + storagev1alpha1 "k8s.io/api/storage/v1alpha1" + storagev1beta1 "k8s.io/api/storage/v1beta1" + schema "k8s.io/apimachinery/pkg/runtime/schema" + cache "k8s.io/client-go/tools/cache" +) + +// GenericInformer is type of SharedIndexInformer which will locate and delegate to other +// sharedInformers based on type +type GenericInformer interface { + Informer() cache.SharedIndexInformer + Lister() cache.GenericLister +} + +type genericInformer struct { + informer cache.SharedIndexInformer + resource schema.GroupResource +} + +// Informer returns the SharedIndexInformer. +func (f *genericInformer) Informer() cache.SharedIndexInformer { + return f.informer +} + +// Lister returns the GenericLister. +func (f *genericInformer) Lister() cache.GenericLister { + return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) +} + +// ForResource gives generic access to a shared informer of the matching type +// TODO extend this to unknown resources with a client pool +func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { + switch resource { + // Group=admissionregistration.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingWebhookConfigurations().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().ValidatingWebhookConfigurations().Informer()}, nil + + // Group=admissionregistration.k8s.io, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().MutatingWebhookConfigurations().Informer()}, nil + case v1beta1.SchemeGroupVersion.WithResource("validatingwebhookconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1beta1().ValidatingWebhookConfigurations().Informer()}, nil + + // Group=apps, Version=v1 + case appsv1.SchemeGroupVersion.WithResource("controllerrevisions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ControllerRevisions().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("daemonsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().DaemonSets().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().Deployments().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("replicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().ReplicaSets().Informer()}, nil + case appsv1.SchemeGroupVersion.WithResource("statefulsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1().StatefulSets().Informer()}, nil + + // Group=apps, Version=v1beta1 + case appsv1beta1.SchemeGroupVersion.WithResource("controllerrevisions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().ControllerRevisions().Informer()}, nil + case appsv1beta1.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().Deployments().Informer()}, nil + case appsv1beta1.SchemeGroupVersion.WithResource("statefulsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta1().StatefulSets().Informer()}, nil + + // Group=apps, Version=v1beta2 + case v1beta2.SchemeGroupVersion.WithResource("controllerrevisions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ControllerRevisions().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("daemonsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().DaemonSets().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().Deployments().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("replicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().ReplicaSets().Informer()}, nil + case v1beta2.SchemeGroupVersion.WithResource("statefulsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Apps().V1beta2().StatefulSets().Informer()}, nil + + // Group=autoscaling, Version=v1 + case autoscalingv1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1().HorizontalPodAutoscalers().Informer()}, nil + + // Group=autoscaling, Version=v2beta1 + case v2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta1().HorizontalPodAutoscalers().Informer()}, nil + + // Group=autoscaling, Version=v2beta2 + case v2beta2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta2().HorizontalPodAutoscalers().Informer()}, nil + + // Group=batch, Version=v1 + case batchv1.SchemeGroupVersion.WithResource("cronjobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().CronJobs().Informer()}, nil + case batchv1.SchemeGroupVersion.WithResource("jobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().Jobs().Informer()}, nil + + // Group=batch, Version=v1beta1 + case batchv1beta1.SchemeGroupVersion.WithResource("cronjobs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1beta1().CronJobs().Informer()}, nil + + // Group=certificates.k8s.io, Version=v1 + case certificatesv1.SchemeGroupVersion.WithResource("certificatesigningrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1().CertificateSigningRequests().Informer()}, nil + + // Group=certificates.k8s.io, Version=v1beta1 + case certificatesv1beta1.SchemeGroupVersion.WithResource("certificatesigningrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Certificates().V1beta1().CertificateSigningRequests().Informer()}, nil + + // Group=coordination.k8s.io, Version=v1 + case coordinationv1.SchemeGroupVersion.WithResource("leases"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1().Leases().Informer()}, nil + + // Group=coordination.k8s.io, Version=v1beta1 + case coordinationv1beta1.SchemeGroupVersion.WithResource("leases"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Coordination().V1beta1().Leases().Informer()}, nil + + // Group=core, Version=v1 + case corev1.SchemeGroupVersion.WithResource("componentstatuses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ComponentStatuses().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("configmaps"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ConfigMaps().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("endpoints"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Endpoints().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("events"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Events().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("limitranges"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().LimitRanges().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("namespaces"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Namespaces().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("nodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Nodes().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("persistentvolumes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumes().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("persistentvolumeclaims"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PersistentVolumeClaims().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("pods"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Pods().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("podtemplates"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().PodTemplates().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("replicationcontrollers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ReplicationControllers().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("resourcequotas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ResourceQuotas().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("secrets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Secrets().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("services"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().Services().Informer()}, nil + case corev1.SchemeGroupVersion.WithResource("serviceaccounts"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Core().V1().ServiceAccounts().Informer()}, nil + + // Group=discovery.k8s.io, Version=v1 + case discoveryv1.SchemeGroupVersion.WithResource("endpointslices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1().EndpointSlices().Informer()}, nil + + // Group=discovery.k8s.io, Version=v1beta1 + case discoveryv1beta1.SchemeGroupVersion.WithResource("endpointslices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1beta1().EndpointSlices().Informer()}, nil + + // Group=events.k8s.io, Version=v1 + case eventsv1.SchemeGroupVersion.WithResource("events"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Events().V1().Events().Informer()}, nil + + // Group=events.k8s.io, Version=v1beta1 + case eventsv1beta1.SchemeGroupVersion.WithResource("events"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Events().V1beta1().Events().Informer()}, nil + + // Group=extensions, Version=v1beta1 + case extensionsv1beta1.SchemeGroupVersion.WithResource("daemonsets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().DaemonSets().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("deployments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Deployments().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("ingresses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().Ingresses().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("networkpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().NetworkPolicies().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("podsecuritypolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().PodSecurityPolicies().Informer()}, nil + case extensionsv1beta1.SchemeGroupVersion.WithResource("replicasets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Extensions().V1beta1().ReplicaSets().Informer()}, nil + + // Group=flowcontrol.apiserver.k8s.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("flowschemas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1alpha1().FlowSchemas().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1alpha1().PriorityLevelConfigurations().Informer()}, nil + + // Group=flowcontrol.apiserver.k8s.io, Version=v1beta1 + case flowcontrolv1beta1.SchemeGroupVersion.WithResource("flowschemas"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().FlowSchemas().Informer()}, nil + case flowcontrolv1beta1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().PriorityLevelConfigurations().Informer()}, nil + + // Group=internal.apiserver.k8s.io, Version=v1alpha1 + case apiserverinternalv1alpha1.SchemeGroupVersion.WithResource("storageversions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Internal().V1alpha1().StorageVersions().Informer()}, nil + + // Group=networking.k8s.io, Version=v1 + case networkingv1.SchemeGroupVersion.WithResource("ingresses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().Ingresses().Informer()}, nil + case networkingv1.SchemeGroupVersion.WithResource("ingressclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().IngressClasses().Informer()}, nil + case networkingv1.SchemeGroupVersion.WithResource("networkpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1().NetworkPolicies().Informer()}, nil + + // Group=networking.k8s.io, Version=v1beta1 + case networkingv1beta1.SchemeGroupVersion.WithResource("ingresses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().Ingresses().Informer()}, nil + case networkingv1beta1.SchemeGroupVersion.WithResource("ingressclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().IngressClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1 + case nodev1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1().RuntimeClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1alpha1 + case nodev1alpha1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1alpha1().RuntimeClasses().Informer()}, nil + + // Group=node.k8s.io, Version=v1beta1 + case nodev1beta1.SchemeGroupVersion.WithResource("runtimeclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Node().V1beta1().RuntimeClasses().Informer()}, nil + + // Group=policy, Version=v1 + case policyv1.SchemeGroupVersion.WithResource("poddisruptionbudgets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1().PodDisruptionBudgets().Informer()}, nil + + // Group=policy, Version=v1beta1 + case policyv1beta1.SchemeGroupVersion.WithResource("poddisruptionbudgets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodDisruptionBudgets().Informer()}, nil + case policyv1beta1.SchemeGroupVersion.WithResource("podsecuritypolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1beta1().PodSecurityPolicies().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1 + case rbacv1.SchemeGroupVersion.WithResource("clusterroles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoles().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().ClusterRoleBindings().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("roles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().Roles().Informer()}, nil + case rbacv1.SchemeGroupVersion.WithResource("rolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1().RoleBindings().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1alpha1 + case rbacv1alpha1.SchemeGroupVersion.WithResource("clusterroles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoles().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().ClusterRoleBindings().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("roles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().Roles().Informer()}, nil + case rbacv1alpha1.SchemeGroupVersion.WithResource("rolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1alpha1().RoleBindings().Informer()}, nil + + // Group=rbac.authorization.k8s.io, Version=v1beta1 + case rbacv1beta1.SchemeGroupVersion.WithResource("clusterroles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().ClusterRoles().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("clusterrolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().ClusterRoleBindings().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("roles"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().Roles().Informer()}, nil + case rbacv1beta1.SchemeGroupVersion.WithResource("rolebindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Rbac().V1beta1().RoleBindings().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1 + case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1alpha1 + case schedulingv1alpha1.SchemeGroupVersion.WithResource("priorityclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().PriorityClasses().Informer()}, nil + + // Group=scheduling.k8s.io, Version=v1beta1 + case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1beta1().PriorityClasses().Informer()}, nil + + // Group=storage.k8s.io, Version=v1 + case storagev1.SchemeGroupVersion.WithResource("csidrivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSIDrivers().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("csinodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().CSINodes().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("storageclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().StorageClasses().Informer()}, nil + case storagev1.SchemeGroupVersion.WithResource("volumeattachments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1().VolumeAttachments().Informer()}, nil + + // Group=storage.k8s.io, Version=v1alpha1 + case storagev1alpha1.SchemeGroupVersion.WithResource("csistoragecapacities"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1alpha1().CSIStorageCapacities().Informer()}, nil + case storagev1alpha1.SchemeGroupVersion.WithResource("volumeattachments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1alpha1().VolumeAttachments().Informer()}, nil + + // Group=storage.k8s.io, Version=v1beta1 + case storagev1beta1.SchemeGroupVersion.WithResource("csidrivers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSIDrivers().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("csinodes"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSINodes().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("csistoragecapacities"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().CSIStorageCapacities().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("storageclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().StorageClasses().Informer()}, nil + case storagev1beta1.SchemeGroupVersion.WithResource("volumeattachments"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1beta1().VolumeAttachments().Informer()}, nil + + } + + return nil, fmt.Errorf("no informer found for %v", resource) +} diff --git a/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go b/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go new file mode 100644 index 000000000..b00ed70cf --- /dev/null +++ b/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go @@ -0,0 +1,40 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package internalinterfaces + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + kubernetes "k8s.io/client-go/kubernetes" + cache "k8s.io/client-go/tools/cache" +) + +// NewInformerFunc takes kubernetes.Interface and time.Duration to return a SharedIndexInformer. +type NewInformerFunc func(kubernetes.Interface, time.Duration) cache.SharedIndexInformer + +// SharedInformerFactory a small interface to allow for adding an informer without an import cycle +type SharedInformerFactory interface { + Start(stopCh <-chan struct{}) + InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer +} + +// TweakListOptionsFunc is a function that transforms a v1.ListOptions. +type TweakListOptionsFunc func(*v1.ListOptions) diff --git a/vendor/k8s.io/client-go/informers/networking/interface.go b/vendor/k8s.io/client-go/informers/networking/interface.go new file mode 100644 index 000000000..4a028d5d1 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package networking + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/networking/v1" + v1beta1 "k8s.io/client-go/informers/networking/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ingress.go b/vendor/k8s.io/client-go/informers/networking/v1/ingress.go new file mode 100644 index 000000000..06c317ad3 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1/ingress.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + networkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.IngressLister +} + +type ingressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.Ingress{}, f.defaultInformer) +} + +func (f *ingressInformer) Lister() v1.IngressLister { + return v1.NewIngressLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go b/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go new file mode 100644 index 000000000..15514745b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + networkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressClassInformer provides access to a shared informer and lister for +// IngressClasses. +type IngressClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.IngressClassLister +} + +type ingressClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().IngressClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().IngressClasses().Watch(context.TODO(), options) + }, + }, + &networkingv1.IngressClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.IngressClass{}, f.defaultInformer) +} + +func (f *ingressClassInformer) Lister() v1.IngressClassLister { + return v1.NewIngressClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/interface.go b/vendor/k8s.io/client-go/informers/networking/v1/interface.go new file mode 100644 index 000000000..a48d92c4e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1/interface.go @@ -0,0 +1,59 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Ingresses returns a IngressInformer. + Ingresses() IngressInformer + // IngressClasses returns a IngressClassInformer. + IngressClasses() IngressClassInformer + // NetworkPolicies returns a NetworkPolicyInformer. + NetworkPolicies() NetworkPolicyInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v *version) Ingresses() IngressInformer { + return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IngressClasses returns a IngressClassInformer. +func (v *version) IngressClasses() IngressClassInformer { + return &ingressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// NetworkPolicies returns a NetworkPolicyInformer. +func (v *version) NetworkPolicies() NetworkPolicyInformer { + return &networkPolicyInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go b/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go new file mode 100644 index 000000000..a75c9ac21 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + networkingv1 "k8s.io/api/networking/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/networking/v1" + cache "k8s.io/client-go/tools/cache" +) + +// NetworkPolicyInformer provides access to a shared informer and lister for +// NetworkPolicies. +type NetworkPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.NetworkPolicyLister +} + +type networkPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().NetworkPolicies(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1().NetworkPolicies(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1.NetworkPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredNetworkPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1.NetworkPolicy{}, f.defaultInformer) +} + +func (f *networkPolicyInformer) Lister() v1.NetworkPolicyLister { + return v1.NewNetworkPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go new file mode 100644 index 000000000..8800d6c9c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + networkingv1beta1 "k8s.io/api/networking/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/networking/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressInformer provides access to a shared informer and lister for +// Ingresses. +type IngressInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.IngressLister +} + +type ingressInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressInformer constructs a new informer for Ingress type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().Ingresses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().Ingresses(namespace).Watch(context.TODO(), options) + }, + }, + &networkingv1beta1.Ingress{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1beta1.Ingress{}, f.defaultInformer) +} + +func (f *ingressInformer) Lister() v1beta1.IngressLister { + return v1beta1.NewIngressLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go new file mode 100644 index 000000000..17864299b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + networkingv1beta1 "k8s.io/api/networking/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/networking/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// IngressClassInformer provides access to a shared informer and lister for +// IngressClasses. +type IngressClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.IngressClassLister +} + +type ingressClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredIngressClassInformer constructs a new informer for IngressClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().IngressClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NetworkingV1beta1().IngressClasses().Watch(context.TODO(), options) + }, + }, + &networkingv1beta1.IngressClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&networkingv1beta1.IngressClass{}, f.defaultInformer) +} + +func (f *ingressClassInformer) Lister() v1beta1.IngressClassLister { + return v1beta1.NewIngressClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go new file mode 100644 index 000000000..2dcc3129a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Ingresses returns a IngressInformer. + Ingresses() IngressInformer + // IngressClasses returns a IngressClassInformer. + IngressClasses() IngressClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Ingresses returns a IngressInformer. +func (v *version) Ingresses() IngressInformer { + return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// IngressClasses returns a IngressClassInformer. +func (v *version) IngressClasses() IngressClassInformer { + return &ingressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/node/interface.go b/vendor/k8s.io/client-go/informers/node/interface.go new file mode 100644 index 000000000..61ed5af76 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/interface.go @@ -0,0 +1,62 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package node + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/node/v1" + v1alpha1 "k8s.io/client-go/informers/node/v1alpha1" + v1beta1 "k8s.io/client-go/informers/node/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1/interface.go b/vendor/k8s.io/client-go/informers/node/v1/interface.go new file mode 100644 index 000000000..913fec4ac --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RuntimeClasses returns a RuntimeClassInformer. + RuntimeClasses() RuntimeClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v *version) RuntimeClasses() RuntimeClassInformer { + return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go new file mode 100644 index 000000000..293f4e2e2 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + nodev1 "k8s.io/api/node/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/node/v1" + cache "k8s.io/client-go/tools/cache" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RuntimeClassLister +} + +type runtimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1.RuntimeClass{}, f.defaultInformer) +} + +func (f *runtimeClassInformer) Lister() v1.RuntimeClassLister { + return v1.NewRuntimeClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go new file mode 100644 index 000000000..c56442957 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RuntimeClasses returns a RuntimeClassInformer. + RuntimeClasses() RuntimeClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v *version) RuntimeClasses() RuntimeClassInformer { + return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go new file mode 100644 index 000000000..d314a9573 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + nodev1alpha1 "k8s.io/api/node/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/node/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RuntimeClassLister +} + +type runtimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1alpha1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1alpha1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1alpha1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1alpha1.RuntimeClass{}, f.defaultInformer) +} + +func (f *runtimeClassInformer) Lister() v1alpha1.RuntimeClassLister { + return v1alpha1.NewRuntimeClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go new file mode 100644 index 000000000..44a1defb6 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // RuntimeClasses returns a RuntimeClassInformer. + RuntimeClasses() RuntimeClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// RuntimeClasses returns a RuntimeClassInformer. +func (v *version) RuntimeClasses() RuntimeClassInformer { + return &runtimeClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go new file mode 100644 index 000000000..07619b230 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + nodev1beta1 "k8s.io/api/node/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/node/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// RuntimeClassInformer provides access to a shared informer and lister for +// RuntimeClasses. +type RuntimeClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.RuntimeClassLister +} + +type runtimeClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1beta1().RuntimeClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.NodeV1beta1().RuntimeClasses().Watch(context.TODO(), options) + }, + }, + &nodev1beta1.RuntimeClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&nodev1beta1.RuntimeClass{}, f.defaultInformer) +} + +func (f *runtimeClassInformer) Lister() v1beta1.RuntimeClassLister { + return v1beta1.NewRuntimeClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/policy/interface.go b/vendor/k8s.io/client-go/informers/policy/interface.go new file mode 100644 index 000000000..889cb8152 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/interface.go @@ -0,0 +1,54 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package policy + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/policy/v1" + v1beta1 "k8s.io/client-go/informers/policy/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1/interface.go b/vendor/k8s.io/client-go/informers/policy/v1/interface.go new file mode 100644 index 000000000..2c42e1993 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PodDisruptionBudgets returns a PodDisruptionBudgetInformer. + PodDisruptionBudgets() PodDisruptionBudgetInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PodDisruptionBudgets returns a PodDisruptionBudgetInformer. +func (v *version) PodDisruptionBudgets() PodDisruptionBudgetInformer { + return &podDisruptionBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go b/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go new file mode 100644 index 000000000..436598512 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + policyv1 "k8s.io/api/policy/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/policy/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PodDisruptionBudgetInformer provides access to a shared informer and lister for +// PodDisruptionBudgets. +type PodDisruptionBudgetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PodDisruptionBudgetLister +} + +type podDisruptionBudgetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1().PodDisruptionBudgets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1().PodDisruptionBudgets(namespace).Watch(context.TODO(), options) + }, + }, + &policyv1.PodDisruptionBudget{}, + resyncPeriod, + indexers, + ) +} + +func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1.PodDisruptionBudget{}, f.defaultInformer) +} + +func (f *podDisruptionBudgetInformer) Lister() v1.PodDisruptionBudgetLister { + return v1.NewPodDisruptionBudgetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go new file mode 100644 index 000000000..a6c1825d2 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PodDisruptionBudgets returns a PodDisruptionBudgetInformer. + PodDisruptionBudgets() PodDisruptionBudgetInformer + // PodSecurityPolicies returns a PodSecurityPolicyInformer. + PodSecurityPolicies() PodSecurityPolicyInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PodDisruptionBudgets returns a PodDisruptionBudgetInformer. +func (v *version) PodDisruptionBudgets() PodDisruptionBudgetInformer { + return &podDisruptionBudgetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// PodSecurityPolicies returns a PodSecurityPolicyInformer. +func (v *version) PodSecurityPolicies() PodSecurityPolicyInformer { + return &podSecurityPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go new file mode 100644 index 000000000..4530343ec --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + policyv1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/policy/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PodDisruptionBudgetInformer provides access to a shared informer and lister for +// PodDisruptionBudgets. +type PodDisruptionBudgetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PodDisruptionBudgetLister +} + +type podDisruptionBudgetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).Watch(context.TODO(), options) + }, + }, + &policyv1beta1.PodDisruptionBudget{}, + resyncPeriod, + indexers, + ) +} + +func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodDisruptionBudgetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1beta1.PodDisruptionBudget{}, f.defaultInformer) +} + +func (f *podDisruptionBudgetInformer) Lister() v1beta1.PodDisruptionBudgetLister { + return v1beta1.NewPodDisruptionBudgetLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go new file mode 100644 index 000000000..b87d23434 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/podsecuritypolicy.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + policyv1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/policy/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PodSecurityPolicyInformer provides access to a shared informer and lister for +// PodSecurityPolicies. +type PodSecurityPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PodSecurityPolicyLister +} + +type podSecurityPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPodSecurityPolicyInformer constructs a new informer for PodSecurityPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodSecurityPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodSecurityPolicies().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PolicyV1beta1().PodSecurityPolicies().Watch(context.TODO(), options) + }, + }, + &policyv1beta1.PodSecurityPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *podSecurityPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPodSecurityPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *podSecurityPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&policyv1beta1.PodSecurityPolicy{}, f.defaultInformer) +} + +func (f *podSecurityPolicyInformer) Lister() v1beta1.PodSecurityPolicyLister { + return v1beta1.NewPodSecurityPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/interface.go b/vendor/k8s.io/client-go/informers/rbac/interface.go new file mode 100644 index 000000000..228811f8a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/interface.go @@ -0,0 +1,62 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package rbac + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/rbac/v1" + v1alpha1 "k8s.io/client-go/informers/rbac/v1alpha1" + v1beta1 "k8s.io/client-go/informers/rbac/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go new file mode 100644 index 000000000..0572be264 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterRoleLister +} + +type clusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.ClusterRole{}, f.defaultInformer) +} + +func (f *clusterRoleInformer) Lister() v1.ClusterRoleLister { + return v1.NewClusterRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go new file mode 100644 index 000000000..51026c055 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.ClusterRoleBindingLister +} + +type clusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f *clusterRoleBindingInformer) Lister() v1.ClusterRoleBindingLister { + return v1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1/interface.go new file mode 100644 index 000000000..7f99c9454 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterRoles returns a ClusterRoleInformer. + ClusterRoles() ClusterRoleInformer + // ClusterRoleBindings returns a ClusterRoleBindingInformer. + ClusterRoleBindings() ClusterRoleBindingInformer + // Roles returns a RoleInformer. + Roles() RoleInformer + // RoleBindings returns a RoleBindingInformer. + RoleBindings() RoleBindingInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v *version) ClusterRoles() ClusterRoleInformer { + return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { + return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v *version) Roles() RoleInformer { + return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v *version) RoleBindings() RoleBindingInformer { + return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1/role.go new file mode 100644 index 000000000..986a5f29f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/role.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleLister +} + +type roleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.Role{}, f.defaultInformer) +} + +func (f *roleInformer) Lister() v1.RoleLister { + return v1.NewRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go new file mode 100644 index 000000000..0264049fb --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/rbac/v1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.RoleBindingLister +} + +type roleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1.RoleBinding{}, f.defaultInformer) +} + +func (f *roleBindingInformer) Lister() v1.RoleBindingLister { + return v1.NewRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go new file mode 100644 index 000000000..70d9885f0 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterRoleLister +} + +type clusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.ClusterRole{}, f.defaultInformer) +} + +func (f *clusterRoleInformer) Lister() v1alpha1.ClusterRoleLister { + return v1alpha1.NewClusterRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go new file mode 100644 index 000000000..8c18f6792 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterRoleBindingLister +} + +type clusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f *clusterRoleBindingInformer) Lister() v1alpha1.ClusterRoleBindingLister { + return v1alpha1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go new file mode 100644 index 000000000..d27c79987 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterRoles returns a ClusterRoleInformer. + ClusterRoles() ClusterRoleInformer + // ClusterRoleBindings returns a ClusterRoleBindingInformer. + ClusterRoleBindings() ClusterRoleBindingInformer + // Roles returns a RoleInformer. + Roles() RoleInformer + // RoleBindings returns a RoleBindingInformer. + RoleBindings() RoleBindingInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v *version) ClusterRoles() ClusterRoleInformer { + return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { + return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v *version) Roles() RoleInformer { + return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v *version) RoleBindings() RoleBindingInformer { + return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go new file mode 100644 index 000000000..7dc4551d9 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RoleLister +} + +type roleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.Role{}, f.defaultInformer) +} + +func (f *roleInformer) Lister() v1alpha1.RoleLister { + return v1alpha1.NewRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go new file mode 100644 index 000000000..d49ec8b36 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + rbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/rbac/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RoleBindingLister +} + +type roleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1alpha1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1alpha1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1alpha1.RoleBinding{}, f.defaultInformer) +} + +func (f *roleBindingInformer) Lister() v1alpha1.RoleBindingLister { + return v1alpha1.NewRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go new file mode 100644 index 000000000..e50e1d393 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleInformer provides access to a shared informer and lister for +// ClusterRoles. +type ClusterRoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ClusterRoleLister +} + +type clusterRoleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoles().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoles().Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.ClusterRole{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.ClusterRole{}, f.defaultInformer) +} + +func (f *clusterRoleInformer) Lister() v1beta1.ClusterRoleLister { + return v1beta1.NewClusterRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go new file mode 100644 index 000000000..a7ea4cd38 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingInformer provides access to a shared informer and lister for +// ClusterRoleBindings. +type ClusterRoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.ClusterRoleBindingLister +} + +type clusterRoleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoleBindings().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().ClusterRoleBindings().Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.ClusterRoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.ClusterRoleBinding{}, f.defaultInformer) +} + +func (f *clusterRoleBindingInformer) Lister() v1beta1.ClusterRoleBindingLister { + return v1beta1.NewClusterRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go new file mode 100644 index 000000000..04add43af --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // ClusterRoles returns a ClusterRoleInformer. + ClusterRoles() ClusterRoleInformer + // ClusterRoleBindings returns a ClusterRoleBindingInformer. + ClusterRoleBindings() ClusterRoleBindingInformer + // Roles returns a RoleInformer. + Roles() RoleInformer + // RoleBindings returns a RoleBindingInformer. + RoleBindings() RoleBindingInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// ClusterRoles returns a ClusterRoleInformer. +func (v *version) ClusterRoles() ClusterRoleInformer { + return &clusterRoleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// ClusterRoleBindings returns a ClusterRoleBindingInformer. +func (v *version) ClusterRoleBindings() ClusterRoleBindingInformer { + return &clusterRoleBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// Roles returns a RoleInformer. +func (v *version) Roles() RoleInformer { + return &roleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// RoleBindings returns a RoleBindingInformer. +func (v *version) RoleBindings() RoleBindingInformer { + return &roleBindingInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go new file mode 100644 index 000000000..e56961e81 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleInformer provides access to a shared informer and lister for +// Roles. +type RoleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.RoleLister +} + +type roleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleInformer constructs a new informer for Role type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().Roles(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().Roles(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.Role{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.Role{}, f.defaultInformer) +} + +func (f *roleInformer) Lister() v1beta1.RoleLister { + return v1beta1.NewRoleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go new file mode 100644 index 000000000..d893882db --- /dev/null +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + rbacv1beta1 "k8s.io/api/rbac/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/rbac/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// RoleBindingInformer provides access to a shared informer and lister for +// RoleBindings. +type RoleBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.RoleBindingLister +} + +type roleBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().RoleBindings(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.RbacV1beta1().RoleBindings(namespace).Watch(context.TODO(), options) + }, + }, + &rbacv1beta1.RoleBinding{}, + resyncPeriod, + indexers, + ) +} + +func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&rbacv1beta1.RoleBinding{}, f.defaultInformer) +} + +func (f *roleBindingInformer) Lister() v1beta1.RoleBindingLister { + return v1beta1.NewRoleBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/interface.go b/vendor/k8s.io/client-go/informers/scheduling/interface.go new file mode 100644 index 000000000..659089b53 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/interface.go @@ -0,0 +1,62 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package scheduling + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/scheduling/v1" + v1alpha1 "k8s.io/client-go/informers/scheduling/v1alpha1" + v1beta1 "k8s.io/client-go/informers/scheduling/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go new file mode 100644 index 000000000..fd7931f34 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PriorityClasses returns a PriorityClassInformer. + PriorityClasses() PriorityClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v *version) PriorityClasses() PriorityClassInformer { + return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go new file mode 100644 index 000000000..730616b4a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + schedulingv1 "k8s.io/api/scheduling/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/scheduling/v1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PriorityClassLister +} + +type priorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1.PriorityClass{}, f.defaultInformer) +} + +func (f *priorityClassInformer) Lister() v1.PriorityClassLister { + return v1.NewPriorityClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go new file mode 100644 index 000000000..cd908d14e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PriorityClasses returns a PriorityClassInformer. + PriorityClasses() PriorityClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v *version) PriorityClasses() PriorityClassInformer { + return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go new file mode 100644 index 000000000..f82b66436 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/scheduling/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.PriorityClassLister +} + +type priorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1alpha1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1alpha1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1alpha1.PriorityClass{}, f.defaultInformer) +} + +func (f *priorityClassInformer) Lister() v1alpha1.PriorityClassLister { + return v1alpha1.NewPriorityClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go new file mode 100644 index 000000000..52840a9ce --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // PriorityClasses returns a PriorityClassInformer. + PriorityClasses() PriorityClassInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// PriorityClasses returns a PriorityClassInformer. +func (v *version) PriorityClasses() PriorityClassInformer { + return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go new file mode 100644 index 000000000..fc7848891 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/scheduling/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// PriorityClassInformer provides access to a shared informer and lister for +// PriorityClasses. +type PriorityClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.PriorityClassLister +} + +type priorityClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().PriorityClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SchedulingV1beta1().PriorityClasses().Watch(context.TODO(), options) + }, + }, + &schedulingv1beta1.PriorityClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&schedulingv1beta1.PriorityClass{}, f.defaultInformer) +} + +func (f *priorityClassInformer) Lister() v1beta1.PriorityClassLister { + return v1beta1.NewPriorityClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/interface.go b/vendor/k8s.io/client-go/informers/storage/interface.go new file mode 100644 index 000000000..8245aa60c --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/interface.go @@ -0,0 +1,62 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package storage + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + v1 "k8s.io/client-go/informers/storage/v1" + v1alpha1 "k8s.io/client-go/informers/storage/v1alpha1" + v1beta1 "k8s.io/client-go/informers/storage/v1beta1" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go b/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go new file mode 100644 index 000000000..6fd1e678d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" +) + +// CSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers. +type CSIDriverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CSIDriverLister +} + +type cSIDriverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIDrivers().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSIDrivers().Watch(context.TODO(), options) + }, + }, + &storagev1.CSIDriver{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSIDriver{}, f.defaultInformer) +} + +func (f *cSIDriverInformer) Lister() v1.CSIDriverLister { + return v1.NewCSIDriverLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csinode.go b/vendor/k8s.io/client-go/informers/storage/v1/csinode.go new file mode 100644 index 000000000..96416967f --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/csinode.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" +) + +// CSINodeInformer provides access to a shared informer and lister for +// CSINodes. +type CSINodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.CSINodeLister +} + +type cSINodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSINodes().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().CSINodes().Watch(context.TODO(), options) + }, + }, + &storagev1.CSINode{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.CSINode{}, f.defaultInformer) +} + +func (f *cSINodeInformer) Lister() v1.CSINodeLister { + return v1.NewCSINodeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1/interface.go new file mode 100644 index 000000000..157759140 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/interface.go @@ -0,0 +1,66 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CSIDrivers returns a CSIDriverInformer. + CSIDrivers() CSIDriverInformer + // CSINodes returns a CSINodeInformer. + CSINodes() CSINodeInformer + // StorageClasses returns a StorageClassInformer. + StorageClasses() StorageClassInformer + // VolumeAttachments returns a VolumeAttachmentInformer. + VolumeAttachments() VolumeAttachmentInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIDrivers returns a CSIDriverInformer. +func (v *version) CSIDrivers() CSIDriverInformer { + return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSINodes returns a CSINodeInformer. +func (v *version) CSINodes() CSINodeInformer { + return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// StorageClasses returns a StorageClassInformer. +func (v *version) StorageClasses() StorageClassInformer { + return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v *version) VolumeAttachments() VolumeAttachmentInformer { + return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go b/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go new file mode 100644 index 000000000..8cde79d9a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" +) + +// StorageClassInformer provides access to a shared informer and lister for +// StorageClasses. +type StorageClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.StorageClassLister +} + +type storageClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().StorageClasses().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().StorageClasses().Watch(context.TODO(), options) + }, + }, + &storagev1.StorageClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storageClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.StorageClass{}, f.defaultInformer) +} + +func (f *storageClassInformer) Lister() v1.StorageClassLister { + return v1.NewStorageClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go new file mode 100644 index 000000000..be605ff48 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + storagev1 "k8s.io/api/storage/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1 "k8s.io/client-go/listers/storage/v1" + cache "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.VolumeAttachmentLister +} + +type volumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1.VolumeAttachment{}, f.defaultInformer) +} + +func (f *volumeAttachmentInformer) Lister() v1.VolumeAttachmentLister { + return v1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go new file mode 100644 index 000000000..e59dfab2d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + storagev1alpha1 "k8s.io/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities. +type CSIStorageCapacityInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.CSIStorageCapacityLister +} + +type cSIStorageCapacityInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1alpha1().CSIStorageCapacities(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1alpha1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) + }, + }, + &storagev1alpha1.CSIStorageCapacity{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1alpha1.CSIStorageCapacity{}, f.defaultInformer) +} + +func (f *cSIStorageCapacityInformer) Lister() v1alpha1.CSIStorageCapacityLister { + return v1alpha1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go new file mode 100644 index 000000000..033d3b10a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/interface.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CSIStorageCapacities returns a CSIStorageCapacityInformer. + CSIStorageCapacities() CSIStorageCapacityInformer + // VolumeAttachments returns a VolumeAttachmentInformer. + VolumeAttachments() VolumeAttachmentInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIStorageCapacities returns a CSIStorageCapacityInformer. +func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { + return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v *version) VolumeAttachments() VolumeAttachmentInformer { + return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go new file mode 100644 index 000000000..445496dad --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + storagev1alpha1 "k8s.io/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1alpha1 "k8s.io/client-go/listers/storage/v1alpha1" + cache "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VolumeAttachmentLister +} + +type volumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1alpha1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1alpha1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1alpha1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1alpha1.VolumeAttachment{}, f.defaultInformer) +} + +func (f *volumeAttachmentInformer) Lister() v1alpha1.VolumeAttachmentLister { + return v1alpha1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go new file mode 100644 index 000000000..f138a915b --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CSIDriverInformer provides access to a shared informer and lister for +// CSIDrivers. +type CSIDriverInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CSIDriverLister +} + +type cSIDriverInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIDrivers().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIDrivers().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSIDriver{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSIDriver{}, f.defaultInformer) +} + +func (f *cSIDriverInformer) Lister() v1beta1.CSIDriverLister { + return v1beta1.NewCSIDriverLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go new file mode 100644 index 000000000..6ba63172a --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CSINodeInformer provides access to a shared informer and lister for +// CSINodes. +type CSINodeInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CSINodeLister +} + +type cSINodeInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredCSINodeInformer constructs a new informer for CSINode type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSINodes().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSINodes().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSINode{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSINode{}, f.defaultInformer) +} + +func (f *cSINodeInformer) Lister() v1beta1.CSINodeLister { + return v1beta1.NewCSINodeLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go new file mode 100644 index 000000000..8f0cc4668 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go @@ -0,0 +1,90 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityInformer provides access to a shared informer and lister for +// CSIStorageCapacities. +type CSIStorageCapacityInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.CSIStorageCapacityLister +} + +type cSIStorageCapacityInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIStorageCapacities(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().CSIStorageCapacities(namespace).Watch(context.TODO(), options) + }, + }, + &storagev1beta1.CSIStorageCapacity{}, + resyncPeriod, + indexers, + ) +} + +func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.CSIStorageCapacity{}, f.defaultInformer) +} + +func (f *cSIStorageCapacityInformer) Lister() v1beta1.CSIStorageCapacityLister { + return v1beta1.NewCSIStorageCapacityLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go new file mode 100644 index 000000000..77b77c08e --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/interface.go @@ -0,0 +1,73 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // CSIDrivers returns a CSIDriverInformer. + CSIDrivers() CSIDriverInformer + // CSINodes returns a CSINodeInformer. + CSINodes() CSINodeInformer + // CSIStorageCapacities returns a CSIStorageCapacityInformer. + CSIStorageCapacities() CSIStorageCapacityInformer + // StorageClasses returns a StorageClassInformer. + StorageClasses() StorageClassInformer + // VolumeAttachments returns a VolumeAttachmentInformer. + VolumeAttachments() VolumeAttachmentInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// CSIDrivers returns a CSIDriverInformer. +func (v *version) CSIDrivers() CSIDriverInformer { + return &cSIDriverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSINodes returns a CSINodeInformer. +func (v *version) CSINodes() CSINodeInformer { + return &cSINodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// CSIStorageCapacities returns a CSIStorageCapacityInformer. +func (v *version) CSIStorageCapacities() CSIStorageCapacityInformer { + return &cSIStorageCapacityInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// StorageClasses returns a StorageClassInformer. +func (v *version) StorageClasses() StorageClassInformer { + return &storageClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// VolumeAttachments returns a VolumeAttachmentInformer. +func (v *version) VolumeAttachments() VolumeAttachmentInformer { + return &volumeAttachmentInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go new file mode 100644 index 000000000..a6582bf3d --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// StorageClassInformer provides access to a shared informer and lister for +// StorageClasses. +type StorageClassInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.StorageClassLister +} + +type storageClassInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredStorageClassInformer constructs a new informer for StorageClass type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().StorageClasses().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().StorageClasses().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.StorageClass{}, + resyncPeriod, + indexers, + ) +} + +func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *storageClassInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.StorageClass{}, f.defaultInformer) +} + +func (f *storageClassInformer) Lister() v1beta1.StorageClassLister { + return v1beta1.NewStorageClassLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go new file mode 100644 index 000000000..e89424634 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + time "time" + + storagev1beta1 "k8s.io/api/storage/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + v1beta1 "k8s.io/client-go/listers/storage/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentInformer provides access to a shared informer and lister for +// VolumeAttachments. +type VolumeAttachmentInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.VolumeAttachmentLister +} + +type volumeAttachmentInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().VolumeAttachments().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.StorageV1beta1().VolumeAttachments().Watch(context.TODO(), options) + }, + }, + &storagev1beta1.VolumeAttachment{}, + resyncPeriod, + indexers, + ) +} + +func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&storagev1beta1.VolumeAttachment{}, f.defaultInformer) +} + +func (f *volumeAttachmentInformer) Lister() v1beta1.VolumeAttachmentLister { + return v1beta1.NewVolumeAttachmentLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go new file mode 100644 index 000000000..e121ae41a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// MutatingWebhookConfigurationListerExpansion allows custom methods to be added to +// MutatingWebhookConfigurationLister. +type MutatingWebhookConfigurationListerExpansion interface{} + +// ValidatingWebhookConfigurationListerExpansion allows custom methods to be added to +// ValidatingWebhookConfigurationLister. +type ValidatingWebhookConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..fe9e27985 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationLister helps list MutatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type MutatingWebhookConfigurationLister interface { + // List lists all MutatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.MutatingWebhookConfiguration, err error) + // Get retrieves the MutatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.MutatingWebhookConfiguration, error) + MutatingWebhookConfigurationListerExpansion +} + +// mutatingWebhookConfigurationLister implements the MutatingWebhookConfigurationLister interface. +type mutatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewMutatingWebhookConfigurationLister returns a new MutatingWebhookConfigurationLister. +func NewMutatingWebhookConfigurationLister(indexer cache.Indexer) MutatingWebhookConfigurationLister { + return &mutatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all MutatingWebhookConfigurations in the indexer. +func (s *mutatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1.MutatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.MutatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the MutatingWebhookConfiguration from the index for a given name. +func (s *mutatingWebhookConfigurationLister) Get(name string) (*v1.MutatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("mutatingwebhookconfiguration"), name) + } + return obj.(*v1.MutatingWebhookConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..1579a0ebb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationLister helps list ValidatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type ValidatingWebhookConfigurationLister interface { + // List lists all ValidatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ValidatingWebhookConfiguration, err error) + // Get retrieves the ValidatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ValidatingWebhookConfiguration, error) + ValidatingWebhookConfigurationListerExpansion +} + +// validatingWebhookConfigurationLister implements the ValidatingWebhookConfigurationLister interface. +type validatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewValidatingWebhookConfigurationLister returns a new ValidatingWebhookConfigurationLister. +func NewValidatingWebhookConfigurationLister(indexer cache.Indexer) ValidatingWebhookConfigurationLister { + return &validatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all ValidatingWebhookConfigurations in the indexer. +func (s *validatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1.ValidatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ValidatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the ValidatingWebhookConfiguration from the index for a given name. +func (s *validatingWebhookConfigurationLister) Get(name string) (*v1.ValidatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("validatingwebhookconfiguration"), name) + } + return obj.(*v1.ValidatingWebhookConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go new file mode 100644 index 000000000..8960abc4f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// MutatingWebhookConfigurationListerExpansion allows custom methods to be added to +// MutatingWebhookConfigurationLister. +type MutatingWebhookConfigurationListerExpansion interface{} + +// ValidatingWebhookConfigurationListerExpansion allows custom methods to be added to +// ValidatingWebhookConfigurationLister. +type ValidatingWebhookConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go new file mode 100644 index 000000000..93c6096ee --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/admissionregistration/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MutatingWebhookConfigurationLister helps list MutatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type MutatingWebhookConfigurationLister interface { + // List lists all MutatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.MutatingWebhookConfiguration, err error) + // Get retrieves the MutatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.MutatingWebhookConfiguration, error) + MutatingWebhookConfigurationListerExpansion +} + +// mutatingWebhookConfigurationLister implements the MutatingWebhookConfigurationLister interface. +type mutatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewMutatingWebhookConfigurationLister returns a new MutatingWebhookConfigurationLister. +func NewMutatingWebhookConfigurationLister(indexer cache.Indexer) MutatingWebhookConfigurationLister { + return &mutatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all MutatingWebhookConfigurations in the indexer. +func (s *mutatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1beta1.MutatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.MutatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the MutatingWebhookConfiguration from the index for a given name. +func (s *mutatingWebhookConfigurationLister) Get(name string) (*v1beta1.MutatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("mutatingwebhookconfiguration"), name) + } + return obj.(*v1beta1.MutatingWebhookConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go new file mode 100644 index 000000000..7c17fccb2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/admissionregistration/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ValidatingWebhookConfigurationLister helps list ValidatingWebhookConfigurations. +// All objects returned here must be treated as read-only. +type ValidatingWebhookConfigurationLister interface { + // List lists all ValidatingWebhookConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ValidatingWebhookConfiguration, err error) + // Get retrieves the ValidatingWebhookConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ValidatingWebhookConfiguration, error) + ValidatingWebhookConfigurationListerExpansion +} + +// validatingWebhookConfigurationLister implements the ValidatingWebhookConfigurationLister interface. +type validatingWebhookConfigurationLister struct { + indexer cache.Indexer +} + +// NewValidatingWebhookConfigurationLister returns a new ValidatingWebhookConfigurationLister. +func NewValidatingWebhookConfigurationLister(indexer cache.Indexer) ValidatingWebhookConfigurationLister { + return &validatingWebhookConfigurationLister{indexer: indexer} +} + +// List lists all ValidatingWebhookConfigurations in the indexer. +func (s *validatingWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1beta1.ValidatingWebhookConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ValidatingWebhookConfiguration)) + }) + return ret, err +} + +// Get retrieves the ValidatingWebhookConfiguration from the index for a given name. +func (s *validatingWebhookConfigurationLister) Get(name string) (*v1beta1.ValidatingWebhookConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("validatingwebhookconfiguration"), name) + } + return obj.(*v1beta1.ValidatingWebhookConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..ad860c7c9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// StorageVersionListerExpansion allows custom methods to be added to +// StorageVersionLister. +type StorageVersionListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/storageversion.go b/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/storageversion.go new file mode 100644 index 000000000..9a6d74b2b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apiserverinternal/v1alpha1/storageversion.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StorageVersionLister helps list StorageVersions. +// All objects returned here must be treated as read-only. +type StorageVersionLister interface { + // List lists all StorageVersions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.StorageVersion, err error) + // Get retrieves the StorageVersion from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.StorageVersion, error) + StorageVersionListerExpansion +} + +// storageVersionLister implements the StorageVersionLister interface. +type storageVersionLister struct { + indexer cache.Indexer +} + +// NewStorageVersionLister returns a new StorageVersionLister. +func NewStorageVersionLister(indexer cache.Indexer) StorageVersionLister { + return &storageVersionLister{indexer: indexer} +} + +// List lists all StorageVersions in the indexer. +func (s *storageVersionLister) List(selector labels.Selector) (ret []*v1alpha1.StorageVersion, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.StorageVersion)) + }) + return ret, err +} + +// Get retrieves the StorageVersion from the index for a given name. +func (s *storageVersionLister) Get(name string) (*v1alpha1.StorageVersion, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("storageversion"), name) + } + return obj.(*v1alpha1.StorageVersion), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/controllerrevision.go b/vendor/k8s.io/client-go/listers/apps/v1/controllerrevision.go new file mode 100644 index 000000000..9e2f97374 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/controllerrevision.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionLister helps list ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionLister interface { + // List lists all ControllerRevisions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) + // ControllerRevisions returns an object that can list and get ControllerRevisions. + ControllerRevisions(namespace string) ControllerRevisionNamespaceLister + ControllerRevisionListerExpansion +} + +// controllerRevisionLister implements the ControllerRevisionLister interface. +type controllerRevisionLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionLister returns a new ControllerRevisionLister. +func NewControllerRevisionLister(indexer cache.Indexer) ControllerRevisionLister { + return &controllerRevisionLister{indexer: indexer} +} + +// List lists all ControllerRevisions in the indexer. +func (s *controllerRevisionLister) List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get ControllerRevisions. +func (s *controllerRevisionLister) ControllerRevisions(namespace string) ControllerRevisionNamespaceLister { + return controllerRevisionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ControllerRevisionNamespaceLister helps list and get ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionNamespaceLister interface { + // List lists all ControllerRevisions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) + // Get retrieves the ControllerRevision from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ControllerRevision, error) + ControllerRevisionNamespaceListerExpansion +} + +// controllerRevisionNamespaceLister implements the ControllerRevisionNamespaceLister +// interface. +type controllerRevisionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ControllerRevisions in the indexer for a given namespace. +func (s controllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*v1.ControllerRevision, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ControllerRevision)) + }) + return ret, err +} + +// Get retrieves the ControllerRevision from the indexer for a given namespace and name. +func (s controllerRevisionNamespaceLister) Get(name string) (*v1.ControllerRevision, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("controllerrevision"), name) + } + return obj.(*v1.ControllerRevision), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/daemonset.go b/vendor/k8s.io/client-go/listers/apps/v1/daemonset.go new file mode 100644 index 000000000..061959e3d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/daemonset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DaemonSetLister helps list DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetLister interface { + // List lists all DaemonSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.DaemonSet, err error) + // DaemonSets returns an object that can list and get DaemonSets. + DaemonSets(namespace string) DaemonSetNamespaceLister + DaemonSetListerExpansion +} + +// daemonSetLister implements the DaemonSetLister interface. +type daemonSetLister struct { + indexer cache.Indexer +} + +// NewDaemonSetLister returns a new DaemonSetLister. +func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister { + return &daemonSetLister{indexer: indexer} +} + +// List lists all DaemonSets in the indexer. +func (s *daemonSetLister) List(selector labels.Selector) (ret []*v1.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get DaemonSets. +func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister { + return daemonSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DaemonSetNamespaceLister helps list and get DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetNamespaceLister interface { + // List lists all DaemonSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.DaemonSet, err error) + // Get retrieves the DaemonSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.DaemonSet, error) + DaemonSetNamespaceListerExpansion +} + +// daemonSetNamespaceLister implements the DaemonSetNamespaceLister +// interface. +type daemonSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all DaemonSets in the indexer for a given namespace. +func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*v1.DaemonSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.DaemonSet)) + }) + return ret, err +} + +// Get retrieves the DaemonSet from the indexer for a given namespace and name. +func (s daemonSetNamespaceLister) Get(name string) (*v1.DaemonSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("daemonset"), name) + } + return obj.(*v1.DaemonSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/daemonset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1/daemonset_expansion.go new file mode 100644 index 000000000..83435561a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/daemonset_expansion.go @@ -0,0 +1,113 @@ +/* +Copyright 2017 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 v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// DaemonSetListerExpansion allows custom methods to be added to +// DaemonSetLister. +type DaemonSetListerExpansion interface { + GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) + GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) +} + +// DaemonSetNamespaceListerExpansion allows custom methods to be added to +// DaemonSetNamespaceLister. +type DaemonSetNamespaceListerExpansion interface{} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + var selector labels.Selector + var daemonSet *apps.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // this should not happen if the DaemonSet passed validation + return nil, err + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/deployment.go b/vendor/k8s.io/client-go/listers/apps/v1/deployment.go new file mode 100644 index 000000000..770403417 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/deployment.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("deployment"), name) + } + return obj.(*v1.Deployment), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/apps/v1/expansion_generated.go new file mode 100644 index 000000000..0c357589d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// ControllerRevisionListerExpansion allows custom methods to be added to +// ControllerRevisionLister. +type ControllerRevisionListerExpansion interface{} + +// ControllerRevisionNamespaceListerExpansion allows custom methods to be added to +// ControllerRevisionNamespaceLister. +type ControllerRevisionNamespaceListerExpansion interface{} + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/replicaset.go b/vendor/k8s.io/client-go/listers/apps/v1/replicaset.go new file mode 100644 index 000000000..3ca7757eb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/replicaset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicaSetLister helps list ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetLister interface { + // List lists all ReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) + // ReplicaSets returns an object that can list and get ReplicaSets. + ReplicaSets(namespace string) ReplicaSetNamespaceLister + ReplicaSetListerExpansion +} + +// replicaSetLister implements the ReplicaSetLister interface. +type replicaSetLister struct { + indexer cache.Indexer +} + +// NewReplicaSetLister returns a new ReplicaSetLister. +func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { + return &replicaSetLister{indexer: indexer} +} + +// List lists all ReplicaSets in the indexer. +func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get ReplicaSets. +func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { + return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicaSetNamespaceLister helps list and get ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetNamespaceLister interface { + // List lists all ReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) + // Get retrieves the ReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ReplicaSet, error) + ReplicaSetNamespaceListerExpansion +} + +// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister +// interface. +type replicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicaSets in the indexer for a given namespace. +func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1.ReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ReplicaSet from the indexer for a given namespace and name. +func (s replicaSetNamespaceLister) Get(name string) (*v1.ReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("replicaset"), name) + } + return obj.(*v1.ReplicaSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/replicaset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1/replicaset_expansion.go new file mode 100644 index 000000000..675e615ae --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/replicaset_expansion.go @@ -0,0 +1,73 @@ +/* +Copyright 2017 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 v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// ReplicaSetListerExpansion allows custom methods to be added to +// ReplicaSetLister. +type ReplicaSetListerExpansion interface { + GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) +} + +// ReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ReplicaSetNamespaceLister. +type ReplicaSetNamespaceListerExpansion interface{} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *replicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*apps.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/statefulset.go b/vendor/k8s.io/client-go/listers/apps/v1/statefulset.go new file mode 100644 index 000000000..f6899d5ff --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/statefulset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/apps/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StatefulSetLister helps list StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetLister interface { + // List lists all StatefulSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StatefulSet, err error) + // StatefulSets returns an object that can list and get StatefulSets. + StatefulSets(namespace string) StatefulSetNamespaceLister + StatefulSetListerExpansion +} + +// statefulSetLister implements the StatefulSetLister interface. +type statefulSetLister struct { + indexer cache.Indexer +} + +// NewStatefulSetLister returns a new StatefulSetLister. +func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { + return &statefulSetLister{indexer: indexer} +} + +// List lists all StatefulSets in the indexer. +func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get StatefulSets. +func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { + return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// StatefulSetNamespaceLister helps list and get StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetNamespaceLister interface { + // List lists all StatefulSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StatefulSet, err error) + // Get retrieves the StatefulSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.StatefulSet, error) + StatefulSetNamespaceListerExpansion +} + +// statefulSetNamespaceLister implements the StatefulSetNamespaceLister +// interface. +type statefulSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all StatefulSets in the indexer for a given namespace. +func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1.StatefulSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StatefulSet)) + }) + return ret, err +} + +// Get retrieves the StatefulSet from the indexer for a given namespace and name. +func (s statefulSetNamespaceLister) Get(name string) (*v1.StatefulSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("statefulset"), name) + } + return obj.(*v1.StatefulSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1/statefulset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1/statefulset_expansion.go new file mode 100644 index 000000000..b4912976b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1/statefulset_expansion.go @@ -0,0 +1,77 @@ +/* +Copyright 2017 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 v1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// StatefulSetListerExpansion allows custom methods to be added to +// StatefulSetLister. +type StatefulSetListerExpansion interface { + GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) +} + +// StatefulSetNamespaceListerExpansion allows custom methods to be added to +// StatefulSetNamespaceLister. +type StatefulSetNamespaceListerExpansion interface{} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *statefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/controllerrevision.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/controllerrevision.go new file mode 100644 index 000000000..fc73de723 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/controllerrevision.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionLister helps list ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionLister interface { + // List lists all ControllerRevisions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) + // ControllerRevisions returns an object that can list and get ControllerRevisions. + ControllerRevisions(namespace string) ControllerRevisionNamespaceLister + ControllerRevisionListerExpansion +} + +// controllerRevisionLister implements the ControllerRevisionLister interface. +type controllerRevisionLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionLister returns a new ControllerRevisionLister. +func NewControllerRevisionLister(indexer cache.Indexer) ControllerRevisionLister { + return &controllerRevisionLister{indexer: indexer} +} + +// List lists all ControllerRevisions in the indexer. +func (s *controllerRevisionLister) List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get ControllerRevisions. +func (s *controllerRevisionLister) ControllerRevisions(namespace string) ControllerRevisionNamespaceLister { + return controllerRevisionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ControllerRevisionNamespaceLister helps list and get ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionNamespaceLister interface { + // List lists all ControllerRevisions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) + // Get retrieves the ControllerRevision from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ControllerRevision, error) + ControllerRevisionNamespaceListerExpansion +} + +// controllerRevisionNamespaceLister implements the ControllerRevisionNamespaceLister +// interface. +type controllerRevisionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ControllerRevisions in the indexer for a given namespace. +func (s controllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ControllerRevision, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ControllerRevision)) + }) + return ret, err +} + +// Get retrieves the ControllerRevision from the indexer for a given namespace and name. +func (s controllerRevisionNamespaceLister) Get(name string) (*v1beta1.ControllerRevision, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("controllerrevision"), name) + } + return obj.(*v1beta1.ControllerRevision), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/deployment.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/deployment.go new file mode 100644 index 000000000..3fb70794c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/deployment.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1beta1.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("deployment"), name) + } + return obj.(*v1beta1.Deployment), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/expansion_generated.go new file mode 100644 index 000000000..c73cf98c7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// ControllerRevisionListerExpansion allows custom methods to be added to +// ControllerRevisionLister. +type ControllerRevisionListerExpansion interface{} + +// ControllerRevisionNamespaceListerExpansion allows custom methods to be added to +// ControllerRevisionNamespaceLister. +type ControllerRevisionNamespaceListerExpansion interface{} + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset.go new file mode 100644 index 000000000..e3556bc39 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/apps/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StatefulSetLister helps list StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetLister interface { + // List lists all StatefulSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) + // StatefulSets returns an object that can list and get StatefulSets. + StatefulSets(namespace string) StatefulSetNamespaceLister + StatefulSetListerExpansion +} + +// statefulSetLister implements the StatefulSetLister interface. +type statefulSetLister struct { + indexer cache.Indexer +} + +// NewStatefulSetLister returns a new StatefulSetLister. +func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { + return &statefulSetLister{indexer: indexer} +} + +// List lists all StatefulSets in the indexer. +func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get StatefulSets. +func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { + return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// StatefulSetNamespaceLister helps list and get StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetNamespaceLister interface { + // List lists all StatefulSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) + // Get retrieves the StatefulSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.StatefulSet, error) + StatefulSetNamespaceListerExpansion +} + +// statefulSetNamespaceLister implements the StatefulSetNamespaceLister +// interface. +type statefulSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all StatefulSets in the indexer for a given namespace. +func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.StatefulSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.StatefulSet)) + }) + return ret, err +} + +// Get retrieves the StatefulSet from the indexer for a given namespace and name. +func (s statefulSetNamespaceLister) Get(name string) (*v1beta1.StatefulSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("statefulset"), name) + } + return obj.(*v1beta1.StatefulSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset_expansion.go new file mode 100644 index 000000000..0741792ac --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta1/statefulset_expansion.go @@ -0,0 +1,77 @@ +/* +Copyright 2017 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 v1beta1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// StatefulSetListerExpansion allows custom methods to be added to +// StatefulSetLister. +type StatefulSetListerExpansion interface { + GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) +} + +// StatefulSetNamespaceListerExpansion allows custom methods to be added to +// StatefulSetNamespaceLister. +type StatefulSetNamespaceListerExpansion interface{} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *statefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/controllerrevision.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/controllerrevision.go new file mode 100644 index 000000000..da2ce8600 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/controllerrevision.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ControllerRevisionLister helps list ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionLister interface { + // List lists all ControllerRevisions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.ControllerRevision, err error) + // ControllerRevisions returns an object that can list and get ControllerRevisions. + ControllerRevisions(namespace string) ControllerRevisionNamespaceLister + ControllerRevisionListerExpansion +} + +// controllerRevisionLister implements the ControllerRevisionLister interface. +type controllerRevisionLister struct { + indexer cache.Indexer +} + +// NewControllerRevisionLister returns a new ControllerRevisionLister. +func NewControllerRevisionLister(indexer cache.Indexer) ControllerRevisionLister { + return &controllerRevisionLister{indexer: indexer} +} + +// List lists all ControllerRevisions in the indexer. +func (s *controllerRevisionLister) List(selector labels.Selector) (ret []*v1beta2.ControllerRevision, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ControllerRevision)) + }) + return ret, err +} + +// ControllerRevisions returns an object that can list and get ControllerRevisions. +func (s *controllerRevisionLister) ControllerRevisions(namespace string) ControllerRevisionNamespaceLister { + return controllerRevisionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ControllerRevisionNamespaceLister helps list and get ControllerRevisions. +// All objects returned here must be treated as read-only. +type ControllerRevisionNamespaceLister interface { + // List lists all ControllerRevisions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.ControllerRevision, err error) + // Get retrieves the ControllerRevision from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.ControllerRevision, error) + ControllerRevisionNamespaceListerExpansion +} + +// controllerRevisionNamespaceLister implements the ControllerRevisionNamespaceLister +// interface. +type controllerRevisionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ControllerRevisions in the indexer for a given namespace. +func (s controllerRevisionNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.ControllerRevision, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ControllerRevision)) + }) + return ret, err +} + +// Get retrieves the ControllerRevision from the indexer for a given namespace and name. +func (s controllerRevisionNamespaceLister) Get(name string) (*v1beta2.ControllerRevision, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("controllerrevision"), name) + } + return obj.(*v1beta2.ControllerRevision), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset.go new file mode 100644 index 000000000..4b7aedd75 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DaemonSetLister helps list DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetLister interface { + // List lists all DaemonSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.DaemonSet, err error) + // DaemonSets returns an object that can list and get DaemonSets. + DaemonSets(namespace string) DaemonSetNamespaceLister + DaemonSetListerExpansion +} + +// daemonSetLister implements the DaemonSetLister interface. +type daemonSetLister struct { + indexer cache.Indexer +} + +// NewDaemonSetLister returns a new DaemonSetLister. +func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister { + return &daemonSetLister{indexer: indexer} +} + +// List lists all DaemonSets in the indexer. +func (s *daemonSetLister) List(selector labels.Selector) (ret []*v1beta2.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get DaemonSets. +func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister { + return daemonSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DaemonSetNamespaceLister helps list and get DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetNamespaceLister interface { + // List lists all DaemonSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.DaemonSet, err error) + // Get retrieves the DaemonSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.DaemonSet, error) + DaemonSetNamespaceListerExpansion +} + +// daemonSetNamespaceLister implements the DaemonSetNamespaceLister +// interface. +type daemonSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all DaemonSets in the indexer for a given namespace. +func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.DaemonSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.DaemonSet)) + }) + return ret, err +} + +// Get retrieves the DaemonSet from the indexer for a given namespace and name. +func (s daemonSetNamespaceLister) Get(name string) (*v1beta2.DaemonSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("daemonset"), name) + } + return obj.(*v1beta2.DaemonSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset_expansion.go new file mode 100644 index 000000000..3b01aaa48 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/daemonset_expansion.go @@ -0,0 +1,113 @@ +/* +Copyright 2017 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 v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// DaemonSetListerExpansion allows custom methods to be added to +// DaemonSetLister. +type DaemonSetListerExpansion interface { + GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) + GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) +} + +// DaemonSetNamespaceListerExpansion allows custom methods to be added to +// DaemonSetNamespaceLister. +type DaemonSetNamespaceListerExpansion interface{} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*apps.DaemonSet, error) { + var selector labels.Selector + var daemonSet *apps.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // this should not happen if the DaemonSet passed validation + return nil, err + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*apps.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*apps.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/deployment.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/deployment.go new file mode 100644 index 000000000..c2857bbc3 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/deployment.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1beta2.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1beta2.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("deployment"), name) + } + return obj.(*v1beta2.Deployment), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/expansion_generated.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/expansion_generated.go new file mode 100644 index 000000000..b6d202118 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta2 + +// ControllerRevisionListerExpansion allows custom methods to be added to +// ControllerRevisionLister. +type ControllerRevisionListerExpansion interface{} + +// ControllerRevisionNamespaceListerExpansion allows custom methods to be added to +// ControllerRevisionNamespaceLister. +type ControllerRevisionNamespaceListerExpansion interface{} + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset.go new file mode 100644 index 000000000..26b350ce8 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicaSetLister helps list ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetLister interface { + // List lists all ReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) + // ReplicaSets returns an object that can list and get ReplicaSets. + ReplicaSets(namespace string) ReplicaSetNamespaceLister + ReplicaSetListerExpansion +} + +// replicaSetLister implements the ReplicaSetLister interface. +type replicaSetLister struct { + indexer cache.Indexer +} + +// NewReplicaSetLister returns a new ReplicaSetLister. +func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { + return &replicaSetLister{indexer: indexer} +} + +// List lists all ReplicaSets in the indexer. +func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get ReplicaSets. +func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { + return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicaSetNamespaceLister helps list and get ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetNamespaceLister interface { + // List lists all ReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) + // Get retrieves the ReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.ReplicaSet, error) + ReplicaSetNamespaceListerExpansion +} + +// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister +// interface. +type replicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicaSets in the indexer for a given namespace. +func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.ReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.ReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ReplicaSet from the indexer for a given namespace and name. +func (s replicaSetNamespaceLister) Get(name string) (*v1beta2.ReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("replicaset"), name) + } + return obj.(*v1beta2.ReplicaSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset_expansion.go new file mode 100644 index 000000000..7562fe996 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/replicaset_expansion.go @@ -0,0 +1,73 @@ +/* +Copyright 2017 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 v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// ReplicaSetListerExpansion allows custom methods to be added to +// ReplicaSetLister. +type ReplicaSetListerExpansion interface { + GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) +} + +// ReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ReplicaSetNamespaceLister. +type ReplicaSetNamespaceListerExpansion interface{} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *replicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*apps.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*apps.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset.go new file mode 100644 index 000000000..fbbaf0133 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1beta2 "k8s.io/api/apps/v1beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StatefulSetLister helps list StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetLister interface { + // List lists all StatefulSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.StatefulSet, err error) + // StatefulSets returns an object that can list and get StatefulSets. + StatefulSets(namespace string) StatefulSetNamespaceLister + StatefulSetListerExpansion +} + +// statefulSetLister implements the StatefulSetLister interface. +type statefulSetLister struct { + indexer cache.Indexer +} + +// NewStatefulSetLister returns a new StatefulSetLister. +func NewStatefulSetLister(indexer cache.Indexer) StatefulSetLister { + return &statefulSetLister{indexer: indexer} +} + +// List lists all StatefulSets in the indexer. +func (s *statefulSetLister) List(selector labels.Selector) (ret []*v1beta2.StatefulSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.StatefulSet)) + }) + return ret, err +} + +// StatefulSets returns an object that can list and get StatefulSets. +func (s *statefulSetLister) StatefulSets(namespace string) StatefulSetNamespaceLister { + return statefulSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// StatefulSetNamespaceLister helps list and get StatefulSets. +// All objects returned here must be treated as read-only. +type StatefulSetNamespaceLister interface { + // List lists all StatefulSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta2.StatefulSet, err error) + // Get retrieves the StatefulSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta2.StatefulSet, error) + StatefulSetNamespaceListerExpansion +} + +// statefulSetNamespaceLister implements the StatefulSetNamespaceLister +// interface. +type statefulSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all StatefulSets in the indexer for a given namespace. +func (s statefulSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta2.StatefulSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta2.StatefulSet)) + }) + return ret, err +} + +// Get retrieves the StatefulSet from the indexer for a given namespace and name. +func (s statefulSetNamespaceLister) Get(name string) (*v1beta2.StatefulSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta2.Resource("statefulset"), name) + } + return obj.(*v1beta2.StatefulSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset_expansion.go b/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset_expansion.go new file mode 100644 index 000000000..6fa6b9144 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/apps/v1beta2/statefulset_expansion.go @@ -0,0 +1,77 @@ +/* +Copyright 2017 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 v1beta2 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta2" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// StatefulSetListerExpansion allows custom methods to be added to +// StatefulSetLister. +type StatefulSetListerExpansion interface { + GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) +} + +// StatefulSetNamespaceListerExpansion allows custom methods to be added to +// StatefulSetNamespaceLister. +type StatefulSetNamespaceListerExpansion interface{} + +// GetPodStatefulSets returns a list of StatefulSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching StatefulSets are found. +func (s *statefulSetLister) GetPodStatefulSets(pod *v1.Pod) ([]*apps.StatefulSet, error) { + var selector labels.Selector + var ps *apps.StatefulSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no StatefulSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.StatefulSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var psList []*apps.StatefulSet + for i := range list { + ps = list[i] + if ps.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(ps.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a StatefulSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + psList = append(psList, ps) + } + + if len(psList) == 0 { + return nil, fmt.Errorf("could not find StatefulSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return psList, nil +} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/autoscaling/v1/expansion_generated.go new file mode 100644 index 000000000..05253c770 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerLister. +type HorizontalPodAutoscalerListerExpansion interface{} + +// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerNamespaceLister. +type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/listers/autoscaling/v1/horizontalpodautoscaler.go new file mode 100644 index 000000000..8447f059d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v1/horizontalpodautoscaler.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/autoscaling/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerLister interface { + // List lists all HorizontalPodAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) + // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister + HorizontalPodAutoscalerListerExpansion +} + +// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. +type horizontalPodAutoscalerLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. +func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { + return &horizontalPodAutoscalerLister{indexer: indexer} +} + +// List lists all HorizontalPodAutoscalers in the indexer. +func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. +func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { + return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerNamespaceLister interface { + // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) + // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.HorizontalPodAutoscaler, error) + HorizontalPodAutoscalerNamespaceListerExpansion +} + +// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister +// interface. +type horizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HorizontalPodAutoscalers in the indexer for a given namespace. +func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v1.HorizontalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v1.HorizontalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("horizontalpodautoscaler"), name) + } + return obj.(*v1.HorizontalPodAutoscaler), nil +} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go new file mode 100644 index 000000000..8d46a4b6e --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta1 + +// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerLister. +type HorizontalPodAutoscalerListerExpansion interface{} + +// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerNamespaceLister. +type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go new file mode 100644 index 000000000..f1804e995 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta1 + +import ( + v2beta1 "k8s.io/api/autoscaling/v2beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerLister interface { + // List lists all HorizontalPodAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) + // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister + HorizontalPodAutoscalerListerExpansion +} + +// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. +type horizontalPodAutoscalerLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. +func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { + return &horizontalPodAutoscalerLister{indexer: indexer} +} + +// List lists all HorizontalPodAutoscalers in the indexer. +func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. +func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { + return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerNamespaceLister interface { + // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) + // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta1.HorizontalPodAutoscaler, error) + HorizontalPodAutoscalerNamespaceListerExpansion +} + +// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister +// interface. +type horizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HorizontalPodAutoscalers in the indexer for a given namespace. +func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v2beta1.HorizontalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta1.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v2beta1.HorizontalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta1.Resource("horizontalpodautoscaler"), name) + } + return obj.(*v2beta1.HorizontalPodAutoscaler), nil +} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go new file mode 100644 index 000000000..5127945a9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerLister. +type HorizontalPodAutoscalerListerExpansion interface{} + +// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// HorizontalPodAutoscalerNamespaceLister. +type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go new file mode 100644 index 000000000..b0dbaf9eb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "k8s.io/api/autoscaling/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerLister interface { + // List lists all HorizontalPodAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.HorizontalPodAutoscaler, err error) + // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. + HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister + HorizontalPodAutoscalerListerExpansion +} + +// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. +type horizontalPodAutoscalerLister struct { + indexer cache.Indexer +} + +// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. +func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { + return &horizontalPodAutoscalerLister{indexer: indexer} +} + +// List lists all HorizontalPodAutoscalers in the indexer. +func (s *horizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v2beta2.HorizontalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. +func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { + return horizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. +// All objects returned here must be treated as read-only. +type HorizontalPodAutoscalerNamespaceLister interface { + // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.HorizontalPodAutoscaler, err error) + // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.HorizontalPodAutoscaler, error) + HorizontalPodAutoscalerNamespaceListerExpansion +} + +// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister +// interface. +type horizontalPodAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all HorizontalPodAutoscalers in the indexer for a given namespace. +func (s horizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v2beta2.HorizontalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.HorizontalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. +func (s horizontalPodAutoscalerNamespaceLister) Get(name string) (*v2beta2.HorizontalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("horizontalpodautoscaler"), name) + } + return obj.(*v2beta2.HorizontalPodAutoscaler), nil +} diff --git a/vendor/k8s.io/client-go/listers/batch/v1/cronjob.go b/vendor/k8s.io/client-go/listers/batch/v1/cronjob.go new file mode 100644 index 000000000..8e49ed959 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1/cronjob.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CronJobLister helps list CronJobs. +// All objects returned here must be treated as read-only. +type CronJobLister interface { + // List lists all CronJobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CronJob, err error) + // CronJobs returns an object that can list and get CronJobs. + CronJobs(namespace string) CronJobNamespaceLister + CronJobListerExpansion +} + +// cronJobLister implements the CronJobLister interface. +type cronJobLister struct { + indexer cache.Indexer +} + +// NewCronJobLister returns a new CronJobLister. +func NewCronJobLister(indexer cache.Indexer) CronJobLister { + return &cronJobLister{indexer: indexer} +} + +// List lists all CronJobs in the indexer. +func (s *cronJobLister) List(selector labels.Selector) (ret []*v1.CronJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CronJob)) + }) + return ret, err +} + +// CronJobs returns an object that can list and get CronJobs. +func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister { + return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CronJobNamespaceLister helps list and get CronJobs. +// All objects returned here must be treated as read-only. +type CronJobNamespaceLister interface { + // List lists all CronJobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CronJob, err error) + // Get retrieves the CronJob from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CronJob, error) + CronJobNamespaceListerExpansion +} + +// cronJobNamespaceLister implements the CronJobNamespaceLister +// interface. +type cronJobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CronJobs in the indexer for a given namespace. +func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*v1.CronJob, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CronJob)) + }) + return ret, err +} + +// Get retrieves the CronJob from the indexer for a given namespace and name. +func (s cronJobNamespaceLister) Get(name string) (*v1.CronJob, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("cronjob"), name) + } + return obj.(*v1.CronJob), nil +} diff --git a/vendor/k8s.io/client-go/listers/batch/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/batch/v1/expansion_generated.go new file mode 100644 index 000000000..220976279 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// CronJobListerExpansion allows custom methods to be added to +// CronJobLister. +type CronJobListerExpansion interface{} + +// CronJobNamespaceListerExpansion allows custom methods to be added to +// CronJobNamespaceLister. +type CronJobNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/batch/v1/job.go b/vendor/k8s.io/client-go/listers/batch/v1/job.go new file mode 100644 index 000000000..3aba6b95f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1/job.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/batch/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// JobLister helps list Jobs. +// All objects returned here must be treated as read-only. +type JobLister interface { + // List lists all Jobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Job, err error) + // Jobs returns an object that can list and get Jobs. + Jobs(namespace string) JobNamespaceLister + JobListerExpansion +} + +// jobLister implements the JobLister interface. +type jobLister struct { + indexer cache.Indexer +} + +// NewJobLister returns a new JobLister. +func NewJobLister(indexer cache.Indexer) JobLister { + return &jobLister{indexer: indexer} +} + +// List lists all Jobs in the indexer. +func (s *jobLister) List(selector labels.Selector) (ret []*v1.Job, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Job)) + }) + return ret, err +} + +// Jobs returns an object that can list and get Jobs. +func (s *jobLister) Jobs(namespace string) JobNamespaceLister { + return jobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// JobNamespaceLister helps list and get Jobs. +// All objects returned here must be treated as read-only. +type JobNamespaceLister interface { + // List lists all Jobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Job, err error) + // Get retrieves the Job from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Job, error) + JobNamespaceListerExpansion +} + +// jobNamespaceLister implements the JobNamespaceLister +// interface. +type jobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Jobs in the indexer for a given namespace. +func (s jobNamespaceLister) List(selector labels.Selector) (ret []*v1.Job, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Job)) + }) + return ret, err +} + +// Get retrieves the Job from the indexer for a given namespace and name. +func (s jobNamespaceLister) Get(name string) (*v1.Job, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("job"), name) + } + return obj.(*v1.Job), nil +} diff --git a/vendor/k8s.io/client-go/listers/batch/v1/job_expansion.go b/vendor/k8s.io/client-go/listers/batch/v1/job_expansion.go new file mode 100644 index 000000000..fdcd5f32e --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1/job_expansion.go @@ -0,0 +1,68 @@ +/* +Copyright 2016 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 v1 + +import ( + "fmt" + + batch "k8s.io/api/batch/v1" + "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// JobListerExpansion allows custom methods to be added to +// JobLister. +type JobListerExpansion interface { + // GetPodJobs returns a list of Jobs that potentially + // match a Pod. Only the one specified in the Pod's ControllerRef + // will actually manage it. + // Returns an error only if no matching Jobs are found. + GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) +} + +// GetPodJobs returns a list of Jobs that potentially +// match a Pod. Only the one specified in the Pod's ControllerRef +// will actually manage it. +// Returns an error only if no matching Jobs are found. +func (l *jobLister) GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) { + if len(pod.Labels) == 0 { + err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name) + return + } + + var list []*batch.Job + list, err = l.Jobs(pod.Namespace).List(labels.Everything()) + if err != nil { + return + } + for _, job := range list { + selector, _ := metav1.LabelSelectorAsSelector(job.Spec.Selector) + if !selector.Matches(labels.Set(pod.Labels)) { + continue + } + jobs = append(jobs, *job) + } + if len(jobs) == 0 { + err = fmt.Errorf("could not find jobs for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + return +} + +// JobNamespaceListerExpansion allows custom methods to be added to +// JobNamespaceLister. +type JobNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/batch/v1beta1/cronjob.go b/vendor/k8s.io/client-go/listers/batch/v1beta1/cronjob.go new file mode 100644 index 000000000..4842d5e5a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1beta1/cronjob.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/batch/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CronJobLister helps list CronJobs. +// All objects returned here must be treated as read-only. +type CronJobLister interface { + // List lists all CronJobs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CronJob, err error) + // CronJobs returns an object that can list and get CronJobs. + CronJobs(namespace string) CronJobNamespaceLister + CronJobListerExpansion +} + +// cronJobLister implements the CronJobLister interface. +type cronJobLister struct { + indexer cache.Indexer +} + +// NewCronJobLister returns a new CronJobLister. +func NewCronJobLister(indexer cache.Indexer) CronJobLister { + return &cronJobLister{indexer: indexer} +} + +// List lists all CronJobs in the indexer. +func (s *cronJobLister) List(selector labels.Selector) (ret []*v1beta1.CronJob, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CronJob)) + }) + return ret, err +} + +// CronJobs returns an object that can list and get CronJobs. +func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister { + return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CronJobNamespaceLister helps list and get CronJobs. +// All objects returned here must be treated as read-only. +type CronJobNamespaceLister interface { + // List lists all CronJobs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CronJob, err error) + // Get retrieves the CronJob from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CronJob, error) + CronJobNamespaceListerExpansion +} + +// cronJobNamespaceLister implements the CronJobNamespaceLister +// interface. +type cronJobNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CronJobs in the indexer for a given namespace. +func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.CronJob, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CronJob)) + }) + return ret, err +} + +// Get retrieves the CronJob from the indexer for a given namespace and name. +func (s cronJobNamespaceLister) Get(name string) (*v1beta1.CronJob, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("cronjob"), name) + } + return obj.(*v1beta1.CronJob), nil +} diff --git a/vendor/k8s.io/client-go/listers/batch/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/batch/v1beta1/expansion_generated.go new file mode 100644 index 000000000..be2742ef6 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/batch/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// CronJobListerExpansion allows custom methods to be added to +// CronJobLister. +type CronJobListerExpansion interface{} + +// CronJobNamespaceListerExpansion allows custom methods to be added to +// CronJobNamespaceLister. +type CronJobNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1/certificatesigningrequest.go b/vendor/k8s.io/client-go/listers/certificates/v1/certificatesigningrequest.go new file mode 100644 index 000000000..0d04e118d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1/certificatesigningrequest.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/certificates/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestLister helps list CertificateSigningRequests. +// All objects returned here must be treated as read-only. +type CertificateSigningRequestLister interface { + // List lists all CertificateSigningRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CertificateSigningRequest, err error) + // Get retrieves the CertificateSigningRequest from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CertificateSigningRequest, error) + CertificateSigningRequestListerExpansion +} + +// certificateSigningRequestLister implements the CertificateSigningRequestLister interface. +type certificateSigningRequestLister struct { + indexer cache.Indexer +} + +// NewCertificateSigningRequestLister returns a new CertificateSigningRequestLister. +func NewCertificateSigningRequestLister(indexer cache.Indexer) CertificateSigningRequestLister { + return &certificateSigningRequestLister{indexer: indexer} +} + +// List lists all CertificateSigningRequests in the indexer. +func (s *certificateSigningRequestLister) List(selector labels.Selector) (ret []*v1.CertificateSigningRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CertificateSigningRequest)) + }) + return ret, err +} + +// Get retrieves the CertificateSigningRequest from the index for a given name. +func (s *certificateSigningRequestLister) Get(name string) (*v1.CertificateSigningRequest, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("certificatesigningrequest"), name) + } + return obj.(*v1.CertificateSigningRequest), nil +} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go new file mode 100644 index 000000000..616a1f1a0 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// CertificateSigningRequestListerExpansion allows custom methods to be added to +// CertificateSigningRequestLister. +type CertificateSigningRequestListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1beta1/certificatesigningrequest.go b/vendor/k8s.io/client-go/listers/certificates/v1beta1/certificatesigningrequest.go new file mode 100644 index 000000000..471b5629b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1beta1/certificatesigningrequest.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/certificates/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CertificateSigningRequestLister helps list CertificateSigningRequests. +// All objects returned here must be treated as read-only. +type CertificateSigningRequestLister interface { + // List lists all CertificateSigningRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CertificateSigningRequest, err error) + // Get retrieves the CertificateSigningRequest from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CertificateSigningRequest, error) + CertificateSigningRequestListerExpansion +} + +// certificateSigningRequestLister implements the CertificateSigningRequestLister interface. +type certificateSigningRequestLister struct { + indexer cache.Indexer +} + +// NewCertificateSigningRequestLister returns a new CertificateSigningRequestLister. +func NewCertificateSigningRequestLister(indexer cache.Indexer) CertificateSigningRequestLister { + return &certificateSigningRequestLister{indexer: indexer} +} + +// List lists all CertificateSigningRequests in the indexer. +func (s *certificateSigningRequestLister) List(selector labels.Selector) (ret []*v1beta1.CertificateSigningRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CertificateSigningRequest)) + }) + return ret, err +} + +// Get retrieves the CertificateSigningRequest from the index for a given name. +func (s *certificateSigningRequestLister) Get(name string) (*v1beta1.CertificateSigningRequest, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("certificatesigningrequest"), name) + } + return obj.(*v1beta1.CertificateSigningRequest), nil +} diff --git a/vendor/k8s.io/client-go/listers/certificates/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/certificates/v1beta1/expansion_generated.go new file mode 100644 index 000000000..68f993cd6 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/certificates/v1beta1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// CertificateSigningRequestListerExpansion allows custom methods to be added to +// CertificateSigningRequestLister. +type CertificateSigningRequestListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go new file mode 100644 index 000000000..ddc494f1c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/coordination/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// LeaseListerExpansion allows custom methods to be added to +// LeaseLister. +type LeaseListerExpansion interface{} + +// LeaseNamespaceListerExpansion allows custom methods to be added to +// LeaseNamespaceLister. +type LeaseNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/coordination/v1/lease.go b/vendor/k8s.io/client-go/listers/coordination/v1/lease.go new file mode 100644 index 000000000..de366d0e1 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/coordination/v1/lease.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/coordination/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LeaseLister helps list Leases. +// All objects returned here must be treated as read-only. +type LeaseLister interface { + // List lists all Leases in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Lease, err error) + // Leases returns an object that can list and get Leases. + Leases(namespace string) LeaseNamespaceLister + LeaseListerExpansion +} + +// leaseLister implements the LeaseLister interface. +type leaseLister struct { + indexer cache.Indexer +} + +// NewLeaseLister returns a new LeaseLister. +func NewLeaseLister(indexer cache.Indexer) LeaseLister { + return &leaseLister{indexer: indexer} +} + +// List lists all Leases in the indexer. +func (s *leaseLister) List(selector labels.Selector) (ret []*v1.Lease, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Lease)) + }) + return ret, err +} + +// Leases returns an object that can list and get Leases. +func (s *leaseLister) Leases(namespace string) LeaseNamespaceLister { + return leaseNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LeaseNamespaceLister helps list and get Leases. +// All objects returned here must be treated as read-only. +type LeaseNamespaceLister interface { + // List lists all Leases in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Lease, err error) + // Get retrieves the Lease from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Lease, error) + LeaseNamespaceListerExpansion +} + +// leaseNamespaceLister implements the LeaseNamespaceLister +// interface. +type leaseNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Leases in the indexer for a given namespace. +func (s leaseNamespaceLister) List(selector labels.Selector) (ret []*v1.Lease, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Lease)) + }) + return ret, err +} + +// Get retrieves the Lease from the indexer for a given namespace and name. +func (s leaseNamespaceLister) Get(name string) (*v1.Lease, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("lease"), name) + } + return obj.(*v1.Lease), nil +} diff --git a/vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go new file mode 100644 index 000000000..dddc53107 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/coordination/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// LeaseListerExpansion allows custom methods to be added to +// LeaseLister. +type LeaseListerExpansion interface{} + +// LeaseNamespaceListerExpansion allows custom methods to be added to +// LeaseNamespaceLister. +type LeaseNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go b/vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go new file mode 100644 index 000000000..8dfdc1e9b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/coordination/v1beta1/lease.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/coordination/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LeaseLister helps list Leases. +// All objects returned here must be treated as read-only. +type LeaseLister interface { + // List lists all Leases in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Lease, err error) + // Leases returns an object that can list and get Leases. + Leases(namespace string) LeaseNamespaceLister + LeaseListerExpansion +} + +// leaseLister implements the LeaseLister interface. +type leaseLister struct { + indexer cache.Indexer +} + +// NewLeaseLister returns a new LeaseLister. +func NewLeaseLister(indexer cache.Indexer) LeaseLister { + return &leaseLister{indexer: indexer} +} + +// List lists all Leases in the indexer. +func (s *leaseLister) List(selector labels.Selector) (ret []*v1beta1.Lease, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Lease)) + }) + return ret, err +} + +// Leases returns an object that can list and get Leases. +func (s *leaseLister) Leases(namespace string) LeaseNamespaceLister { + return leaseNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LeaseNamespaceLister helps list and get Leases. +// All objects returned here must be treated as read-only. +type LeaseNamespaceLister interface { + // List lists all Leases in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Lease, err error) + // Get retrieves the Lease from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Lease, error) + LeaseNamespaceListerExpansion +} + +// leaseNamespaceLister implements the LeaseNamespaceLister +// interface. +type leaseNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Leases in the indexer for a given namespace. +func (s leaseNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Lease, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Lease)) + }) + return ret, err +} + +// Get retrieves the Lease from the indexer for a given namespace and name. +func (s leaseNamespaceLister) Get(name string) (*v1beta1.Lease, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("lease"), name) + } + return obj.(*v1beta1.Lease), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/componentstatus.go b/vendor/k8s.io/client-go/listers/core/v1/componentstatus.go new file mode 100644 index 000000000..5fcdac3c7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/componentstatus.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ComponentStatusLister helps list ComponentStatuses. +// All objects returned here must be treated as read-only. +type ComponentStatusLister interface { + // List lists all ComponentStatuses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ComponentStatus, err error) + // Get retrieves the ComponentStatus from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ComponentStatus, error) + ComponentStatusListerExpansion +} + +// componentStatusLister implements the ComponentStatusLister interface. +type componentStatusLister struct { + indexer cache.Indexer +} + +// NewComponentStatusLister returns a new ComponentStatusLister. +func NewComponentStatusLister(indexer cache.Indexer) ComponentStatusLister { + return &componentStatusLister{indexer: indexer} +} + +// List lists all ComponentStatuses in the indexer. +func (s *componentStatusLister) List(selector labels.Selector) (ret []*v1.ComponentStatus, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ComponentStatus)) + }) + return ret, err +} + +// Get retrieves the ComponentStatus from the index for a given name. +func (s *componentStatusLister) Get(name string) (*v1.ComponentStatus, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("componentstatus"), name) + } + return obj.(*v1.ComponentStatus), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/configmap.go b/vendor/k8s.io/client-go/listers/core/v1/configmap.go new file mode 100644 index 000000000..6a410e47c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/configmap.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ConfigMapLister helps list ConfigMaps. +// All objects returned here must be treated as read-only. +type ConfigMapLister interface { + // List lists all ConfigMaps in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ConfigMap, err error) + // ConfigMaps returns an object that can list and get ConfigMaps. + ConfigMaps(namespace string) ConfigMapNamespaceLister + ConfigMapListerExpansion +} + +// configMapLister implements the ConfigMapLister interface. +type configMapLister struct { + indexer cache.Indexer +} + +// NewConfigMapLister returns a new ConfigMapLister. +func NewConfigMapLister(indexer cache.Indexer) ConfigMapLister { + return &configMapLister{indexer: indexer} +} + +// List lists all ConfigMaps in the indexer. +func (s *configMapLister) List(selector labels.Selector) (ret []*v1.ConfigMap, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ConfigMap)) + }) + return ret, err +} + +// ConfigMaps returns an object that can list and get ConfigMaps. +func (s *configMapLister) ConfigMaps(namespace string) ConfigMapNamespaceLister { + return configMapNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ConfigMapNamespaceLister helps list and get ConfigMaps. +// All objects returned here must be treated as read-only. +type ConfigMapNamespaceLister interface { + // List lists all ConfigMaps in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ConfigMap, err error) + // Get retrieves the ConfigMap from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ConfigMap, error) + ConfigMapNamespaceListerExpansion +} + +// configMapNamespaceLister implements the ConfigMapNamespaceLister +// interface. +type configMapNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ConfigMaps in the indexer for a given namespace. +func (s configMapNamespaceLister) List(selector labels.Selector) (ret []*v1.ConfigMap, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ConfigMap)) + }) + return ret, err +} + +// Get retrieves the ConfigMap from the indexer for a given namespace and name. +func (s configMapNamespaceLister) Get(name string) (*v1.ConfigMap, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("configmap"), name) + } + return obj.(*v1.ConfigMap), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/endpoints.go b/vendor/k8s.io/client-go/listers/core/v1/endpoints.go new file mode 100644 index 000000000..4759ce808 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/endpoints.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointsLister helps list Endpoints. +// All objects returned here must be treated as read-only. +type EndpointsLister interface { + // List lists all Endpoints in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Endpoints, err error) + // Endpoints returns an object that can list and get Endpoints. + Endpoints(namespace string) EndpointsNamespaceLister + EndpointsListerExpansion +} + +// endpointsLister implements the EndpointsLister interface. +type endpointsLister struct { + indexer cache.Indexer +} + +// NewEndpointsLister returns a new EndpointsLister. +func NewEndpointsLister(indexer cache.Indexer) EndpointsLister { + return &endpointsLister{indexer: indexer} +} + +// List lists all Endpoints in the indexer. +func (s *endpointsLister) List(selector labels.Selector) (ret []*v1.Endpoints, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Endpoints)) + }) + return ret, err +} + +// Endpoints returns an object that can list and get Endpoints. +func (s *endpointsLister) Endpoints(namespace string) EndpointsNamespaceLister { + return endpointsNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointsNamespaceLister helps list and get Endpoints. +// All objects returned here must be treated as read-only. +type EndpointsNamespaceLister interface { + // List lists all Endpoints in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Endpoints, err error) + // Get retrieves the Endpoints from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Endpoints, error) + EndpointsNamespaceListerExpansion +} + +// endpointsNamespaceLister implements the EndpointsNamespaceLister +// interface. +type endpointsNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Endpoints in the indexer for a given namespace. +func (s endpointsNamespaceLister) List(selector labels.Selector) (ret []*v1.Endpoints, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Endpoints)) + }) + return ret, err +} + +// Get retrieves the Endpoints from the indexer for a given namespace and name. +func (s endpointsNamespaceLister) Get(name string) (*v1.Endpoints, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("endpoints"), name) + } + return obj.(*v1.Endpoints), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/event.go b/vendor/k8s.io/client-go/listers/core/v1/event.go new file mode 100644 index 000000000..4416e2012 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/event.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EventLister helps list Events. +// All objects returned here must be treated as read-only. +type EventLister interface { + // List lists all Events in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Events returns an object that can list and get Events. + Events(namespace string) EventNamespaceLister + EventListerExpansion +} + +// eventLister implements the EventLister interface. +type eventLister struct { + indexer cache.Indexer +} + +// NewEventLister returns a new EventLister. +func NewEventLister(indexer cache.Indexer) EventLister { + return &eventLister{indexer: indexer} +} + +// List lists all Events in the indexer. +func (s *eventLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get Events. +func (s *eventLister) Events(namespace string) EventNamespaceLister { + return eventNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EventNamespaceLister helps list and get Events. +// All objects returned here must be treated as read-only. +type EventNamespaceLister interface { + // List lists all Events in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Get retrieves the Event from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Event, error) + EventNamespaceListerExpansion +} + +// eventNamespaceLister implements the EventNamespaceLister +// interface. +type eventNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Events in the indexer for a given namespace. +func (s eventNamespaceLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Get retrieves the Event from the indexer for a given namespace and name. +func (s eventNamespaceLister) Get(name string) (*v1.Event, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("event"), name) + } + return obj.(*v1.Event), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/core/v1/expansion_generated.go new file mode 100644 index 000000000..2168a7f48 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/expansion_generated.go @@ -0,0 +1,123 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// ComponentStatusListerExpansion allows custom methods to be added to +// ComponentStatusLister. +type ComponentStatusListerExpansion interface{} + +// ConfigMapListerExpansion allows custom methods to be added to +// ConfigMapLister. +type ConfigMapListerExpansion interface{} + +// ConfigMapNamespaceListerExpansion allows custom methods to be added to +// ConfigMapNamespaceLister. +type ConfigMapNamespaceListerExpansion interface{} + +// EndpointsListerExpansion allows custom methods to be added to +// EndpointsLister. +type EndpointsListerExpansion interface{} + +// EndpointsNamespaceListerExpansion allows custom methods to be added to +// EndpointsNamespaceLister. +type EndpointsNamespaceListerExpansion interface{} + +// EventListerExpansion allows custom methods to be added to +// EventLister. +type EventListerExpansion interface{} + +// EventNamespaceListerExpansion allows custom methods to be added to +// EventNamespaceLister. +type EventNamespaceListerExpansion interface{} + +// LimitRangeListerExpansion allows custom methods to be added to +// LimitRangeLister. +type LimitRangeListerExpansion interface{} + +// LimitRangeNamespaceListerExpansion allows custom methods to be added to +// LimitRangeNamespaceLister. +type LimitRangeNamespaceListerExpansion interface{} + +// NamespaceListerExpansion allows custom methods to be added to +// NamespaceLister. +type NamespaceListerExpansion interface{} + +// NodeListerExpansion allows custom methods to be added to +// NodeLister. +type NodeListerExpansion interface{} + +// PersistentVolumeListerExpansion allows custom methods to be added to +// PersistentVolumeLister. +type PersistentVolumeListerExpansion interface{} + +// PersistentVolumeClaimListerExpansion allows custom methods to be added to +// PersistentVolumeClaimLister. +type PersistentVolumeClaimListerExpansion interface{} + +// PersistentVolumeClaimNamespaceListerExpansion allows custom methods to be added to +// PersistentVolumeClaimNamespaceLister. +type PersistentVolumeClaimNamespaceListerExpansion interface{} + +// PodListerExpansion allows custom methods to be added to +// PodLister. +type PodListerExpansion interface{} + +// PodNamespaceListerExpansion allows custom methods to be added to +// PodNamespaceLister. +type PodNamespaceListerExpansion interface{} + +// PodTemplateListerExpansion allows custom methods to be added to +// PodTemplateLister. +type PodTemplateListerExpansion interface{} + +// PodTemplateNamespaceListerExpansion allows custom methods to be added to +// PodTemplateNamespaceLister. +type PodTemplateNamespaceListerExpansion interface{} + +// ResourceQuotaListerExpansion allows custom methods to be added to +// ResourceQuotaLister. +type ResourceQuotaListerExpansion interface{} + +// ResourceQuotaNamespaceListerExpansion allows custom methods to be added to +// ResourceQuotaNamespaceLister. +type ResourceQuotaNamespaceListerExpansion interface{} + +// SecretListerExpansion allows custom methods to be added to +// SecretLister. +type SecretListerExpansion interface{} + +// SecretNamespaceListerExpansion allows custom methods to be added to +// SecretNamespaceLister. +type SecretNamespaceListerExpansion interface{} + +// ServiceListerExpansion allows custom methods to be added to +// ServiceLister. +type ServiceListerExpansion interface{} + +// ServiceNamespaceListerExpansion allows custom methods to be added to +// ServiceNamespaceLister. +type ServiceNamespaceListerExpansion interface{} + +// ServiceAccountListerExpansion allows custom methods to be added to +// ServiceAccountLister. +type ServiceAccountListerExpansion interface{} + +// ServiceAccountNamespaceListerExpansion allows custom methods to be added to +// ServiceAccountNamespaceLister. +type ServiceAccountNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/core/v1/limitrange.go b/vendor/k8s.io/client-go/listers/core/v1/limitrange.go new file mode 100644 index 000000000..d8fa569cd --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/limitrange.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LimitRangeLister helps list LimitRanges. +// All objects returned here must be treated as read-only. +type LimitRangeLister interface { + // List lists all LimitRanges in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.LimitRange, err error) + // LimitRanges returns an object that can list and get LimitRanges. + LimitRanges(namespace string) LimitRangeNamespaceLister + LimitRangeListerExpansion +} + +// limitRangeLister implements the LimitRangeLister interface. +type limitRangeLister struct { + indexer cache.Indexer +} + +// NewLimitRangeLister returns a new LimitRangeLister. +func NewLimitRangeLister(indexer cache.Indexer) LimitRangeLister { + return &limitRangeLister{indexer: indexer} +} + +// List lists all LimitRanges in the indexer. +func (s *limitRangeLister) List(selector labels.Selector) (ret []*v1.LimitRange, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.LimitRange)) + }) + return ret, err +} + +// LimitRanges returns an object that can list and get LimitRanges. +func (s *limitRangeLister) LimitRanges(namespace string) LimitRangeNamespaceLister { + return limitRangeNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LimitRangeNamespaceLister helps list and get LimitRanges. +// All objects returned here must be treated as read-only. +type LimitRangeNamespaceLister interface { + // List lists all LimitRanges in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.LimitRange, err error) + // Get retrieves the LimitRange from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.LimitRange, error) + LimitRangeNamespaceListerExpansion +} + +// limitRangeNamespaceLister implements the LimitRangeNamespaceLister +// interface. +type limitRangeNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all LimitRanges in the indexer for a given namespace. +func (s limitRangeNamespaceLister) List(selector labels.Selector) (ret []*v1.LimitRange, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.LimitRange)) + }) + return ret, err +} + +// Get retrieves the LimitRange from the indexer for a given namespace and name. +func (s limitRangeNamespaceLister) Get(name string) (*v1.LimitRange, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("limitrange"), name) + } + return obj.(*v1.LimitRange), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/namespace.go b/vendor/k8s.io/client-go/listers/core/v1/namespace.go new file mode 100644 index 000000000..454aa1a0a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/namespace.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NamespaceLister helps list Namespaces. +// All objects returned here must be treated as read-only. +type NamespaceLister interface { + // List lists all Namespaces in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Namespace, err error) + // Get retrieves the Namespace from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Namespace, error) + NamespaceListerExpansion +} + +// namespaceLister implements the NamespaceLister interface. +type namespaceLister struct { + indexer cache.Indexer +} + +// NewNamespaceLister returns a new NamespaceLister. +func NewNamespaceLister(indexer cache.Indexer) NamespaceLister { + return &namespaceLister{indexer: indexer} +} + +// List lists all Namespaces in the indexer. +func (s *namespaceLister) List(selector labels.Selector) (ret []*v1.Namespace, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Namespace)) + }) + return ret, err +} + +// Get retrieves the Namespace from the index for a given name. +func (s *namespaceLister) Get(name string) (*v1.Namespace, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("namespace"), name) + } + return obj.(*v1.Namespace), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/node.go b/vendor/k8s.io/client-go/listers/core/v1/node.go new file mode 100644 index 000000000..596049857 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/node.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NodeLister helps list Nodes. +// All objects returned here must be treated as read-only. +type NodeLister interface { + // List lists all Nodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Node, err error) + // Get retrieves the Node from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Node, error) + NodeListerExpansion +} + +// nodeLister implements the NodeLister interface. +type nodeLister struct { + indexer cache.Indexer +} + +// NewNodeLister returns a new NodeLister. +func NewNodeLister(indexer cache.Indexer) NodeLister { + return &nodeLister{indexer: indexer} +} + +// List lists all Nodes in the indexer. +func (s *nodeLister) List(selector labels.Selector) (ret []*v1.Node, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Node)) + }) + return ret, err +} + +// Get retrieves the Node from the index for a given name. +func (s *nodeLister) Get(name string) (*v1.Node, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("node"), name) + } + return obj.(*v1.Node), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/persistentvolume.go b/vendor/k8s.io/client-go/listers/core/v1/persistentvolume.go new file mode 100644 index 000000000..e7dfd4ac9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/persistentvolume.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeLister helps list PersistentVolumes. +// All objects returned here must be treated as read-only. +type PersistentVolumeLister interface { + // List lists all PersistentVolumes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolume, err error) + // Get retrieves the PersistentVolume from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PersistentVolume, error) + PersistentVolumeListerExpansion +} + +// persistentVolumeLister implements the PersistentVolumeLister interface. +type persistentVolumeLister struct { + indexer cache.Indexer +} + +// NewPersistentVolumeLister returns a new PersistentVolumeLister. +func NewPersistentVolumeLister(indexer cache.Indexer) PersistentVolumeLister { + return &persistentVolumeLister{indexer: indexer} +} + +// List lists all PersistentVolumes in the indexer. +func (s *persistentVolumeLister) List(selector labels.Selector) (ret []*v1.PersistentVolume, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolume)) + }) + return ret, err +} + +// Get retrieves the PersistentVolume from the index for a given name. +func (s *persistentVolumeLister) Get(name string) (*v1.PersistentVolume, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("persistentvolume"), name) + } + return obj.(*v1.PersistentVolume), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/persistentvolumeclaim.go b/vendor/k8s.io/client-go/listers/core/v1/persistentvolumeclaim.go new file mode 100644 index 000000000..fc71bb5a1 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/persistentvolumeclaim.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PersistentVolumeClaimLister helps list PersistentVolumeClaims. +// All objects returned here must be treated as read-only. +type PersistentVolumeClaimLister interface { + // List lists all PersistentVolumeClaims in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) + // PersistentVolumeClaims returns an object that can list and get PersistentVolumeClaims. + PersistentVolumeClaims(namespace string) PersistentVolumeClaimNamespaceLister + PersistentVolumeClaimListerExpansion +} + +// persistentVolumeClaimLister implements the PersistentVolumeClaimLister interface. +type persistentVolumeClaimLister struct { + indexer cache.Indexer +} + +// NewPersistentVolumeClaimLister returns a new PersistentVolumeClaimLister. +func NewPersistentVolumeClaimLister(indexer cache.Indexer) PersistentVolumeClaimLister { + return &persistentVolumeClaimLister{indexer: indexer} +} + +// List lists all PersistentVolumeClaims in the indexer. +func (s *persistentVolumeClaimLister) List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolumeClaim)) + }) + return ret, err +} + +// PersistentVolumeClaims returns an object that can list and get PersistentVolumeClaims. +func (s *persistentVolumeClaimLister) PersistentVolumeClaims(namespace string) PersistentVolumeClaimNamespaceLister { + return persistentVolumeClaimNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PersistentVolumeClaimNamespaceLister helps list and get PersistentVolumeClaims. +// All objects returned here must be treated as read-only. +type PersistentVolumeClaimNamespaceLister interface { + // List lists all PersistentVolumeClaims in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) + // Get retrieves the PersistentVolumeClaim from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PersistentVolumeClaim, error) + PersistentVolumeClaimNamespaceListerExpansion +} + +// persistentVolumeClaimNamespaceLister implements the PersistentVolumeClaimNamespaceLister +// interface. +type persistentVolumeClaimNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PersistentVolumeClaims in the indexer for a given namespace. +func (s persistentVolumeClaimNamespaceLister) List(selector labels.Selector) (ret []*v1.PersistentVolumeClaim, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PersistentVolumeClaim)) + }) + return ret, err +} + +// Get retrieves the PersistentVolumeClaim from the indexer for a given namespace and name. +func (s persistentVolumeClaimNamespaceLister) Get(name string) (*v1.PersistentVolumeClaim, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("persistentvolumeclaim"), name) + } + return obj.(*v1.PersistentVolumeClaim), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/pod.go b/vendor/k8s.io/client-go/listers/core/v1/pod.go new file mode 100644 index 000000000..ab8f0946c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/pod.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodLister helps list Pods. +// All objects returned here must be treated as read-only. +type PodLister interface { + // List lists all Pods in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Pod, err error) + // Pods returns an object that can list and get Pods. + Pods(namespace string) PodNamespaceLister + PodListerExpansion +} + +// podLister implements the PodLister interface. +type podLister struct { + indexer cache.Indexer +} + +// NewPodLister returns a new PodLister. +func NewPodLister(indexer cache.Indexer) PodLister { + return &podLister{indexer: indexer} +} + +// List lists all Pods in the indexer. +func (s *podLister) List(selector labels.Selector) (ret []*v1.Pod, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Pod)) + }) + return ret, err +} + +// Pods returns an object that can list and get Pods. +func (s *podLister) Pods(namespace string) PodNamespaceLister { + return podNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodNamespaceLister helps list and get Pods. +// All objects returned here must be treated as read-only. +type PodNamespaceLister interface { + // List lists all Pods in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Pod, err error) + // Get retrieves the Pod from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Pod, error) + PodNamespaceListerExpansion +} + +// podNamespaceLister implements the PodNamespaceLister +// interface. +type podNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Pods in the indexer for a given namespace. +func (s podNamespaceLister) List(selector labels.Selector) (ret []*v1.Pod, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Pod)) + }) + return ret, err +} + +// Get retrieves the Pod from the indexer for a given namespace and name. +func (s podNamespaceLister) Get(name string) (*v1.Pod, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("pod"), name) + } + return obj.(*v1.Pod), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/podtemplate.go b/vendor/k8s.io/client-go/listers/core/v1/podtemplate.go new file mode 100644 index 000000000..6c310045b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/podtemplate.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodTemplateLister helps list PodTemplates. +// All objects returned here must be treated as read-only. +type PodTemplateLister interface { + // List lists all PodTemplates in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodTemplate, err error) + // PodTemplates returns an object that can list and get PodTemplates. + PodTemplates(namespace string) PodTemplateNamespaceLister + PodTemplateListerExpansion +} + +// podTemplateLister implements the PodTemplateLister interface. +type podTemplateLister struct { + indexer cache.Indexer +} + +// NewPodTemplateLister returns a new PodTemplateLister. +func NewPodTemplateLister(indexer cache.Indexer) PodTemplateLister { + return &podTemplateLister{indexer: indexer} +} + +// List lists all PodTemplates in the indexer. +func (s *podTemplateLister) List(selector labels.Selector) (ret []*v1.PodTemplate, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodTemplate)) + }) + return ret, err +} + +// PodTemplates returns an object that can list and get PodTemplates. +func (s *podTemplateLister) PodTemplates(namespace string) PodTemplateNamespaceLister { + return podTemplateNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodTemplateNamespaceLister helps list and get PodTemplates. +// All objects returned here must be treated as read-only. +type PodTemplateNamespaceLister interface { + // List lists all PodTemplates in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodTemplate, err error) + // Get retrieves the PodTemplate from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PodTemplate, error) + PodTemplateNamespaceListerExpansion +} + +// podTemplateNamespaceLister implements the PodTemplateNamespaceLister +// interface. +type podTemplateNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PodTemplates in the indexer for a given namespace. +func (s podTemplateNamespaceLister) List(selector labels.Selector) (ret []*v1.PodTemplate, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodTemplate)) + }) + return ret, err +} + +// Get retrieves the PodTemplate from the indexer for a given namespace and name. +func (s podTemplateNamespaceLister) Get(name string) (*v1.PodTemplate, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("podtemplate"), name) + } + return obj.(*v1.PodTemplate), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller.go b/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller.go new file mode 100644 index 000000000..e28e2ef76 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicationControllerLister helps list ReplicationControllers. +// All objects returned here must be treated as read-only. +type ReplicationControllerLister interface { + // List lists all ReplicationControllers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicationController, err error) + // ReplicationControllers returns an object that can list and get ReplicationControllers. + ReplicationControllers(namespace string) ReplicationControllerNamespaceLister + ReplicationControllerListerExpansion +} + +// replicationControllerLister implements the ReplicationControllerLister interface. +type replicationControllerLister struct { + indexer cache.Indexer +} + +// NewReplicationControllerLister returns a new ReplicationControllerLister. +func NewReplicationControllerLister(indexer cache.Indexer) ReplicationControllerLister { + return &replicationControllerLister{indexer: indexer} +} + +// List lists all ReplicationControllers in the indexer. +func (s *replicationControllerLister) List(selector labels.Selector) (ret []*v1.ReplicationController, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicationController)) + }) + return ret, err +} + +// ReplicationControllers returns an object that can list and get ReplicationControllers. +func (s *replicationControllerLister) ReplicationControllers(namespace string) ReplicationControllerNamespaceLister { + return replicationControllerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicationControllerNamespaceLister helps list and get ReplicationControllers. +// All objects returned here must be treated as read-only. +type ReplicationControllerNamespaceLister interface { + // List lists all ReplicationControllers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ReplicationController, err error) + // Get retrieves the ReplicationController from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ReplicationController, error) + ReplicationControllerNamespaceListerExpansion +} + +// replicationControllerNamespaceLister implements the ReplicationControllerNamespaceLister +// interface. +type replicationControllerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicationControllers in the indexer for a given namespace. +func (s replicationControllerNamespaceLister) List(selector labels.Selector) (ret []*v1.ReplicationController, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ReplicationController)) + }) + return ret, err +} + +// Get retrieves the ReplicationController from the indexer for a given namespace and name. +func (s replicationControllerNamespaceLister) Get(name string) (*v1.ReplicationController, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("replicationcontroller"), name) + } + return obj.(*v1.ReplicationController), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go b/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go new file mode 100644 index 000000000..b031d5217 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go @@ -0,0 +1,66 @@ +/* +Copyright 2017 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 v1 + +import ( + "fmt" + + "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// ReplicationControllerListerExpansion allows custom methods to be added to +// ReplicationControllerLister. +type ReplicationControllerListerExpansion interface { + GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) +} + +// ReplicationControllerNamespaceListerExpansion allows custom methods to be added to +// ReplicationControllerNamespaceLister. +type ReplicationControllerNamespaceListerExpansion interface{} + +// GetPodControllers returns a list of ReplicationControllers that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicationControllers are found. +func (s *replicationControllerLister) GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no controllers found for pod %v because it has no labels", pod.Name) + } + + items, err := s.ReplicationControllers(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var controllers []*v1.ReplicationController + for i := range items { + rc := items[i] + selector := labels.Set(rc.Spec.Selector).AsSelectorPreValidated() + + // If an rc with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + controllers = append(controllers, rc) + } + + if len(controllers) == 0 { + return nil, fmt.Errorf("could not find controller for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return controllers, nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/resourcequota.go b/vendor/k8s.io/client-go/listers/core/v1/resourcequota.go new file mode 100644 index 000000000..9c00b49d4 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/resourcequota.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ResourceQuotaLister helps list ResourceQuotas. +// All objects returned here must be treated as read-only. +type ResourceQuotaLister interface { + // List lists all ResourceQuotas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) + // ResourceQuotas returns an object that can list and get ResourceQuotas. + ResourceQuotas(namespace string) ResourceQuotaNamespaceLister + ResourceQuotaListerExpansion +} + +// resourceQuotaLister implements the ResourceQuotaLister interface. +type resourceQuotaLister struct { + indexer cache.Indexer +} + +// NewResourceQuotaLister returns a new ResourceQuotaLister. +func NewResourceQuotaLister(indexer cache.Indexer) ResourceQuotaLister { + return &resourceQuotaLister{indexer: indexer} +} + +// List lists all ResourceQuotas in the indexer. +func (s *resourceQuotaLister) List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceQuota)) + }) + return ret, err +} + +// ResourceQuotas returns an object that can list and get ResourceQuotas. +func (s *resourceQuotaLister) ResourceQuotas(namespace string) ResourceQuotaNamespaceLister { + return resourceQuotaNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ResourceQuotaNamespaceLister helps list and get ResourceQuotas. +// All objects returned here must be treated as read-only. +type ResourceQuotaNamespaceLister interface { + // List lists all ResourceQuotas in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) + // Get retrieves the ResourceQuota from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ResourceQuota, error) + ResourceQuotaNamespaceListerExpansion +} + +// resourceQuotaNamespaceLister implements the ResourceQuotaNamespaceLister +// interface. +type resourceQuotaNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ResourceQuotas in the indexer for a given namespace. +func (s resourceQuotaNamespaceLister) List(selector labels.Selector) (ret []*v1.ResourceQuota, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ResourceQuota)) + }) + return ret, err +} + +// Get retrieves the ResourceQuota from the indexer for a given namespace and name. +func (s resourceQuotaNamespaceLister) Get(name string) (*v1.ResourceQuota, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("resourcequota"), name) + } + return obj.(*v1.ResourceQuota), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/secret.go b/vendor/k8s.io/client-go/listers/core/v1/secret.go new file mode 100644 index 000000000..d386d4d5c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/secret.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SecretLister helps list Secrets. +// All objects returned here must be treated as read-only. +type SecretLister interface { + // List lists all Secrets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Secret, err error) + // Secrets returns an object that can list and get Secrets. + Secrets(namespace string) SecretNamespaceLister + SecretListerExpansion +} + +// secretLister implements the SecretLister interface. +type secretLister struct { + indexer cache.Indexer +} + +// NewSecretLister returns a new SecretLister. +func NewSecretLister(indexer cache.Indexer) SecretLister { + return &secretLister{indexer: indexer} +} + +// List lists all Secrets in the indexer. +func (s *secretLister) List(selector labels.Selector) (ret []*v1.Secret, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Secret)) + }) + return ret, err +} + +// Secrets returns an object that can list and get Secrets. +func (s *secretLister) Secrets(namespace string) SecretNamespaceLister { + return secretNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SecretNamespaceLister helps list and get Secrets. +// All objects returned here must be treated as read-only. +type SecretNamespaceLister interface { + // List lists all Secrets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Secret, err error) + // Get retrieves the Secret from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Secret, error) + SecretNamespaceListerExpansion +} + +// secretNamespaceLister implements the SecretNamespaceLister +// interface. +type secretNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Secrets in the indexer for a given namespace. +func (s secretNamespaceLister) List(selector labels.Selector) (ret []*v1.Secret, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Secret)) + }) + return ret, err +} + +// Get retrieves the Secret from the indexer for a given namespace and name. +func (s secretNamespaceLister) Get(name string) (*v1.Secret, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("secret"), name) + } + return obj.(*v1.Secret), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/service.go b/vendor/k8s.io/client-go/listers/core/v1/service.go new file mode 100644 index 000000000..51026d7b4 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/service.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServiceLister helps list Services. +// All objects returned here must be treated as read-only. +type ServiceLister interface { + // List lists all Services in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Service, err error) + // Services returns an object that can list and get Services. + Services(namespace string) ServiceNamespaceLister + ServiceListerExpansion +} + +// serviceLister implements the ServiceLister interface. +type serviceLister struct { + indexer cache.Indexer +} + +// NewServiceLister returns a new ServiceLister. +func NewServiceLister(indexer cache.Indexer) ServiceLister { + return &serviceLister{indexer: indexer} +} + +// List lists all Services in the indexer. +func (s *serviceLister) List(selector labels.Selector) (ret []*v1.Service, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Service)) + }) + return ret, err +} + +// Services returns an object that can list and get Services. +func (s *serviceLister) Services(namespace string) ServiceNamespaceLister { + return serviceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceNamespaceLister helps list and get Services. +// All objects returned here must be treated as read-only. +type ServiceNamespaceLister interface { + // List lists all Services in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Service, err error) + // Get retrieves the Service from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Service, error) + ServiceNamespaceListerExpansion +} + +// serviceNamespaceLister implements the ServiceNamespaceLister +// interface. +type serviceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Services in the indexer for a given namespace. +func (s serviceNamespaceLister) List(selector labels.Selector) (ret []*v1.Service, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Service)) + }) + return ret, err +} + +// Get retrieves the Service from the indexer for a given namespace and name. +func (s serviceNamespaceLister) Get(name string) (*v1.Service, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("service"), name) + } + return obj.(*v1.Service), nil +} diff --git a/vendor/k8s.io/client-go/listers/core/v1/serviceaccount.go b/vendor/k8s.io/client-go/listers/core/v1/serviceaccount.go new file mode 100644 index 000000000..aa9554d8b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/core/v1/serviceaccount.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ServiceAccountLister helps list ServiceAccounts. +// All objects returned here must be treated as read-only. +type ServiceAccountLister interface { + // List lists all ServiceAccounts in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) + // ServiceAccounts returns an object that can list and get ServiceAccounts. + ServiceAccounts(namespace string) ServiceAccountNamespaceLister + ServiceAccountListerExpansion +} + +// serviceAccountLister implements the ServiceAccountLister interface. +type serviceAccountLister struct { + indexer cache.Indexer +} + +// NewServiceAccountLister returns a new ServiceAccountLister. +func NewServiceAccountLister(indexer cache.Indexer) ServiceAccountLister { + return &serviceAccountLister{indexer: indexer} +} + +// List lists all ServiceAccounts in the indexer. +func (s *serviceAccountLister) List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceAccount)) + }) + return ret, err +} + +// ServiceAccounts returns an object that can list and get ServiceAccounts. +func (s *serviceAccountLister) ServiceAccounts(namespace string) ServiceAccountNamespaceLister { + return serviceAccountNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ServiceAccountNamespaceLister helps list and get ServiceAccounts. +// All objects returned here must be treated as read-only. +type ServiceAccountNamespaceLister interface { + // List lists all ServiceAccounts in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) + // Get retrieves the ServiceAccount from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ServiceAccount, error) + ServiceAccountNamespaceListerExpansion +} + +// serviceAccountNamespaceLister implements the ServiceAccountNamespaceLister +// interface. +type serviceAccountNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ServiceAccounts in the indexer for a given namespace. +func (s serviceAccountNamespaceLister) List(selector labels.Selector) (ret []*v1.ServiceAccount, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ServiceAccount)) + }) + return ret, err +} + +// Get retrieves the ServiceAccount from the indexer for a given namespace and name. +func (s serviceAccountNamespaceLister) Get(name string) (*v1.ServiceAccount, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("serviceaccount"), name) + } + return obj.(*v1.ServiceAccount), nil +} diff --git a/vendor/k8s.io/client-go/listers/discovery/v1/endpointslice.go b/vendor/k8s.io/client-go/listers/discovery/v1/endpointslice.go new file mode 100644 index 000000000..4dd46ff1b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/discovery/v1/endpointslice.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/discovery/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointSliceLister helps list EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceLister interface { + // List lists all EndpointSlices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) + // EndpointSlices returns an object that can list and get EndpointSlices. + EndpointSlices(namespace string) EndpointSliceNamespaceLister + EndpointSliceListerExpansion +} + +// endpointSliceLister implements the EndpointSliceLister interface. +type endpointSliceLister struct { + indexer cache.Indexer +} + +// NewEndpointSliceLister returns a new EndpointSliceLister. +func NewEndpointSliceLister(indexer cache.Indexer) EndpointSliceLister { + return &endpointSliceLister{indexer: indexer} +} + +// List lists all EndpointSlices in the indexer. +func (s *endpointSliceLister) List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.EndpointSlice)) + }) + return ret, err +} + +// EndpointSlices returns an object that can list and get EndpointSlices. +func (s *endpointSliceLister) EndpointSlices(namespace string) EndpointSliceNamespaceLister { + return endpointSliceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointSliceNamespaceLister helps list and get EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceNamespaceLister interface { + // List lists all EndpointSlices in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) + // Get retrieves the EndpointSlice from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.EndpointSlice, error) + EndpointSliceNamespaceListerExpansion +} + +// endpointSliceNamespaceLister implements the EndpointSliceNamespaceLister +// interface. +type endpointSliceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all EndpointSlices in the indexer for a given namespace. +func (s endpointSliceNamespaceLister) List(selector labels.Selector) (ret []*v1.EndpointSlice, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.EndpointSlice)) + }) + return ret, err +} + +// Get retrieves the EndpointSlice from the indexer for a given namespace and name. +func (s endpointSliceNamespaceLister) Get(name string) (*v1.EndpointSlice, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("endpointslice"), name) + } + return obj.(*v1.EndpointSlice), nil +} diff --git a/vendor/k8s.io/client-go/listers/discovery/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/discovery/v1/expansion_generated.go new file mode 100644 index 000000000..660163eee --- /dev/null +++ b/vendor/k8s.io/client-go/listers/discovery/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// EndpointSliceListerExpansion allows custom methods to be added to +// EndpointSliceLister. +type EndpointSliceListerExpansion interface{} + +// EndpointSliceNamespaceListerExpansion allows custom methods to be added to +// EndpointSliceNamespaceLister. +type EndpointSliceNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go b/vendor/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go new file mode 100644 index 000000000..e92872d5f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/discovery/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointSliceLister helps list EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceLister interface { + // List lists all EndpointSlices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) + // EndpointSlices returns an object that can list and get EndpointSlices. + EndpointSlices(namespace string) EndpointSliceNamespaceLister + EndpointSliceListerExpansion +} + +// endpointSliceLister implements the EndpointSliceLister interface. +type endpointSliceLister struct { + indexer cache.Indexer +} + +// NewEndpointSliceLister returns a new EndpointSliceLister. +func NewEndpointSliceLister(indexer cache.Indexer) EndpointSliceLister { + return &endpointSliceLister{indexer: indexer} +} + +// List lists all EndpointSlices in the indexer. +func (s *endpointSliceLister) List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.EndpointSlice)) + }) + return ret, err +} + +// EndpointSlices returns an object that can list and get EndpointSlices. +func (s *endpointSliceLister) EndpointSlices(namespace string) EndpointSliceNamespaceLister { + return endpointSliceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointSliceNamespaceLister helps list and get EndpointSlices. +// All objects returned here must be treated as read-only. +type EndpointSliceNamespaceLister interface { + // List lists all EndpointSlices in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) + // Get retrieves the EndpointSlice from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.EndpointSlice, error) + EndpointSliceNamespaceListerExpansion +} + +// endpointSliceNamespaceLister implements the EndpointSliceNamespaceLister +// interface. +type endpointSliceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all EndpointSlices in the indexer for a given namespace. +func (s endpointSliceNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.EndpointSlice)) + }) + return ret, err +} + +// Get retrieves the EndpointSlice from the indexer for a given namespace and name. +func (s endpointSliceNamespaceLister) Get(name string) (*v1beta1.EndpointSlice, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("endpointslice"), name) + } + return obj.(*v1beta1.EndpointSlice), nil +} diff --git a/vendor/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go new file mode 100644 index 000000000..9619bbd8d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// EndpointSliceListerExpansion allows custom methods to be added to +// EndpointSliceLister. +type EndpointSliceListerExpansion interface{} + +// EndpointSliceNamespaceListerExpansion allows custom methods to be added to +// EndpointSliceNamespaceLister. +type EndpointSliceNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/events/v1/event.go b/vendor/k8s.io/client-go/listers/events/v1/event.go new file mode 100644 index 000000000..4abe841e2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/events/v1/event.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/events/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EventLister helps list Events. +// All objects returned here must be treated as read-only. +type EventLister interface { + // List lists all Events in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Events returns an object that can list and get Events. + Events(namespace string) EventNamespaceLister + EventListerExpansion +} + +// eventLister implements the EventLister interface. +type eventLister struct { + indexer cache.Indexer +} + +// NewEventLister returns a new EventLister. +func NewEventLister(indexer cache.Indexer) EventLister { + return &eventLister{indexer: indexer} +} + +// List lists all Events in the indexer. +func (s *eventLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get Events. +func (s *eventLister) Events(namespace string) EventNamespaceLister { + return eventNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EventNamespaceLister helps list and get Events. +// All objects returned here must be treated as read-only. +type EventNamespaceLister interface { + // List lists all Events in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Event, err error) + // Get retrieves the Event from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Event, error) + EventNamespaceListerExpansion +} + +// eventNamespaceLister implements the EventNamespaceLister +// interface. +type eventNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Events in the indexer for a given namespace. +func (s eventNamespaceLister) List(selector labels.Selector) (ret []*v1.Event, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Event)) + }) + return ret, err +} + +// Get retrieves the Event from the indexer for a given namespace and name. +func (s eventNamespaceLister) Get(name string) (*v1.Event, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("event"), name) + } + return obj.(*v1.Event), nil +} diff --git a/vendor/k8s.io/client-go/listers/events/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/events/v1/expansion_generated.go new file mode 100644 index 000000000..348e784d7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/events/v1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// EventListerExpansion allows custom methods to be added to +// EventLister. +type EventListerExpansion interface{} + +// EventNamespaceListerExpansion allows custom methods to be added to +// EventNamespaceLister. +type EventNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/events/v1beta1/event.go b/vendor/k8s.io/client-go/listers/events/v1beta1/event.go new file mode 100644 index 000000000..41a521be6 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/events/v1beta1/event.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/events/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EventLister helps list Events. +// All objects returned here must be treated as read-only. +type EventLister interface { + // List lists all Events in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Event, err error) + // Events returns an object that can list and get Events. + Events(namespace string) EventNamespaceLister + EventListerExpansion +} + +// eventLister implements the EventLister interface. +type eventLister struct { + indexer cache.Indexer +} + +// NewEventLister returns a new EventLister. +func NewEventLister(indexer cache.Indexer) EventLister { + return &eventLister{indexer: indexer} +} + +// List lists all Events in the indexer. +func (s *eventLister) List(selector labels.Selector) (ret []*v1beta1.Event, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Event)) + }) + return ret, err +} + +// Events returns an object that can list and get Events. +func (s *eventLister) Events(namespace string) EventNamespaceLister { + return eventNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EventNamespaceLister helps list and get Events. +// All objects returned here must be treated as read-only. +type EventNamespaceLister interface { + // List lists all Events in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Event, err error) + // Get retrieves the Event from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Event, error) + EventNamespaceListerExpansion +} + +// eventNamespaceLister implements the EventNamespaceLister +// interface. +type eventNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Events in the indexer for a given namespace. +func (s eventNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Event, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Event)) + }) + return ret, err +} + +// Get retrieves the Event from the indexer for a given namespace and name. +func (s eventNamespaceLister) Get(name string) (*v1beta1.Event, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("event"), name) + } + return obj.(*v1beta1.Event), nil +} diff --git a/vendor/k8s.io/client-go/listers/events/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/events/v1beta1/expansion_generated.go new file mode 100644 index 000000000..d311691d9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/events/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// EventListerExpansion allows custom methods to be added to +// EventLister. +type EventListerExpansion interface{} + +// EventNamespaceListerExpansion allows custom methods to be added to +// EventNamespaceLister. +type EventNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset.go new file mode 100644 index 000000000..900475410 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DaemonSetLister helps list DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetLister interface { + // List lists all DaemonSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.DaemonSet, err error) + // DaemonSets returns an object that can list and get DaemonSets. + DaemonSets(namespace string) DaemonSetNamespaceLister + DaemonSetListerExpansion +} + +// daemonSetLister implements the DaemonSetLister interface. +type daemonSetLister struct { + indexer cache.Indexer +} + +// NewDaemonSetLister returns a new DaemonSetLister. +func NewDaemonSetLister(indexer cache.Indexer) DaemonSetLister { + return &daemonSetLister{indexer: indexer} +} + +// List lists all DaemonSets in the indexer. +func (s *daemonSetLister) List(selector labels.Selector) (ret []*v1beta1.DaemonSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.DaemonSet)) + }) + return ret, err +} + +// DaemonSets returns an object that can list and get DaemonSets. +func (s *daemonSetLister) DaemonSets(namespace string) DaemonSetNamespaceLister { + return daemonSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DaemonSetNamespaceLister helps list and get DaemonSets. +// All objects returned here must be treated as read-only. +type DaemonSetNamespaceLister interface { + // List lists all DaemonSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.DaemonSet, err error) + // Get retrieves the DaemonSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.DaemonSet, error) + DaemonSetNamespaceListerExpansion +} + +// daemonSetNamespaceLister implements the DaemonSetNamespaceLister +// interface. +type daemonSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all DaemonSets in the indexer for a given namespace. +func (s daemonSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.DaemonSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.DaemonSet)) + }) + return ret, err +} + +// Get retrieves the DaemonSet from the indexer for a given namespace and name. +func (s daemonSetNamespaceLister) Get(name string) (*v1beta1.DaemonSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("daemonset"), name) + } + return obj.(*v1beta1.DaemonSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset_expansion.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset_expansion.go new file mode 100644 index 000000000..336a4ed83 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/daemonset_expansion.go @@ -0,0 +1,114 @@ +/* +Copyright 2017 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 v1beta1 + +import ( + "fmt" + + apps "k8s.io/api/apps/v1beta1" + "k8s.io/api/core/v1" + "k8s.io/api/extensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// DaemonSetListerExpansion allows custom methods to be added to +// DaemonSetLister. +type DaemonSetListerExpansion interface { + GetPodDaemonSets(pod *v1.Pod) ([]*v1beta1.DaemonSet, error) + GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*v1beta1.DaemonSet, error) +} + +// DaemonSetNamespaceListerExpansion allows custom methods to be added to +// DaemonSetNamespaceLister. +type DaemonSetNamespaceListerExpansion interface{} + +// GetPodDaemonSets returns a list of DaemonSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetPodDaemonSets(pod *v1.Pod) ([]*v1beta1.DaemonSet, error) { + var selector labels.Selector + var daemonSet *v1beta1.DaemonSet + + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no daemon sets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.DaemonSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*v1beta1.DaemonSet + for i := range list { + daemonSet = list[i] + if daemonSet.Namespace != pod.Namespace { + continue + } + selector, err = metav1.LabelSelectorAsSelector(daemonSet.Spec.Selector) + if err != nil { + // this should not happen if the DaemonSet passed validation + return nil, err + } + + // If a daemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + daemonSets = append(daemonSets, daemonSet) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find daemon set for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return daemonSets, nil +} + +// GetHistoryDaemonSets returns a list of DaemonSets that potentially +// match a ControllerRevision. Only the one specified in the ControllerRevision's ControllerRef +// will actually manage it. +// Returns an error only if no matching DaemonSets are found. +func (s *daemonSetLister) GetHistoryDaemonSets(history *apps.ControllerRevision) ([]*v1beta1.DaemonSet, error) { + if len(history.Labels) == 0 { + return nil, fmt.Errorf("no DaemonSet found for ControllerRevision %s because it has no labels", history.Name) + } + + list, err := s.DaemonSets(history.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var daemonSets []*v1beta1.DaemonSet + for _, ds := range list { + selector, err := metav1.LabelSelectorAsSelector(ds.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid label selector: %v", err) + } + // If a DaemonSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(history.Labels)) { + continue + } + daemonSets = append(daemonSets, ds) + } + + if len(daemonSets) == 0 { + return nil, fmt.Errorf("could not find DaemonSets for ControllerRevision %s in namespace %s with labels: %v", history.Name, history.Namespace, history.Labels) + } + + return daemonSets, nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/deployment.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/deployment.go new file mode 100644 index 000000000..42b5a0723 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/deployment.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// DeploymentLister helps list Deployments. +// All objects returned here must be treated as read-only. +type DeploymentLister interface { + // List lists all Deployments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) + // Deployments returns an object that can list and get Deployments. + Deployments(namespace string) DeploymentNamespaceLister + DeploymentListerExpansion +} + +// deploymentLister implements the DeploymentLister interface. +type deploymentLister struct { + indexer cache.Indexer +} + +// NewDeploymentLister returns a new DeploymentLister. +func NewDeploymentLister(indexer cache.Indexer) DeploymentLister { + return &deploymentLister{indexer: indexer} +} + +// List lists all Deployments in the indexer. +func (s *deploymentLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Deployment)) + }) + return ret, err +} + +// Deployments returns an object that can list and get Deployments. +func (s *deploymentLister) Deployments(namespace string) DeploymentNamespaceLister { + return deploymentNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// DeploymentNamespaceLister helps list and get Deployments. +// All objects returned here must be treated as read-only. +type DeploymentNamespaceLister interface { + // List lists all Deployments in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) + // Get retrieves the Deployment from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Deployment, error) + DeploymentNamespaceListerExpansion +} + +// deploymentNamespaceLister implements the DeploymentNamespaceLister +// interface. +type deploymentNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Deployments in the indexer for a given namespace. +func (s deploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Deployment, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Deployment)) + }) + return ret, err +} + +// Get retrieves the Deployment from the indexer for a given namespace and name. +func (s deploymentNamespaceLister) Get(name string) (*v1beta1.Deployment, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("deployment"), name) + } + return obj.(*v1beta1.Deployment), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/expansion_generated.go new file mode 100644 index 000000000..5599219d9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/expansion_generated.go @@ -0,0 +1,47 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// DeploymentListerExpansion allows custom methods to be added to +// DeploymentLister. +type DeploymentListerExpansion interface{} + +// DeploymentNamespaceListerExpansion allows custom methods to be added to +// DeploymentNamespaceLister. +type DeploymentNamespaceListerExpansion interface{} + +// IngressListerExpansion allows custom methods to be added to +// IngressLister. +type IngressListerExpansion interface{} + +// IngressNamespaceListerExpansion allows custom methods to be added to +// IngressNamespaceLister. +type IngressNamespaceListerExpansion interface{} + +// NetworkPolicyListerExpansion allows custom methods to be added to +// NetworkPolicyLister. +type NetworkPolicyListerExpansion interface{} + +// NetworkPolicyNamespaceListerExpansion allows custom methods to be added to +// NetworkPolicyNamespaceLister. +type NetworkPolicyNamespaceListerExpansion interface{} + +// PodSecurityPolicyListerExpansion allows custom methods to be added to +// PodSecurityPolicyLister. +type PodSecurityPolicyListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/ingress.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/ingress.go new file mode 100644 index 000000000..1cb7677bd --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/ingress.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressLister helps list Ingresses. +// All objects returned here must be treated as read-only. +type IngressLister interface { + // List lists all Ingresses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) + // Ingresses returns an object that can list and get Ingresses. + Ingresses(namespace string) IngressNamespaceLister + IngressListerExpansion +} + +// ingressLister implements the IngressLister interface. +type ingressLister struct { + indexer cache.Indexer +} + +// NewIngressLister returns a new IngressLister. +func NewIngressLister(indexer cache.Indexer) IngressLister { + return &ingressLister{indexer: indexer} +} + +// List lists all Ingresses in the indexer. +func (s *ingressLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get Ingresses. +func (s *ingressLister) Ingresses(namespace string) IngressNamespaceLister { + return ingressNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IngressNamespaceLister helps list and get Ingresses. +// All objects returned here must be treated as read-only. +type IngressNamespaceLister interface { + // List lists all Ingresses in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) + // Get retrieves the Ingress from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Ingress, error) + IngressNamespaceListerExpansion +} + +// ingressNamespaceLister implements the IngressNamespaceLister +// interface. +type ingressNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Ingresses in the indexer for a given namespace. +func (s ingressNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Ingress)) + }) + return ret, err +} + +// Get retrieves the Ingress from the indexer for a given namespace and name. +func (s ingressNamespaceLister) Get(name string) (*v1beta1.Ingress, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("ingress"), name) + } + return obj.(*v1beta1.Ingress), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/networkpolicy.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/networkpolicy.go new file mode 100644 index 000000000..84419a8e9 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/networkpolicy.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NetworkPolicyLister helps list NetworkPolicies. +// All objects returned here must be treated as read-only. +type NetworkPolicyLister interface { + // List lists all NetworkPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) + // NetworkPolicies returns an object that can list and get NetworkPolicies. + NetworkPolicies(namespace string) NetworkPolicyNamespaceLister + NetworkPolicyListerExpansion +} + +// networkPolicyLister implements the NetworkPolicyLister interface. +type networkPolicyLister struct { + indexer cache.Indexer +} + +// NewNetworkPolicyLister returns a new NetworkPolicyLister. +func NewNetworkPolicyLister(indexer cache.Indexer) NetworkPolicyLister { + return &networkPolicyLister{indexer: indexer} +} + +// List lists all NetworkPolicies in the indexer. +func (s *networkPolicyLister) List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.NetworkPolicy)) + }) + return ret, err +} + +// NetworkPolicies returns an object that can list and get NetworkPolicies. +func (s *networkPolicyLister) NetworkPolicies(namespace string) NetworkPolicyNamespaceLister { + return networkPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// NetworkPolicyNamespaceLister helps list and get NetworkPolicies. +// All objects returned here must be treated as read-only. +type NetworkPolicyNamespaceLister interface { + // List lists all NetworkPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) + // Get retrieves the NetworkPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.NetworkPolicy, error) + NetworkPolicyNamespaceListerExpansion +} + +// networkPolicyNamespaceLister implements the NetworkPolicyNamespaceLister +// interface. +type networkPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all NetworkPolicies in the indexer for a given namespace. +func (s networkPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.NetworkPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.NetworkPolicy)) + }) + return ret, err +} + +// Get retrieves the NetworkPolicy from the indexer for a given namespace and name. +func (s networkPolicyNamespaceLister) Get(name string) (*v1beta1.NetworkPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("networkpolicy"), name) + } + return obj.(*v1beta1.NetworkPolicy), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/podsecuritypolicy.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/podsecuritypolicy.go new file mode 100644 index 000000000..5f6a8c036 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/podsecuritypolicy.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodSecurityPolicyLister helps list PodSecurityPolicies. +// All objects returned here must be treated as read-only. +type PodSecurityPolicyLister interface { + // List lists all PodSecurityPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error) + // Get retrieves the PodSecurityPolicy from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PodSecurityPolicy, error) + PodSecurityPolicyListerExpansion +} + +// podSecurityPolicyLister implements the PodSecurityPolicyLister interface. +type podSecurityPolicyLister struct { + indexer cache.Indexer +} + +// NewPodSecurityPolicyLister returns a new PodSecurityPolicyLister. +func NewPodSecurityPolicyLister(indexer cache.Indexer) PodSecurityPolicyLister { + return &podSecurityPolicyLister{indexer: indexer} +} + +// List lists all PodSecurityPolicies in the indexer. +func (s *podSecurityPolicyLister) List(selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PodSecurityPolicy)) + }) + return ret, err +} + +// Get retrieves the PodSecurityPolicy from the index for a given name. +func (s *podSecurityPolicyLister) Get(name string) (*v1beta1.PodSecurityPolicy, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("podsecuritypolicy"), name) + } + return obj.(*v1beta1.PodSecurityPolicy), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset.go new file mode 100644 index 000000000..a5ec3229b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/extensions/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ReplicaSetLister helps list ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetLister interface { + // List lists all ReplicaSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) + // ReplicaSets returns an object that can list and get ReplicaSets. + ReplicaSets(namespace string) ReplicaSetNamespaceLister + ReplicaSetListerExpansion +} + +// replicaSetLister implements the ReplicaSetLister interface. +type replicaSetLister struct { + indexer cache.Indexer +} + +// NewReplicaSetLister returns a new ReplicaSetLister. +func NewReplicaSetLister(indexer cache.Indexer) ReplicaSetLister { + return &replicaSetLister{indexer: indexer} +} + +// List lists all ReplicaSets in the indexer. +func (s *replicaSetLister) List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ReplicaSet)) + }) + return ret, err +} + +// ReplicaSets returns an object that can list and get ReplicaSets. +func (s *replicaSetLister) ReplicaSets(namespace string) ReplicaSetNamespaceLister { + return replicaSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// ReplicaSetNamespaceLister helps list and get ReplicaSets. +// All objects returned here must be treated as read-only. +type ReplicaSetNamespaceLister interface { + // List lists all ReplicaSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) + // Get retrieves the ReplicaSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ReplicaSet, error) + ReplicaSetNamespaceListerExpansion +} + +// replicaSetNamespaceLister implements the ReplicaSetNamespaceLister +// interface. +type replicaSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all ReplicaSets in the indexer for a given namespace. +func (s replicaSetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ReplicaSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ReplicaSet)) + }) + return ret, err +} + +// Get retrieves the ReplicaSet from the indexer for a given namespace and name. +func (s replicaSetNamespaceLister) Get(name string) (*v1beta1.ReplicaSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("replicaset"), name) + } + return obj.(*v1beta1.ReplicaSet), nil +} diff --git a/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go b/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go new file mode 100644 index 000000000..1f72644cc --- /dev/null +++ b/vendor/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go @@ -0,0 +1,73 @@ +/* +Copyright 2017 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 v1beta1 + +import ( + "fmt" + + "k8s.io/api/core/v1" + extensions "k8s.io/api/extensions/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" +) + +// ReplicaSetListerExpansion allows custom methods to be added to +// ReplicaSetLister. +type ReplicaSetListerExpansion interface { + GetPodReplicaSets(pod *v1.Pod) ([]*extensions.ReplicaSet, error) +} + +// ReplicaSetNamespaceListerExpansion allows custom methods to be added to +// ReplicaSetNamespaceLister. +type ReplicaSetNamespaceListerExpansion interface{} + +// GetPodReplicaSets returns a list of ReplicaSets that potentially match a pod. +// Only the one specified in the Pod's ControllerRef will actually manage it. +// Returns an error only if no matching ReplicaSets are found. +func (s *replicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*extensions.ReplicaSet, error) { + if len(pod.Labels) == 0 { + return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name) + } + + list, err := s.ReplicaSets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var rss []*extensions.ReplicaSet + for _, rs := range list { + if rs.Namespace != pod.Namespace { + continue + } + selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector) + if err != nil { + return nil, fmt.Errorf("invalid selector: %v", err) + } + + // If a ReplicaSet with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + rss = append(rss, rs) + } + + if len(rss) == 0 { + return nil, fmt.Errorf("could not find ReplicaSet for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return rss, nil +} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..3e7405168 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// FlowSchemaListerExpansion allows custom methods to be added to +// FlowSchemaLister. +type FlowSchemaListerExpansion interface{} + +// PriorityLevelConfigurationListerExpansion allows custom methods to be added to +// PriorityLevelConfigurationLister. +type PriorityLevelConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/flowschema.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/flowschema.go new file mode 100644 index 000000000..c8a595cd2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/flowschema.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// FlowSchemaLister helps list FlowSchemas. +// All objects returned here must be treated as read-only. +type FlowSchemaLister interface { + // List lists all FlowSchemas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.FlowSchema, err error) + // Get retrieves the FlowSchema from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.FlowSchema, error) + FlowSchemaListerExpansion +} + +// flowSchemaLister implements the FlowSchemaLister interface. +type flowSchemaLister struct { + indexer cache.Indexer +} + +// NewFlowSchemaLister returns a new FlowSchemaLister. +func NewFlowSchemaLister(indexer cache.Indexer) FlowSchemaLister { + return &flowSchemaLister{indexer: indexer} +} + +// List lists all FlowSchemas in the indexer. +func (s *flowSchemaLister) List(selector labels.Selector) (ret []*v1alpha1.FlowSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.FlowSchema)) + }) + return ret, err +} + +// Get retrieves the FlowSchema from the index for a given name. +func (s *flowSchemaLister) Get(name string) (*v1alpha1.FlowSchema, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("flowschema"), name) + } + return obj.(*v1alpha1.FlowSchema), nil +} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go new file mode 100644 index 000000000..daa4ff31d --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1alpha1/prioritylevelconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityLevelConfigurationLister helps list PriorityLevelConfigurations. +// All objects returned here must be treated as read-only. +type PriorityLevelConfigurationLister interface { + // List lists all PriorityLevelConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.PriorityLevelConfiguration, err error) + // Get retrieves the PriorityLevelConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.PriorityLevelConfiguration, error) + PriorityLevelConfigurationListerExpansion +} + +// priorityLevelConfigurationLister implements the PriorityLevelConfigurationLister interface. +type priorityLevelConfigurationLister struct { + indexer cache.Indexer +} + +// NewPriorityLevelConfigurationLister returns a new PriorityLevelConfigurationLister. +func NewPriorityLevelConfigurationLister(indexer cache.Indexer) PriorityLevelConfigurationLister { + return &priorityLevelConfigurationLister{indexer: indexer} +} + +// List lists all PriorityLevelConfigurations in the indexer. +func (s *priorityLevelConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.PriorityLevelConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.PriorityLevelConfiguration)) + }) + return ret, err +} + +// Get retrieves the PriorityLevelConfiguration from the index for a given name. +func (s *priorityLevelConfigurationLister) Get(name string) (*v1alpha1.PriorityLevelConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("prioritylevelconfiguration"), name) + } + return obj.(*v1alpha1.PriorityLevelConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/expansion_generated.go new file mode 100644 index 000000000..c674e951e --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// FlowSchemaListerExpansion allows custom methods to be added to +// FlowSchemaLister. +type FlowSchemaListerExpansion interface{} + +// PriorityLevelConfigurationListerExpansion allows custom methods to be added to +// PriorityLevelConfigurationLister. +type PriorityLevelConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/flowschema.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/flowschema.go new file mode 100644 index 000000000..7927a8411 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/flowschema.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/flowcontrol/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// FlowSchemaLister helps list FlowSchemas. +// All objects returned here must be treated as read-only. +type FlowSchemaLister interface { + // List lists all FlowSchemas in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.FlowSchema, err error) + // Get retrieves the FlowSchema from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.FlowSchema, error) + FlowSchemaListerExpansion +} + +// flowSchemaLister implements the FlowSchemaLister interface. +type flowSchemaLister struct { + indexer cache.Indexer +} + +// NewFlowSchemaLister returns a new FlowSchemaLister. +func NewFlowSchemaLister(indexer cache.Indexer) FlowSchemaLister { + return &flowSchemaLister{indexer: indexer} +} + +// List lists all FlowSchemas in the indexer. +func (s *flowSchemaLister) List(selector labels.Selector) (ret []*v1beta1.FlowSchema, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.FlowSchema)) + }) + return ret, err +} + +// Get retrieves the FlowSchema from the index for a given name. +func (s *flowSchemaLister) Get(name string) (*v1beta1.FlowSchema, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("flowschema"), name) + } + return obj.(*v1beta1.FlowSchema), nil +} diff --git a/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go new file mode 100644 index 000000000..c94aaa4c1 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/flowcontrol/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityLevelConfigurationLister helps list PriorityLevelConfigurations. +// All objects returned here must be treated as read-only. +type PriorityLevelConfigurationLister interface { + // List lists all PriorityLevelConfigurations in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PriorityLevelConfiguration, err error) + // Get retrieves the PriorityLevelConfiguration from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PriorityLevelConfiguration, error) + PriorityLevelConfigurationListerExpansion +} + +// priorityLevelConfigurationLister implements the PriorityLevelConfigurationLister interface. +type priorityLevelConfigurationLister struct { + indexer cache.Indexer +} + +// NewPriorityLevelConfigurationLister returns a new PriorityLevelConfigurationLister. +func NewPriorityLevelConfigurationLister(indexer cache.Indexer) PriorityLevelConfigurationLister { + return &priorityLevelConfigurationLister{indexer: indexer} +} + +// List lists all PriorityLevelConfigurations in the indexer. +func (s *priorityLevelConfigurationLister) List(selector labels.Selector) (ret []*v1beta1.PriorityLevelConfiguration, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PriorityLevelConfiguration)) + }) + return ret, err +} + +// Get retrieves the PriorityLevelConfiguration from the index for a given name. +func (s *priorityLevelConfigurationLister) Get(name string) (*v1beta1.PriorityLevelConfiguration, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("prioritylevelconfiguration"), name) + } + return obj.(*v1beta1.PriorityLevelConfiguration), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/networking/v1/expansion_generated.go new file mode 100644 index 000000000..a380c2418 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1/expansion_generated.go @@ -0,0 +1,39 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// IngressListerExpansion allows custom methods to be added to +// IngressLister. +type IngressListerExpansion interface{} + +// IngressNamespaceListerExpansion allows custom methods to be added to +// IngressNamespaceLister. +type IngressNamespaceListerExpansion interface{} + +// IngressClassListerExpansion allows custom methods to be added to +// IngressClassLister. +type IngressClassListerExpansion interface{} + +// NetworkPolicyListerExpansion allows custom methods to be added to +// NetworkPolicyLister. +type NetworkPolicyListerExpansion interface{} + +// NetworkPolicyNamespaceListerExpansion allows custom methods to be added to +// NetworkPolicyNamespaceLister. +type NetworkPolicyNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/networking/v1/ingress.go b/vendor/k8s.io/client-go/listers/networking/v1/ingress.go new file mode 100644 index 000000000..0f49d4f57 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1/ingress.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressLister helps list Ingresses. +// All objects returned here must be treated as read-only. +type IngressLister interface { + // List lists all Ingresses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Ingress, err error) + // Ingresses returns an object that can list and get Ingresses. + Ingresses(namespace string) IngressNamespaceLister + IngressListerExpansion +} + +// ingressLister implements the IngressLister interface. +type ingressLister struct { + indexer cache.Indexer +} + +// NewIngressLister returns a new IngressLister. +func NewIngressLister(indexer cache.Indexer) IngressLister { + return &ingressLister{indexer: indexer} +} + +// List lists all Ingresses in the indexer. +func (s *ingressLister) List(selector labels.Selector) (ret []*v1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get Ingresses. +func (s *ingressLister) Ingresses(namespace string) IngressNamespaceLister { + return ingressNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IngressNamespaceLister helps list and get Ingresses. +// All objects returned here must be treated as read-only. +type IngressNamespaceLister interface { + // List lists all Ingresses in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Ingress, err error) + // Get retrieves the Ingress from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Ingress, error) + IngressNamespaceListerExpansion +} + +// ingressNamespaceLister implements the IngressNamespaceLister +// interface. +type ingressNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Ingresses in the indexer for a given namespace. +func (s ingressNamespaceLister) List(selector labels.Selector) (ret []*v1.Ingress, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Ingress)) + }) + return ret, err +} + +// Get retrieves the Ingress from the indexer for a given namespace and name. +func (s ingressNamespaceLister) Get(name string) (*v1.Ingress, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("ingress"), name) + } + return obj.(*v1.Ingress), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1/ingressclass.go b/vendor/k8s.io/client-go/listers/networking/v1/ingressclass.go new file mode 100644 index 000000000..1480cb13f --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1/ingressclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressClassLister helps list IngressClasses. +// All objects returned here must be treated as read-only. +type IngressClassLister interface { + // List lists all IngressClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.IngressClass, err error) + // Get retrieves the IngressClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.IngressClass, error) + IngressClassListerExpansion +} + +// ingressClassLister implements the IngressClassLister interface. +type ingressClassLister struct { + indexer cache.Indexer +} + +// NewIngressClassLister returns a new IngressClassLister. +func NewIngressClassLister(indexer cache.Indexer) IngressClassLister { + return &ingressClassLister{indexer: indexer} +} + +// List lists all IngressClasses in the indexer. +func (s *ingressClassLister) List(selector labels.Selector) (ret []*v1.IngressClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.IngressClass)) + }) + return ret, err +} + +// Get retrieves the IngressClass from the index for a given name. +func (s *ingressClassLister) Get(name string) (*v1.IngressClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("ingressclass"), name) + } + return obj.(*v1.IngressClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1/networkpolicy.go b/vendor/k8s.io/client-go/listers/networking/v1/networkpolicy.go new file mode 100644 index 000000000..34cabf057 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1/networkpolicy.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/networking/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// NetworkPolicyLister helps list NetworkPolicies. +// All objects returned here must be treated as read-only. +type NetworkPolicyLister interface { + // List lists all NetworkPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) + // NetworkPolicies returns an object that can list and get NetworkPolicies. + NetworkPolicies(namespace string) NetworkPolicyNamespaceLister + NetworkPolicyListerExpansion +} + +// networkPolicyLister implements the NetworkPolicyLister interface. +type networkPolicyLister struct { + indexer cache.Indexer +} + +// NewNetworkPolicyLister returns a new NetworkPolicyLister. +func NewNetworkPolicyLister(indexer cache.Indexer) NetworkPolicyLister { + return &networkPolicyLister{indexer: indexer} +} + +// List lists all NetworkPolicies in the indexer. +func (s *networkPolicyLister) List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.NetworkPolicy)) + }) + return ret, err +} + +// NetworkPolicies returns an object that can list and get NetworkPolicies. +func (s *networkPolicyLister) NetworkPolicies(namespace string) NetworkPolicyNamespaceLister { + return networkPolicyNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// NetworkPolicyNamespaceLister helps list and get NetworkPolicies. +// All objects returned here must be treated as read-only. +type NetworkPolicyNamespaceLister interface { + // List lists all NetworkPolicies in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) + // Get retrieves the NetworkPolicy from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.NetworkPolicy, error) + NetworkPolicyNamespaceListerExpansion +} + +// networkPolicyNamespaceLister implements the NetworkPolicyNamespaceLister +// interface. +type networkPolicyNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all NetworkPolicies in the indexer for a given namespace. +func (s networkPolicyNamespaceLister) List(selector labels.Selector) (ret []*v1.NetworkPolicy, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.NetworkPolicy)) + }) + return ret, err +} + +// Get retrieves the NetworkPolicy from the indexer for a given namespace and name. +func (s networkPolicyNamespaceLister) Get(name string) (*v1.NetworkPolicy, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("networkpolicy"), name) + } + return obj.(*v1.NetworkPolicy), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/networking/v1beta1/expansion_generated.go new file mode 100644 index 000000000..d8c99c186 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1beta1/expansion_generated.go @@ -0,0 +1,31 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// IngressListerExpansion allows custom methods to be added to +// IngressLister. +type IngressListerExpansion interface{} + +// IngressNamespaceListerExpansion allows custom methods to be added to +// IngressNamespaceLister. +type IngressNamespaceListerExpansion interface{} + +// IngressClassListerExpansion allows custom methods to be added to +// IngressClassLister. +type IngressClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/networking/v1beta1/ingress.go b/vendor/k8s.io/client-go/listers/networking/v1beta1/ingress.go new file mode 100644 index 000000000..b8f4d3558 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1beta1/ingress.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/networking/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressLister helps list Ingresses. +// All objects returned here must be treated as read-only. +type IngressLister interface { + // List lists all Ingresses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) + // Ingresses returns an object that can list and get Ingresses. + Ingresses(namespace string) IngressNamespaceLister + IngressListerExpansion +} + +// ingressLister implements the IngressLister interface. +type ingressLister struct { + indexer cache.Indexer +} + +// NewIngressLister returns a new IngressLister. +func NewIngressLister(indexer cache.Indexer) IngressLister { + return &ingressLister{indexer: indexer} +} + +// List lists all Ingresses in the indexer. +func (s *ingressLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Ingress)) + }) + return ret, err +} + +// Ingresses returns an object that can list and get Ingresses. +func (s *ingressLister) Ingresses(namespace string) IngressNamespaceLister { + return ingressNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// IngressNamespaceLister helps list and get Ingresses. +// All objects returned here must be treated as read-only. +type IngressNamespaceLister interface { + // List lists all Ingresses in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) + // Get retrieves the Ingress from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Ingress, error) + IngressNamespaceListerExpansion +} + +// ingressNamespaceLister implements the IngressNamespaceLister +// interface. +type ingressNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Ingresses in the indexer for a given namespace. +func (s ingressNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Ingress)) + }) + return ret, err +} + +// Get retrieves the Ingress from the indexer for a given namespace and name. +func (s ingressNamespaceLister) Get(name string) (*v1beta1.Ingress, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("ingress"), name) + } + return obj.(*v1beta1.Ingress), nil +} diff --git a/vendor/k8s.io/client-go/listers/networking/v1beta1/ingressclass.go b/vendor/k8s.io/client-go/listers/networking/v1beta1/ingressclass.go new file mode 100644 index 000000000..ebcd6ba85 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/networking/v1beta1/ingressclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/networking/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// IngressClassLister helps list IngressClasses. +// All objects returned here must be treated as read-only. +type IngressClassLister interface { + // List lists all IngressClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.IngressClass, err error) + // Get retrieves the IngressClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.IngressClass, error) + IngressClassListerExpansion +} + +// ingressClassLister implements the IngressClassLister interface. +type ingressClassLister struct { + indexer cache.Indexer +} + +// NewIngressClassLister returns a new IngressClassLister. +func NewIngressClassLister(indexer cache.Indexer) IngressClassLister { + return &ingressClassLister{indexer: indexer} +} + +// List lists all IngressClasses in the indexer. +func (s *ingressClassLister) List(selector labels.Selector) (ret []*v1beta1.IngressClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.IngressClass)) + }) + return ret, err +} + +// Get retrieves the IngressClass from the index for a given name. +func (s *ingressClassLister) Get(name string) (*v1beta1.IngressClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("ingressclass"), name) + } + return obj.(*v1beta1.IngressClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/node/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/node/v1/expansion_generated.go new file mode 100644 index 000000000..4f010b87c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// RuntimeClassListerExpansion allows custom methods to be added to +// RuntimeClassLister. +type RuntimeClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/node/v1/runtimeclass.go b/vendor/k8s.io/client-go/listers/node/v1/runtimeclass.go new file mode 100644 index 000000000..6e00cf1a5 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1/runtimeclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/node/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RuntimeClassLister helps list RuntimeClasses. +// All objects returned here must be treated as read-only. +type RuntimeClassLister interface { + // List lists all RuntimeClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.RuntimeClass, err error) + // Get retrieves the RuntimeClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.RuntimeClass, error) + RuntimeClassListerExpansion +} + +// runtimeClassLister implements the RuntimeClassLister interface. +type runtimeClassLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassLister returns a new RuntimeClassLister. +func NewRuntimeClassLister(indexer cache.Indexer) RuntimeClassLister { + return &runtimeClassLister{indexer: indexer} +} + +// List lists all RuntimeClasses in the indexer. +func (s *runtimeClassLister) List(selector labels.Selector) (ret []*v1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the RuntimeClass from the index for a given name. +func (s *runtimeClassLister) Get(name string) (*v1.RuntimeClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("runtimeclass"), name) + } + return obj.(*v1.RuntimeClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/node/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/node/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..a65c208fa --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1alpha1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// RuntimeClassListerExpansion allows custom methods to be added to +// RuntimeClassLister. +type RuntimeClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/node/v1alpha1/runtimeclass.go b/vendor/k8s.io/client-go/listers/node/v1alpha1/runtimeclass.go new file mode 100644 index 000000000..31f335799 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1alpha1/runtimeclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/node/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RuntimeClassLister helps list RuntimeClasses. +// All objects returned here must be treated as read-only. +type RuntimeClassLister interface { + // List lists all RuntimeClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RuntimeClass, err error) + // Get retrieves the RuntimeClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.RuntimeClass, error) + RuntimeClassListerExpansion +} + +// runtimeClassLister implements the RuntimeClassLister interface. +type runtimeClassLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassLister returns a new RuntimeClassLister. +func NewRuntimeClassLister(indexer cache.Indexer) RuntimeClassLister { + return &runtimeClassLister{indexer: indexer} +} + +// List lists all RuntimeClasses in the indexer. +func (s *runtimeClassLister) List(selector labels.Selector) (ret []*v1alpha1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the RuntimeClass from the index for a given name. +func (s *runtimeClassLister) Get(name string) (*v1alpha1.RuntimeClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("runtimeclass"), name) + } + return obj.(*v1alpha1.RuntimeClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/node/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/node/v1beta1/expansion_generated.go new file mode 100644 index 000000000..a6744055c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1beta1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// RuntimeClassListerExpansion allows custom methods to be added to +// RuntimeClassLister. +type RuntimeClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/node/v1beta1/runtimeclass.go b/vendor/k8s.io/client-go/listers/node/v1beta1/runtimeclass.go new file mode 100644 index 000000000..7dbd6ab26 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/node/v1beta1/runtimeclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/node/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RuntimeClassLister helps list RuntimeClasses. +// All objects returned here must be treated as read-only. +type RuntimeClassLister interface { + // List lists all RuntimeClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.RuntimeClass, err error) + // Get retrieves the RuntimeClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.RuntimeClass, error) + RuntimeClassListerExpansion +} + +// runtimeClassLister implements the RuntimeClassLister interface. +type runtimeClassLister struct { + indexer cache.Indexer +} + +// NewRuntimeClassLister returns a new RuntimeClassLister. +func NewRuntimeClassLister(indexer cache.Indexer) RuntimeClassLister { + return &runtimeClassLister{indexer: indexer} +} + +// List lists all RuntimeClasses in the indexer. +func (s *runtimeClassLister) List(selector labels.Selector) (ret []*v1beta1.RuntimeClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.RuntimeClass)) + }) + return ret, err +} + +// Get retrieves the RuntimeClass from the index for a given name. +func (s *runtimeClassLister) Get(name string) (*v1beta1.RuntimeClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("runtimeclass"), name) + } + return obj.(*v1beta1.RuntimeClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go new file mode 100644 index 000000000..c43caf240 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1/expansion_generated.go @@ -0,0 +1,19 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 diff --git a/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go b/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go new file mode 100644 index 000000000..8470d38bb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/policy/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodDisruptionBudgetLister helps list PodDisruptionBudgets. +// All objects returned here must be treated as read-only. +type PodDisruptionBudgetLister interface { + // List lists all PodDisruptionBudgets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodDisruptionBudget, err error) + // PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. + PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister + PodDisruptionBudgetListerExpansion +} + +// podDisruptionBudgetLister implements the PodDisruptionBudgetLister interface. +type podDisruptionBudgetLister struct { + indexer cache.Indexer +} + +// NewPodDisruptionBudgetLister returns a new PodDisruptionBudgetLister. +func NewPodDisruptionBudgetLister(indexer cache.Indexer) PodDisruptionBudgetLister { + return &podDisruptionBudgetLister{indexer: indexer} +} + +// List lists all PodDisruptionBudgets in the indexer. +func (s *podDisruptionBudgetLister) List(selector labels.Selector) (ret []*v1.PodDisruptionBudget, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodDisruptionBudget)) + }) + return ret, err +} + +// PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. +func (s *podDisruptionBudgetLister) PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister { + return podDisruptionBudgetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodDisruptionBudgetNamespaceLister helps list and get PodDisruptionBudgets. +// All objects returned here must be treated as read-only. +type PodDisruptionBudgetNamespaceLister interface { + // List lists all PodDisruptionBudgets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PodDisruptionBudget, err error) + // Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PodDisruptionBudget, error) + PodDisruptionBudgetNamespaceListerExpansion +} + +// podDisruptionBudgetNamespaceLister implements the PodDisruptionBudgetNamespaceLister +// interface. +type podDisruptionBudgetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PodDisruptionBudgets in the indexer for a given namespace. +func (s podDisruptionBudgetNamespaceLister) List(selector labels.Selector) (ret []*v1.PodDisruptionBudget, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PodDisruptionBudget)) + }) + return ret, err +} + +// Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. +func (s podDisruptionBudgetNamespaceLister) Get(name string) (*v1.PodDisruptionBudget, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("poddisruptionbudget"), name) + } + return obj.(*v1.PodDisruptionBudget), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go b/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go new file mode 100644 index 000000000..f63851ad4 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1/poddisruptionbudget_expansion.go @@ -0,0 +1,69 @@ +/* +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 v1 + +import ( + "fmt" + + "k8s.io/api/core/v1" + policy "k8s.io/api/policy/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/klog/v2" +) + +// PodDisruptionBudgetListerExpansion allows custom methods to be added to +// PodDisruptionBudgetLister. +type PodDisruptionBudgetListerExpansion interface { + GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) +} + +// PodDisruptionBudgetNamespaceListerExpansion allows custom methods to be added to +// PodDisruptionBudgetNamespaceLister. +type PodDisruptionBudgetNamespaceListerExpansion interface{} + +// GetPodPodDisruptionBudgets returns a list of PodDisruptionBudgets matching a pod. +func (s *podDisruptionBudgetLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + var selector labels.Selector + + list, err := s.PodDisruptionBudgets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var pdbList []*policy.PodDisruptionBudget + for i := range list { + pdb := list[i] + selector, err = metav1.LabelSelectorAsSelector(pdb.Spec.Selector) + if err != nil { + klog.Warningf("invalid selector: %v", err) + continue + } + + // Unlike the v1beta version, here we let an empty selector match everything. + if !selector.Matches(labels.Set(pod.Labels)) { + continue + } + pdbList = append(pdbList, pdb) + } + + if len(pdbList) == 0 { + return nil, fmt.Errorf("could not find PodDisruptionBudget for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return pdbList, nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go new file mode 100644 index 000000000..e1d40d0b3 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/eviction.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/policy/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EvictionLister helps list Evictions. +// All objects returned here must be treated as read-only. +type EvictionLister interface { + // List lists all Evictions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) + // Evictions returns an object that can list and get Evictions. + Evictions(namespace string) EvictionNamespaceLister + EvictionListerExpansion +} + +// evictionLister implements the EvictionLister interface. +type evictionLister struct { + indexer cache.Indexer +} + +// NewEvictionLister returns a new EvictionLister. +func NewEvictionLister(indexer cache.Indexer) EvictionLister { + return &evictionLister{indexer: indexer} +} + +// List lists all Evictions in the indexer. +func (s *evictionLister) List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Eviction)) + }) + return ret, err +} + +// Evictions returns an object that can list and get Evictions. +func (s *evictionLister) Evictions(namespace string) EvictionNamespaceLister { + return evictionNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EvictionNamespaceLister helps list and get Evictions. +// All objects returned here must be treated as read-only. +type EvictionNamespaceLister interface { + // List lists all Evictions in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) + // Get retrieves the Eviction from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Eviction, error) + EvictionNamespaceListerExpansion +} + +// evictionNamespaceLister implements the EvictionNamespaceLister +// interface. +type evictionNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Evictions in the indexer for a given namespace. +func (s evictionNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Eviction)) + }) + return ret, err +} + +// Get retrieves the Eviction from the indexer for a given namespace and name. +func (s evictionNamespaceLister) Get(name string) (*v1beta1.Eviction, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("eviction"), name) + } + return obj.(*v1beta1.Eviction), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go new file mode 100644 index 000000000..9a005f20b --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/expansion_generated.go @@ -0,0 +1,31 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// EvictionListerExpansion allows custom methods to be added to +// EvictionLister. +type EvictionListerExpansion interface{} + +// EvictionNamespaceListerExpansion allows custom methods to be added to +// EvictionNamespaceLister. +type EvictionNamespaceListerExpansion interface{} + +// PodSecurityPolicyListerExpansion allows custom methods to be added to +// PodSecurityPolicyLister. +type PodSecurityPolicyListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go new file mode 100644 index 000000000..aa08f813e --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/policy/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodDisruptionBudgetLister helps list PodDisruptionBudgets. +// All objects returned here must be treated as read-only. +type PodDisruptionBudgetLister interface { + // List lists all PodDisruptionBudgets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PodDisruptionBudget, err error) + // PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. + PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister + PodDisruptionBudgetListerExpansion +} + +// podDisruptionBudgetLister implements the PodDisruptionBudgetLister interface. +type podDisruptionBudgetLister struct { + indexer cache.Indexer +} + +// NewPodDisruptionBudgetLister returns a new PodDisruptionBudgetLister. +func NewPodDisruptionBudgetLister(indexer cache.Indexer) PodDisruptionBudgetLister { + return &podDisruptionBudgetLister{indexer: indexer} +} + +// List lists all PodDisruptionBudgets in the indexer. +func (s *podDisruptionBudgetLister) List(selector labels.Selector) (ret []*v1beta1.PodDisruptionBudget, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PodDisruptionBudget)) + }) + return ret, err +} + +// PodDisruptionBudgets returns an object that can list and get PodDisruptionBudgets. +func (s *podDisruptionBudgetLister) PodDisruptionBudgets(namespace string) PodDisruptionBudgetNamespaceLister { + return podDisruptionBudgetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PodDisruptionBudgetNamespaceLister helps list and get PodDisruptionBudgets. +// All objects returned here must be treated as read-only. +type PodDisruptionBudgetNamespaceLister interface { + // List lists all PodDisruptionBudgets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PodDisruptionBudget, err error) + // Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PodDisruptionBudget, error) + PodDisruptionBudgetNamespaceListerExpansion +} + +// podDisruptionBudgetNamespaceLister implements the PodDisruptionBudgetNamespaceLister +// interface. +type podDisruptionBudgetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PodDisruptionBudgets in the indexer for a given namespace. +func (s podDisruptionBudgetNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.PodDisruptionBudget, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PodDisruptionBudget)) + }) + return ret, err +} + +// Get retrieves the PodDisruptionBudget from the indexer for a given namespace and name. +func (s podDisruptionBudgetNamespaceLister) Get(name string) (*v1beta1.PodDisruptionBudget, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("poddisruptionbudget"), name) + } + return obj.(*v1beta1.PodDisruptionBudget), nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go new file mode 100644 index 000000000..dce5dca82 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/poddisruptionbudget_expansion.go @@ -0,0 +1,70 @@ +/* +Copyright 2017 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 v1beta1 + +import ( + "fmt" + + "k8s.io/api/core/v1" + policy "k8s.io/api/policy/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/klog/v2" +) + +// PodDisruptionBudgetListerExpansion allows custom methods to be added to +// PodDisruptionBudgetLister. +type PodDisruptionBudgetListerExpansion interface { + GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) +} + +// PodDisruptionBudgetNamespaceListerExpansion allows custom methods to be added to +// PodDisruptionBudgetNamespaceLister. +type PodDisruptionBudgetNamespaceListerExpansion interface{} + +// GetPodPodDisruptionBudgets returns a list of PodDisruptionBudgets matching a pod. Returns an error only if no matching PodDisruptionBudgets are found. +func (s *podDisruptionBudgetLister) GetPodPodDisruptionBudgets(pod *v1.Pod) ([]*policy.PodDisruptionBudget, error) { + var selector labels.Selector + + list, err := s.PodDisruptionBudgets(pod.Namespace).List(labels.Everything()) + if err != nil { + return nil, err + } + + var pdbList []*policy.PodDisruptionBudget + for i := range list { + pdb := list[i] + selector, err = metav1.LabelSelectorAsSelector(pdb.Spec.Selector) + if err != nil { + klog.Warningf("invalid selector: %v", err) + // TODO(mml): add an event to the PDB + continue + } + + // If a PDB with a nil or empty selector creeps in, it should match nothing, not everything. + if selector.Empty() || !selector.Matches(labels.Set(pod.Labels)) { + continue + } + pdbList = append(pdbList, pdb) + } + + if len(pdbList) == 0 { + return nil, fmt.Errorf("could not find PodDisruptionBudget for pod %s in namespace %s with labels: %v", pod.Name, pod.Namespace, pod.Labels) + } + + return pdbList, nil +} diff --git a/vendor/k8s.io/client-go/listers/policy/v1beta1/podsecuritypolicy.go b/vendor/k8s.io/client-go/listers/policy/v1beta1/podsecuritypolicy.go new file mode 100644 index 000000000..7e73161b2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/policy/v1beta1/podsecuritypolicy.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/policy/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PodSecurityPolicyLister helps list PodSecurityPolicies. +// All objects returned here must be treated as read-only. +type PodSecurityPolicyLister interface { + // List lists all PodSecurityPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error) + // Get retrieves the PodSecurityPolicy from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PodSecurityPolicy, error) + PodSecurityPolicyListerExpansion +} + +// podSecurityPolicyLister implements the PodSecurityPolicyLister interface. +type podSecurityPolicyLister struct { + indexer cache.Indexer +} + +// NewPodSecurityPolicyLister returns a new PodSecurityPolicyLister. +func NewPodSecurityPolicyLister(indexer cache.Indexer) PodSecurityPolicyLister { + return &podSecurityPolicyLister{indexer: indexer} +} + +// List lists all PodSecurityPolicies in the indexer. +func (s *podSecurityPolicyLister) List(selector labels.Selector) (ret []*v1beta1.PodSecurityPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PodSecurityPolicy)) + }) + return ret, err +} + +// Get retrieves the PodSecurityPolicy from the index for a given name. +func (s *podSecurityPolicyLister) Get(name string) (*v1beta1.PodSecurityPolicy, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("podsecuritypolicy"), name) + } + return obj.(*v1beta1.PodSecurityPolicy), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/clusterrole.go b/vendor/k8s.io/client-go/listers/rbac/v1/clusterrole.go new file mode 100644 index 000000000..84dc003ca --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/clusterrole.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleLister helps list ClusterRoles. +// All objects returned here must be treated as read-only. +type ClusterRoleLister interface { + // List lists all ClusterRoles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ClusterRole, err error) + // Get retrieves the ClusterRole from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ClusterRole, error) + ClusterRoleListerExpansion +} + +// clusterRoleLister implements the ClusterRoleLister interface. +type clusterRoleLister struct { + indexer cache.Indexer +} + +// NewClusterRoleLister returns a new ClusterRoleLister. +func NewClusterRoleLister(indexer cache.Indexer) ClusterRoleLister { + return &clusterRoleLister{indexer: indexer} +} + +// List lists all ClusterRoles in the indexer. +func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the ClusterRole from the index for a given name. +func (s *clusterRoleLister) Get(name string) (*v1.ClusterRole, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterrole"), name) + } + return obj.(*v1.ClusterRole), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/clusterrolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1/clusterrolebinding.go new file mode 100644 index 000000000..ff061d4b2 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/clusterrolebinding.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingLister helps list ClusterRoleBindings. +// All objects returned here must be treated as read-only. +type ClusterRoleBindingLister interface { + // List lists all ClusterRoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) + // Get retrieves the ClusterRoleBinding from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.ClusterRoleBinding, error) + ClusterRoleBindingListerExpansion +} + +// clusterRoleBindingLister implements the ClusterRoleBindingLister interface. +type clusterRoleBindingLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingLister returns a new ClusterRoleBindingLister. +func NewClusterRoleBindingLister(indexer cache.Indexer) ClusterRoleBindingLister { + return &clusterRoleBindingLister{indexer: indexer} +} + +// List lists all ClusterRoleBindings in the indexer. +func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterRoleBinding from the index for a given name. +func (s *clusterRoleBindingLister) Get(name string) (*v1.ClusterRoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("clusterrolebinding"), name) + } + return obj.(*v1.ClusterRoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/rbac/v1/expansion_generated.go new file mode 100644 index 000000000..0eb2a6d11 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// ClusterRoleListerExpansion allows custom methods to be added to +// ClusterRoleLister. +type ClusterRoleListerExpansion interface{} + +// ClusterRoleBindingListerExpansion allows custom methods to be added to +// ClusterRoleBindingLister. +type ClusterRoleBindingListerExpansion interface{} + +// RoleListerExpansion allows custom methods to be added to +// RoleLister. +type RoleListerExpansion interface{} + +// RoleNamespaceListerExpansion allows custom methods to be added to +// RoleNamespaceLister. +type RoleNamespaceListerExpansion interface{} + +// RoleBindingListerExpansion allows custom methods to be added to +// RoleBindingLister. +type RoleBindingListerExpansion interface{} + +// RoleBindingNamespaceListerExpansion allows custom methods to be added to +// RoleBindingNamespaceLister. +type RoleBindingNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/role.go b/vendor/k8s.io/client-go/listers/rbac/v1/role.go new file mode 100644 index 000000000..503f013b5 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/role.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleLister helps list Roles. +// All objects returned here must be treated as read-only. +type RoleLister interface { + // List lists all Roles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Role, err error) + // Roles returns an object that can list and get Roles. + Roles(namespace string) RoleNamespaceLister + RoleListerExpansion +} + +// roleLister implements the RoleLister interface. +type roleLister struct { + indexer cache.Indexer +} + +// NewRoleLister returns a new RoleLister. +func NewRoleLister(indexer cache.Indexer) RoleLister { + return &roleLister{indexer: indexer} +} + +// List lists all Roles in the indexer. +func (s *roleLister) List(selector labels.Selector) (ret []*v1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get Roles. +func (s *roleLister) Roles(namespace string) RoleNamespaceLister { + return roleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleNamespaceLister helps list and get Roles. +// All objects returned here must be treated as read-only. +type RoleNamespaceLister interface { + // List lists all Roles in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.Role, err error) + // Get retrieves the Role from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.Role, error) + RoleNamespaceListerExpansion +} + +// roleNamespaceLister implements the RoleNamespaceLister +// interface. +type roleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Roles in the indexer for a given namespace. +func (s roleNamespaceLister) List(selector labels.Selector) (ret []*v1.Role, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.Role)) + }) + return ret, err +} + +// Get retrieves the Role from the indexer for a given namespace and name. +func (s roleNamespaceLister) Get(name string) (*v1.Role, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("role"), name) + } + return obj.(*v1.Role), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1/rolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1/rolebinding.go new file mode 100644 index 000000000..ea50c6413 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1/rolebinding.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingLister helps list RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingLister interface { + // List lists all RoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.RoleBinding, err error) + // RoleBindings returns an object that can list and get RoleBindings. + RoleBindings(namespace string) RoleBindingNamespaceLister + RoleBindingListerExpansion +} + +// roleBindingLister implements the RoleBindingLister interface. +type roleBindingLister struct { + indexer cache.Indexer +} + +// NewRoleBindingLister returns a new RoleBindingLister. +func NewRoleBindingLister(indexer cache.Indexer) RoleBindingLister { + return &roleBindingLister{indexer: indexer} +} + +// List lists all RoleBindings in the indexer. +func (s *roleBindingLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get RoleBindings. +func (s *roleBindingLister) RoleBindings(namespace string) RoleBindingNamespaceLister { + return roleBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingNamespaceLister helps list and get RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingNamespaceLister interface { + // List lists all RoleBindings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.RoleBinding, err error) + // Get retrieves the RoleBinding from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.RoleBinding, error) + RoleBindingNamespaceListerExpansion +} + +// roleBindingNamespaceLister implements the RoleBindingNamespaceLister +// interface. +type roleBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindings in the indexer for a given namespace. +func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.RoleBinding)) + }) + return ret, err +} + +// Get retrieves the RoleBinding from the indexer for a given namespace and name. +func (s roleBindingNamespaceLister) Get(name string) (*v1.RoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("rolebinding"), name) + } + return obj.(*v1.RoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrole.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrole.go new file mode 100644 index 000000000..181ea95a7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrole.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleLister helps list ClusterRoles. +// All objects returned here must be treated as read-only. +type ClusterRoleLister interface { + // List lists all ClusterRoles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterRole, err error) + // Get retrieves the ClusterRole from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ClusterRole, error) + ClusterRoleListerExpansion +} + +// clusterRoleLister implements the ClusterRoleLister interface. +type clusterRoleLister struct { + indexer cache.Indexer +} + +// NewClusterRoleLister returns a new ClusterRoleLister. +func NewClusterRoleLister(indexer cache.Indexer) ClusterRoleLister { + return &clusterRoleLister{indexer: indexer} +} + +// List lists all ClusterRoles in the indexer. +func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the ClusterRole from the index for a given name. +func (s *clusterRoleLister) Get(name string) (*v1alpha1.ClusterRole, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clusterrole"), name) + } + return obj.(*v1alpha1.ClusterRole), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrolebinding.go new file mode 100644 index 000000000..29d283b6c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/clusterrolebinding.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingLister helps list ClusterRoleBindings. +// All objects returned here must be treated as read-only. +type ClusterRoleBindingLister interface { + // List lists all ClusterRoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterRoleBinding, err error) + // Get retrieves the ClusterRoleBinding from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ClusterRoleBinding, error) + ClusterRoleBindingListerExpansion +} + +// clusterRoleBindingLister implements the ClusterRoleBindingLister interface. +type clusterRoleBindingLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingLister returns a new ClusterRoleBindingLister. +func NewClusterRoleBindingLister(indexer cache.Indexer) ClusterRoleBindingLister { + return &clusterRoleBindingLister{indexer: indexer} +} + +// List lists all ClusterRoleBindings in the indexer. +func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterRoleBinding from the index for a given name. +func (s *clusterRoleBindingLister) Get(name string) (*v1alpha1.ClusterRoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clusterrolebinding"), name) + } + return obj.(*v1alpha1.ClusterRoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..2d4ad1756 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// ClusterRoleListerExpansion allows custom methods to be added to +// ClusterRoleLister. +type ClusterRoleListerExpansion interface{} + +// ClusterRoleBindingListerExpansion allows custom methods to be added to +// ClusterRoleBindingLister. +type ClusterRoleBindingListerExpansion interface{} + +// RoleListerExpansion allows custom methods to be added to +// RoleLister. +type RoleListerExpansion interface{} + +// RoleNamespaceListerExpansion allows custom methods to be added to +// RoleNamespaceLister. +type RoleNamespaceListerExpansion interface{} + +// RoleBindingListerExpansion allows custom methods to be added to +// RoleBindingLister. +type RoleBindingListerExpansion interface{} + +// RoleBindingNamespaceListerExpansion allows custom methods to be added to +// RoleBindingNamespaceLister. +type RoleBindingNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/role.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/role.go new file mode 100644 index 000000000..13a64137a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/role.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleLister helps list Roles. +// All objects returned here must be treated as read-only. +type RoleLister interface { + // List lists all Roles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Role, err error) + // Roles returns an object that can list and get Roles. + Roles(namespace string) RoleNamespaceLister + RoleListerExpansion +} + +// roleLister implements the RoleLister interface. +type roleLister struct { + indexer cache.Indexer +} + +// NewRoleLister returns a new RoleLister. +func NewRoleLister(indexer cache.Indexer) RoleLister { + return &roleLister{indexer: indexer} +} + +// List lists all Roles in the indexer. +func (s *roleLister) List(selector labels.Selector) (ret []*v1alpha1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get Roles. +func (s *roleLister) Roles(namespace string) RoleNamespaceLister { + return roleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleNamespaceLister helps list and get Roles. +// All objects returned here must be treated as read-only. +type RoleNamespaceLister interface { + // List lists all Roles in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Role, err error) + // Get retrieves the Role from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Role, error) + RoleNamespaceListerExpansion +} + +// roleNamespaceLister implements the RoleNamespaceLister +// interface. +type roleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Roles in the indexer for a given namespace. +func (s roleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Role, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Role)) + }) + return ret, err +} + +// Get retrieves the Role from the indexer for a given namespace and name. +func (s roleNamespaceLister) Get(name string) (*v1alpha1.Role, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("role"), name) + } + return obj.(*v1alpha1.Role), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1alpha1/rolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/rolebinding.go new file mode 100644 index 000000000..0ad3d0eba --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1alpha1/rolebinding.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/rbac/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingLister helps list RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingLister interface { + // List lists all RoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RoleBinding, err error) + // RoleBindings returns an object that can list and get RoleBindings. + RoleBindings(namespace string) RoleBindingNamespaceLister + RoleBindingListerExpansion +} + +// roleBindingLister implements the RoleBindingLister interface. +type roleBindingLister struct { + indexer cache.Indexer +} + +// NewRoleBindingLister returns a new RoleBindingLister. +func NewRoleBindingLister(indexer cache.Indexer) RoleBindingLister { + return &roleBindingLister{indexer: indexer} +} + +// List lists all RoleBindings in the indexer. +func (s *roleBindingLister) List(selector labels.Selector) (ret []*v1alpha1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get RoleBindings. +func (s *roleBindingLister) RoleBindings(namespace string) RoleBindingNamespaceLister { + return roleBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingNamespaceLister helps list and get RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingNamespaceLister interface { + // List lists all RoleBindings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.RoleBinding, err error) + // Get retrieves the RoleBinding from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.RoleBinding, error) + RoleBindingNamespaceListerExpansion +} + +// roleBindingNamespaceLister implements the RoleBindingNamespaceLister +// interface. +type roleBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindings in the indexer for a given namespace. +func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.RoleBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.RoleBinding)) + }) + return ret, err +} + +// Get retrieves the RoleBinding from the indexer for a given namespace and name. +func (s roleBindingNamespaceLister) Get(name string) (*v1alpha1.RoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("rolebinding"), name) + } + return obj.(*v1alpha1.RoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrole.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrole.go new file mode 100644 index 000000000..bf6cd99cb --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrole.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleLister helps list ClusterRoles. +// All objects returned here must be treated as read-only. +type ClusterRoleLister interface { + // List lists all ClusterRoles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ClusterRole, err error) + // Get retrieves the ClusterRole from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ClusterRole, error) + ClusterRoleListerExpansion +} + +// clusterRoleLister implements the ClusterRoleLister interface. +type clusterRoleLister struct { + indexer cache.Indexer +} + +// NewClusterRoleLister returns a new ClusterRoleLister. +func NewClusterRoleLister(indexer cache.Indexer) ClusterRoleLister { + return &clusterRoleLister{indexer: indexer} +} + +// List lists all ClusterRoles in the indexer. +func (s *clusterRoleLister) List(selector labels.Selector) (ret []*v1beta1.ClusterRole, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ClusterRole)) + }) + return ret, err +} + +// Get retrieves the ClusterRole from the index for a given name. +func (s *clusterRoleLister) Get(name string) (*v1beta1.ClusterRole, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("clusterrole"), name) + } + return obj.(*v1beta1.ClusterRole), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrolebinding.go new file mode 100644 index 000000000..00bab2330 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/clusterrolebinding.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterRoleBindingLister helps list ClusterRoleBindings. +// All objects returned here must be treated as read-only. +type ClusterRoleBindingLister interface { + // List lists all ClusterRoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.ClusterRoleBinding, err error) + // Get retrieves the ClusterRoleBinding from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.ClusterRoleBinding, error) + ClusterRoleBindingListerExpansion +} + +// clusterRoleBindingLister implements the ClusterRoleBindingLister interface. +type clusterRoleBindingLister struct { + indexer cache.Indexer +} + +// NewClusterRoleBindingLister returns a new ClusterRoleBindingLister. +func NewClusterRoleBindingLister(indexer cache.Indexer) ClusterRoleBindingLister { + return &clusterRoleBindingLister{indexer: indexer} +} + +// List lists all ClusterRoleBindings in the indexer. +func (s *clusterRoleBindingLister) List(selector labels.Selector) (ret []*v1beta1.ClusterRoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.ClusterRoleBinding)) + }) + return ret, err +} + +// Get retrieves the ClusterRoleBinding from the index for a given name. +func (s *clusterRoleBindingLister) Get(name string) (*v1beta1.ClusterRoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("clusterrolebinding"), name) + } + return obj.(*v1beta1.ClusterRoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/expansion_generated.go new file mode 100644 index 000000000..51f674bd0 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// ClusterRoleListerExpansion allows custom methods to be added to +// ClusterRoleLister. +type ClusterRoleListerExpansion interface{} + +// ClusterRoleBindingListerExpansion allows custom methods to be added to +// ClusterRoleBindingLister. +type ClusterRoleBindingListerExpansion interface{} + +// RoleListerExpansion allows custom methods to be added to +// RoleLister. +type RoleListerExpansion interface{} + +// RoleNamespaceListerExpansion allows custom methods to be added to +// RoleNamespaceLister. +type RoleNamespaceListerExpansion interface{} + +// RoleBindingListerExpansion allows custom methods to be added to +// RoleBindingLister. +type RoleBindingListerExpansion interface{} + +// RoleBindingNamespaceListerExpansion allows custom methods to be added to +// RoleBindingNamespaceLister. +type RoleBindingNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/role.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/role.go new file mode 100644 index 000000000..9cd9b9042 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/role.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleLister helps list Roles. +// All objects returned here must be treated as read-only. +type RoleLister interface { + // List lists all Roles in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Role, err error) + // Roles returns an object that can list and get Roles. + Roles(namespace string) RoleNamespaceLister + RoleListerExpansion +} + +// roleLister implements the RoleLister interface. +type roleLister struct { + indexer cache.Indexer +} + +// NewRoleLister returns a new RoleLister. +func NewRoleLister(indexer cache.Indexer) RoleLister { + return &roleLister{indexer: indexer} +} + +// List lists all Roles in the indexer. +func (s *roleLister) List(selector labels.Selector) (ret []*v1beta1.Role, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Role)) + }) + return ret, err +} + +// Roles returns an object that can list and get Roles. +func (s *roleLister) Roles(namespace string) RoleNamespaceLister { + return roleNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleNamespaceLister helps list and get Roles. +// All objects returned here must be treated as read-only. +type RoleNamespaceLister interface { + // List lists all Roles in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.Role, err error) + // Get retrieves the Role from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.Role, error) + RoleNamespaceListerExpansion +} + +// roleNamespaceLister implements the RoleNamespaceLister +// interface. +type roleNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Roles in the indexer for a given namespace. +func (s roleNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Role, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.Role)) + }) + return ret, err +} + +// Get retrieves the Role from the indexer for a given namespace and name. +func (s roleNamespaceLister) Get(name string) (*v1beta1.Role, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("role"), name) + } + return obj.(*v1beta1.Role), nil +} diff --git a/vendor/k8s.io/client-go/listers/rbac/v1beta1/rolebinding.go b/vendor/k8s.io/client-go/listers/rbac/v1beta1/rolebinding.go new file mode 100644 index 000000000..7c7c91bf3 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/rbac/v1beta1/rolebinding.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/rbac/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RoleBindingLister helps list RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingLister interface { + // List lists all RoleBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.RoleBinding, err error) + // RoleBindings returns an object that can list and get RoleBindings. + RoleBindings(namespace string) RoleBindingNamespaceLister + RoleBindingListerExpansion +} + +// roleBindingLister implements the RoleBindingLister interface. +type roleBindingLister struct { + indexer cache.Indexer +} + +// NewRoleBindingLister returns a new RoleBindingLister. +func NewRoleBindingLister(indexer cache.Indexer) RoleBindingLister { + return &roleBindingLister{indexer: indexer} +} + +// List lists all RoleBindings in the indexer. +func (s *roleBindingLister) List(selector labels.Selector) (ret []*v1beta1.RoleBinding, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.RoleBinding)) + }) + return ret, err +} + +// RoleBindings returns an object that can list and get RoleBindings. +func (s *roleBindingLister) RoleBindings(namespace string) RoleBindingNamespaceLister { + return roleBindingNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// RoleBindingNamespaceLister helps list and get RoleBindings. +// All objects returned here must be treated as read-only. +type RoleBindingNamespaceLister interface { + // List lists all RoleBindings in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.RoleBinding, err error) + // Get retrieves the RoleBinding from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.RoleBinding, error) + RoleBindingNamespaceListerExpansion +} + +// roleBindingNamespaceLister implements the RoleBindingNamespaceLister +// interface. +type roleBindingNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all RoleBindings in the indexer for a given namespace. +func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.RoleBinding, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.RoleBinding)) + }) + return ret, err +} + +// Get retrieves the RoleBinding from the indexer for a given namespace and name. +func (s roleBindingNamespaceLister) Get(name string) (*v1beta1.RoleBinding, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("rolebinding"), name) + } + return obj.(*v1beta1.RoleBinding), nil +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1/expansion_generated.go new file mode 100644 index 000000000..d0c45d012 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// PriorityClassListerExpansion allows custom methods to be added to +// PriorityClassLister. +type PriorityClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1/priorityclass.go b/vendor/k8s.io/client-go/listers/scheduling/v1/priorityclass.go new file mode 100644 index 000000000..4da84ccf8 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1/priorityclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/scheduling/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityClassLister helps list PriorityClasses. +// All objects returned here must be treated as read-only. +type PriorityClassLister interface { + // List lists all PriorityClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PriorityClass, err error) + // Get retrieves the PriorityClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PriorityClass, error) + PriorityClassListerExpansion +} + +// priorityClassLister implements the PriorityClassLister interface. +type priorityClassLister struct { + indexer cache.Indexer +} + +// NewPriorityClassLister returns a new PriorityClassLister. +func NewPriorityClassLister(indexer cache.Indexer) PriorityClassLister { + return &priorityClassLister{indexer: indexer} +} + +// List lists all PriorityClasses in the indexer. +func (s *priorityClassLister) List(selector labels.Selector) (ret []*v1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the PriorityClass from the index for a given name. +func (s *priorityClassLister) Get(name string) (*v1.PriorityClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("priorityclass"), name) + } + return obj.(*v1.PriorityClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..bde8b6206 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// PriorityClassListerExpansion allows custom methods to be added to +// PriorityClassLister. +type PriorityClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go new file mode 100644 index 000000000..3d25dc80a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/scheduling/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityClassLister helps list PriorityClasses. +// All objects returned here must be treated as read-only. +type PriorityClassLister interface { + // List lists all PriorityClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.PriorityClass, err error) + // Get retrieves the PriorityClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.PriorityClass, error) + PriorityClassListerExpansion +} + +// priorityClassLister implements the PriorityClassLister interface. +type priorityClassLister struct { + indexer cache.Indexer +} + +// NewPriorityClassLister returns a new PriorityClassLister. +func NewPriorityClassLister(indexer cache.Indexer) PriorityClassLister { + return &priorityClassLister{indexer: indexer} +} + +// List lists all PriorityClasses in the indexer. +func (s *priorityClassLister) List(selector labels.Selector) (ret []*v1alpha1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the PriorityClass from the index for a given name. +func (s *priorityClassLister) Get(name string) (*v1alpha1.PriorityClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("priorityclass"), name) + } + return obj.(*v1alpha1.PriorityClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go new file mode 100644 index 000000000..b806e8cf8 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// PriorityClassListerExpansion allows custom methods to be added to +// PriorityClassLister. +type PriorityClassListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1beta1/priorityclass.go b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/priorityclass.go new file mode 100644 index 000000000..c848d035a --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1beta1/priorityclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/scheduling/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PriorityClassLister helps list PriorityClasses. +// All objects returned here must be treated as read-only. +type PriorityClassLister interface { + // List lists all PriorityClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.PriorityClass, err error) + // Get retrieves the PriorityClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.PriorityClass, error) + PriorityClassListerExpansion +} + +// priorityClassLister implements the PriorityClassLister interface. +type priorityClassLister struct { + indexer cache.Indexer +} + +// NewPriorityClassLister returns a new PriorityClassLister. +func NewPriorityClassLister(indexer cache.Indexer) PriorityClassLister { + return &priorityClassLister{indexer: indexer} +} + +// List lists all PriorityClasses in the indexer. +func (s *priorityClassLister) List(selector labels.Selector) (ret []*v1beta1.PriorityClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.PriorityClass)) + }) + return ret, err +} + +// Get retrieves the PriorityClass from the index for a given name. +func (s *priorityClassLister) Get(name string) (*v1beta1.PriorityClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("priorityclass"), name) + } + return obj.(*v1beta1.PriorityClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/csidriver.go b/vendor/k8s.io/client-go/listers/storage/v1/csidriver.go new file mode 100644 index 000000000..4e8ab9090 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/csidriver.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIDriverLister helps list CSIDrivers. +// All objects returned here must be treated as read-only. +type CSIDriverLister interface { + // List lists all CSIDrivers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CSIDriver, err error) + // Get retrieves the CSIDriver from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CSIDriver, error) + CSIDriverListerExpansion +} + +// cSIDriverLister implements the CSIDriverLister interface. +type cSIDriverLister struct { + indexer cache.Indexer +} + +// NewCSIDriverLister returns a new CSIDriverLister. +func NewCSIDriverLister(indexer cache.Indexer) CSIDriverLister { + return &cSIDriverLister{indexer: indexer} +} + +// List lists all CSIDrivers in the indexer. +func (s *cSIDriverLister) List(selector labels.Selector) (ret []*v1.CSIDriver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CSIDriver)) + }) + return ret, err +} + +// Get retrieves the CSIDriver from the index for a given name. +func (s *cSIDriverLister) Get(name string) (*v1.CSIDriver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("csidriver"), name) + } + return obj.(*v1.CSIDriver), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/csinode.go b/vendor/k8s.io/client-go/listers/storage/v1/csinode.go new file mode 100644 index 000000000..93f869572 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/csinode.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSINodeLister helps list CSINodes. +// All objects returned here must be treated as read-only. +type CSINodeLister interface { + // List lists all CSINodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.CSINode, err error) + // Get retrieves the CSINode from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.CSINode, error) + CSINodeListerExpansion +} + +// cSINodeLister implements the CSINodeLister interface. +type cSINodeLister struct { + indexer cache.Indexer +} + +// NewCSINodeLister returns a new CSINodeLister. +func NewCSINodeLister(indexer cache.Indexer) CSINodeLister { + return &cSINodeLister{indexer: indexer} +} + +// List lists all CSINodes in the indexer. +func (s *cSINodeLister) List(selector labels.Selector) (ret []*v1.CSINode, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.CSINode)) + }) + return ret, err +} + +// Get retrieves the CSINode from the index for a given name. +func (s *cSINodeLister) Get(name string) (*v1.CSINode, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("csinode"), name) + } + return obj.(*v1.CSINode), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/storage/v1/expansion_generated.go new file mode 100644 index 000000000..172f835f7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// CSIDriverListerExpansion allows custom methods to be added to +// CSIDriverLister. +type CSIDriverListerExpansion interface{} + +// CSINodeListerExpansion allows custom methods to be added to +// CSINodeLister. +type CSINodeListerExpansion interface{} + +// StorageClassListerExpansion allows custom methods to be added to +// StorageClassLister. +type StorageClassListerExpansion interface{} + +// VolumeAttachmentListerExpansion allows custom methods to be added to +// VolumeAttachmentLister. +type VolumeAttachmentListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/storageclass.go b/vendor/k8s.io/client-go/listers/storage/v1/storageclass.go new file mode 100644 index 000000000..ffa3d19f5 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/storageclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StorageClassLister helps list StorageClasses. +// All objects returned here must be treated as read-only. +type StorageClassLister interface { + // List lists all StorageClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.StorageClass, err error) + // Get retrieves the StorageClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.StorageClass, error) + StorageClassListerExpansion +} + +// storageClassLister implements the StorageClassLister interface. +type storageClassLister struct { + indexer cache.Indexer +} + +// NewStorageClassLister returns a new StorageClassLister. +func NewStorageClassLister(indexer cache.Indexer) StorageClassLister { + return &storageClassLister{indexer: indexer} +} + +// List lists all StorageClasses in the indexer. +func (s *storageClassLister) List(selector labels.Selector) (ret []*v1.StorageClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.StorageClass)) + }) + return ret, err +} + +// Get retrieves the StorageClass from the index for a given name. +func (s *storageClassLister) Get(name string) (*v1.StorageClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("storageclass"), name) + } + return obj.(*v1.StorageClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1/volumeattachment.go b/vendor/k8s.io/client-go/listers/storage/v1/volumeattachment.go new file mode 100644 index 000000000..fbc735c93 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1/volumeattachment.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentLister helps list VolumeAttachments. +// All objects returned here must be treated as read-only. +type VolumeAttachmentLister interface { + // List lists all VolumeAttachments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.VolumeAttachment, err error) + // Get retrieves the VolumeAttachment from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.VolumeAttachment, error) + VolumeAttachmentListerExpansion +} + +// volumeAttachmentLister implements the VolumeAttachmentLister interface. +type volumeAttachmentLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentLister returns a new VolumeAttachmentLister. +func NewVolumeAttachmentLister(indexer cache.Indexer) VolumeAttachmentLister { + return &volumeAttachmentLister{indexer: indexer} +} + +// List lists all VolumeAttachments in the indexer. +func (s *volumeAttachmentLister) List(selector labels.Selector) (ret []*v1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the VolumeAttachment from the index for a given name. +func (s *volumeAttachmentLister) Get(name string) (*v1.VolumeAttachment, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("volumeattachment"), name) + } + return obj.(*v1.VolumeAttachment), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1alpha1/csistoragecapacity.go b/vendor/k8s.io/client-go/listers/storage/v1alpha1/csistoragecapacity.go new file mode 100644 index 000000000..0c1b5f264 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1alpha1/csistoragecapacity.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/storage/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityLister helps list CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityLister interface { + // List lists all CSIStorageCapacities in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.CSIStorageCapacity, err error) + // CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. + CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister + CSIStorageCapacityListerExpansion +} + +// cSIStorageCapacityLister implements the CSIStorageCapacityLister interface. +type cSIStorageCapacityLister struct { + indexer cache.Indexer +} + +// NewCSIStorageCapacityLister returns a new CSIStorageCapacityLister. +func NewCSIStorageCapacityLister(indexer cache.Indexer) CSIStorageCapacityLister { + return &cSIStorageCapacityLister{indexer: indexer} +} + +// List lists all CSIStorageCapacities in the indexer. +func (s *cSIStorageCapacityLister) List(selector labels.Selector) (ret []*v1alpha1.CSIStorageCapacity, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CSIStorageCapacity)) + }) + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. +func (s *cSIStorageCapacityLister) CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister { + return cSIStorageCapacityNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CSIStorageCapacityNamespaceLister helps list and get CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityNamespaceLister interface { + // List lists all CSIStorageCapacities in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.CSIStorageCapacity, err error) + // Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.CSIStorageCapacity, error) + CSIStorageCapacityNamespaceListerExpansion +} + +// cSIStorageCapacityNamespaceLister implements the CSIStorageCapacityNamespaceLister +// interface. +type cSIStorageCapacityNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CSIStorageCapacities in the indexer for a given namespace. +func (s cSIStorageCapacityNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CSIStorageCapacity, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.CSIStorageCapacity)) + }) + return ret, err +} + +// Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. +func (s cSIStorageCapacityNamespaceLister) Get(name string) (*v1alpha1.CSIStorageCapacity, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("csistoragecapacity"), name) + } + return obj.(*v1alpha1.CSIStorageCapacity), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/storage/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..edefe6d05 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1alpha1/expansion_generated.go @@ -0,0 +1,31 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// CSIStorageCapacityListerExpansion allows custom methods to be added to +// CSIStorageCapacityLister. +type CSIStorageCapacityListerExpansion interface{} + +// CSIStorageCapacityNamespaceListerExpansion allows custom methods to be added to +// CSIStorageCapacityNamespaceLister. +type CSIStorageCapacityNamespaceListerExpansion interface{} + +// VolumeAttachmentListerExpansion allows custom methods to be added to +// VolumeAttachmentLister. +type VolumeAttachmentListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/storage/v1alpha1/volumeattachment.go b/vendor/k8s.io/client-go/listers/storage/v1alpha1/volumeattachment.go new file mode 100644 index 000000000..3d5e2b7b7 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1alpha1/volumeattachment.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "k8s.io/api/storage/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentLister helps list VolumeAttachments. +// All objects returned here must be treated as read-only. +type VolumeAttachmentLister interface { + // List lists all VolumeAttachments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VolumeAttachment, err error) + // Get retrieves the VolumeAttachment from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VolumeAttachment, error) + VolumeAttachmentListerExpansion +} + +// volumeAttachmentLister implements the VolumeAttachmentLister interface. +type volumeAttachmentLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentLister returns a new VolumeAttachmentLister. +func NewVolumeAttachmentLister(indexer cache.Indexer) VolumeAttachmentLister { + return &volumeAttachmentLister{indexer: indexer} +} + +// List lists all VolumeAttachments in the indexer. +func (s *volumeAttachmentLister) List(selector labels.Selector) (ret []*v1alpha1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the VolumeAttachment from the index for a given name. +func (s *volumeAttachmentLister) Get(name string) (*v1alpha1.VolumeAttachment, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("volumeattachment"), name) + } + return obj.(*v1alpha1.VolumeAttachment), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/csidriver.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/csidriver.go new file mode 100644 index 000000000..c6787aa01 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/csidriver.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIDriverLister helps list CSIDrivers. +// All objects returned here must be treated as read-only. +type CSIDriverLister interface { + // List lists all CSIDrivers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CSIDriver, err error) + // Get retrieves the CSIDriver from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CSIDriver, error) + CSIDriverListerExpansion +} + +// cSIDriverLister implements the CSIDriverLister interface. +type cSIDriverLister struct { + indexer cache.Indexer +} + +// NewCSIDriverLister returns a new CSIDriverLister. +func NewCSIDriverLister(indexer cache.Indexer) CSIDriverLister { + return &cSIDriverLister{indexer: indexer} +} + +// List lists all CSIDrivers in the indexer. +func (s *cSIDriverLister) List(selector labels.Selector) (ret []*v1beta1.CSIDriver, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CSIDriver)) + }) + return ret, err +} + +// Get retrieves the CSIDriver from the index for a given name. +func (s *cSIDriverLister) Get(name string) (*v1beta1.CSIDriver, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("csidriver"), name) + } + return obj.(*v1beta1.CSIDriver), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/csinode.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/csinode.go new file mode 100644 index 000000000..809efaa36 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/csinode.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSINodeLister helps list CSINodes. +// All objects returned here must be treated as read-only. +type CSINodeLister interface { + // List lists all CSINodes in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CSINode, err error) + // Get retrieves the CSINode from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CSINode, error) + CSINodeListerExpansion +} + +// cSINodeLister implements the CSINodeLister interface. +type cSINodeLister struct { + indexer cache.Indexer +} + +// NewCSINodeLister returns a new CSINodeLister. +func NewCSINodeLister(indexer cache.Indexer) CSINodeLister { + return &cSINodeLister{indexer: indexer} +} + +// List lists all CSINodes in the indexer. +func (s *cSINodeLister) List(selector labels.Selector) (ret []*v1beta1.CSINode, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CSINode)) + }) + return ret, err +} + +// Get retrieves the CSINode from the index for a given name. +func (s *cSINodeLister) Get(name string) (*v1beta1.CSINode, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("csinode"), name) + } + return obj.(*v1beta1.CSINode), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/csistoragecapacity.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/csistoragecapacity.go new file mode 100644 index 000000000..4680ffb7c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/csistoragecapacity.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// CSIStorageCapacityLister helps list CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityLister interface { + // List lists all CSIStorageCapacities in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CSIStorageCapacity, err error) + // CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. + CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister + CSIStorageCapacityListerExpansion +} + +// cSIStorageCapacityLister implements the CSIStorageCapacityLister interface. +type cSIStorageCapacityLister struct { + indexer cache.Indexer +} + +// NewCSIStorageCapacityLister returns a new CSIStorageCapacityLister. +func NewCSIStorageCapacityLister(indexer cache.Indexer) CSIStorageCapacityLister { + return &cSIStorageCapacityLister{indexer: indexer} +} + +// List lists all CSIStorageCapacities in the indexer. +func (s *cSIStorageCapacityLister) List(selector labels.Selector) (ret []*v1beta1.CSIStorageCapacity, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CSIStorageCapacity)) + }) + return ret, err +} + +// CSIStorageCapacities returns an object that can list and get CSIStorageCapacities. +func (s *cSIStorageCapacityLister) CSIStorageCapacities(namespace string) CSIStorageCapacityNamespaceLister { + return cSIStorageCapacityNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// CSIStorageCapacityNamespaceLister helps list and get CSIStorageCapacities. +// All objects returned here must be treated as read-only. +type CSIStorageCapacityNamespaceLister interface { + // List lists all CSIStorageCapacities in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.CSIStorageCapacity, err error) + // Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.CSIStorageCapacity, error) + CSIStorageCapacityNamespaceListerExpansion +} + +// cSIStorageCapacityNamespaceLister implements the CSIStorageCapacityNamespaceLister +// interface. +type cSIStorageCapacityNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all CSIStorageCapacities in the indexer for a given namespace. +func (s cSIStorageCapacityNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.CSIStorageCapacity, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.CSIStorageCapacity)) + }) + return ret, err +} + +// Get retrieves the CSIStorageCapacity from the indexer for a given namespace and name. +func (s cSIStorageCapacityNamespaceLister) Get(name string) (*v1beta1.CSIStorageCapacity, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("csistoragecapacity"), name) + } + return obj.(*v1beta1.CSIStorageCapacity), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/expansion_generated.go new file mode 100644 index 000000000..c2b0d5b17 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/expansion_generated.go @@ -0,0 +1,43 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +// CSIDriverListerExpansion allows custom methods to be added to +// CSIDriverLister. +type CSIDriverListerExpansion interface{} + +// CSINodeListerExpansion allows custom methods to be added to +// CSINodeLister. +type CSINodeListerExpansion interface{} + +// CSIStorageCapacityListerExpansion allows custom methods to be added to +// CSIStorageCapacityLister. +type CSIStorageCapacityListerExpansion interface{} + +// CSIStorageCapacityNamespaceListerExpansion allows custom methods to be added to +// CSIStorageCapacityNamespaceLister. +type CSIStorageCapacityNamespaceListerExpansion interface{} + +// StorageClassListerExpansion allows custom methods to be added to +// StorageClassLister. +type StorageClassListerExpansion interface{} + +// VolumeAttachmentListerExpansion allows custom methods to be added to +// VolumeAttachmentLister. +type VolumeAttachmentListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/storageclass.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/storageclass.go new file mode 100644 index 000000000..eb7b8315c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/storageclass.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// StorageClassLister helps list StorageClasses. +// All objects returned here must be treated as read-only. +type StorageClassLister interface { + // List lists all StorageClasses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.StorageClass, err error) + // Get retrieves the StorageClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.StorageClass, error) + StorageClassListerExpansion +} + +// storageClassLister implements the StorageClassLister interface. +type storageClassLister struct { + indexer cache.Indexer +} + +// NewStorageClassLister returns a new StorageClassLister. +func NewStorageClassLister(indexer cache.Indexer) StorageClassLister { + return &storageClassLister{indexer: indexer} +} + +// List lists all StorageClasses in the indexer. +func (s *storageClassLister) List(selector labels.Selector) (ret []*v1beta1.StorageClass, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.StorageClass)) + }) + return ret, err +} + +// Get retrieves the StorageClass from the index for a given name. +func (s *storageClassLister) Get(name string) (*v1beta1.StorageClass, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("storageclass"), name) + } + return obj.(*v1beta1.StorageClass), nil +} diff --git a/vendor/k8s.io/client-go/listers/storage/v1beta1/volumeattachment.go b/vendor/k8s.io/client-go/listers/storage/v1beta1/volumeattachment.go new file mode 100644 index 000000000..bab2d317c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/storage/v1beta1/volumeattachment.go @@ -0,0 +1,68 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/storage/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// VolumeAttachmentLister helps list VolumeAttachments. +// All objects returned here must be treated as read-only. +type VolumeAttachmentLister interface { + // List lists all VolumeAttachments in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1beta1.VolumeAttachment, err error) + // Get retrieves the VolumeAttachment from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1beta1.VolumeAttachment, error) + VolumeAttachmentListerExpansion +} + +// volumeAttachmentLister implements the VolumeAttachmentLister interface. +type volumeAttachmentLister struct { + indexer cache.Indexer +} + +// NewVolumeAttachmentLister returns a new VolumeAttachmentLister. +func NewVolumeAttachmentLister(indexer cache.Indexer) VolumeAttachmentLister { + return &volumeAttachmentLister{indexer: indexer} +} + +// List lists all VolumeAttachments in the indexer. +func (s *volumeAttachmentLister) List(selector labels.Selector) (ret []*v1beta1.VolumeAttachment, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.VolumeAttachment)) + }) + return ret, err +} + +// Get retrieves the VolumeAttachment from the index for a given name. +func (s *volumeAttachmentLister) Get(name string) (*v1beta1.VolumeAttachment, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("volumeattachment"), name) + } + return obj.(*v1beta1.VolumeAttachment), nil +} diff --git a/vendor/k8s.io/klog/v2/klog.go b/vendor/k8s.io/klog/v2/klog.go index 45efbb075..dacdf9112 100644 --- a/vendor/k8s.io/klog/v2/klog.go +++ b/vendor/k8s.io/klog/v2/klog.go @@ -801,14 +801,19 @@ func (l *loggingT) infoS(logger *logr.Logger, filter LogFilter, depth int, msg s // printS is called from infoS and errorS if loggr is not specified. // set log severity by s func (l *loggingT) printS(err error, s severity, depth int, msg string, keysAndValues ...interface{}) { - b := &bytes.Buffer{} - b.WriteString(fmt.Sprintf("%q", msg)) + // Only create a new buffer if we don't have one cached. + b := l.getBuffer() + // The message is always quoted, even if it contains line breaks. + // If developers want multi-line output, they should use a small, fixed + // message and put the multi-line output into a value. + b.WriteString(strconv.Quote(msg)) if err != nil { - b.WriteByte(' ') - b.WriteString(fmt.Sprintf("err=%q", err.Error())) + kvListFormat(&b.Buffer, "err", err) } - kvListFormat(b, keysAndValues...) - l.printDepth(s, logging.logr, nil, depth+1, b) + kvListFormat(&b.Buffer, keysAndValues...) + l.printDepth(s, logging.logr, nil, depth+1, &b.Buffer) + // Make the buffer available for reuse. + l.putBuffer(b) } const missingValue = "(MISSING)" @@ -823,22 +828,109 @@ func kvListFormat(b *bytes.Buffer, keysAndValues ...interface{}) { v = missingValue } b.WriteByte(' ') + // Keys are assumed to be well-formed according to + // https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments + // for the sake of performance. Keys with spaces, + // special characters, etc. will break parsing. + if k, ok := k.(string); ok { + // Avoid one allocation when the key is a string, which + // normally it should be. + b.WriteString(k) + } else { + b.WriteString(fmt.Sprintf("%s", k)) + } - switch v.(type) { - case string, error: - b.WriteString(fmt.Sprintf("%s=%q", k, v)) + // The type checks are sorted so that more frequently used ones + // come first because that is then faster in the common + // cases. In Kubernetes, ObjectRef (a Stringer) is more common + // than plain strings + // (https://github.com/kubernetes/kubernetes/pull/106594#issuecomment-975526235). + switch v := v.(type) { + case fmt.Stringer: + writeStringValue(b, true, stringerToString(v)) + case string: + writeStringValue(b, true, v) + case error: + writeStringValue(b, true, v.Error()) case []byte: - b.WriteString(fmt.Sprintf("%s=%+q", k, v)) + // In https://github.com/kubernetes/klog/pull/237 it was decided + // to format byte slices with "%+q". The advantages of that are: + // - readable output if the bytes happen to be printable + // - non-printable bytes get represented as unicode escape + // sequences (\uxxxx) + // + // The downsides are that we cannot use the faster + // strconv.Quote here and that multi-line output is not + // supported. If developers know that a byte array is + // printable and they want multi-line output, they can + // convert the value to string before logging it. + b.WriteByte('=') + b.WriteString(fmt.Sprintf("%+q", v)) default: - if _, ok := v.(fmt.Stringer); ok { - b.WriteString(fmt.Sprintf("%s=%q", k, v)) - } else { - b.WriteString(fmt.Sprintf("%s=%+v", k, v)) - } + writeStringValue(b, false, fmt.Sprintf("%+v", v)) } } } +func stringerToString(s fmt.Stringer) (ret string) { + defer func() { + if err := recover(); err != nil { + ret = "nil" + } + }() + ret = s.String() + return +} + +func writeStringValue(b *bytes.Buffer, quote bool, v string) { + data := []byte(v) + index := bytes.IndexByte(data, '\n') + if index == -1 { + b.WriteByte('=') + if quote { + // Simple string, quote quotation marks and non-printable characters. + b.WriteString(strconv.Quote(v)) + return + } + // Non-string with no line breaks. + b.WriteString(v) + return + } + + // Complex multi-line string, show as-is with indention like this: + // I... "hello world" key=< + // line 1 + // line 2 + // > + // + // Tabs indent the lines of the value while the end of string delimiter + // is indented with a space. That has two purposes: + // - visual difference between the two for a human reader because indention + // will be different + // - no ambiguity when some value line starts with the end delimiter + // + // One downside is that the output cannot distinguish between strings that + // end with a line break and those that don't because the end delimiter + // will always be on the next line. + b.WriteString("=<\n") + for index != -1 { + b.WriteByte('\t') + b.Write(data[0 : index+1]) + data = data[index+1:] + index = bytes.IndexByte(data, '\n') + } + if len(data) == 0 { + // String ended with line break, don't add another. + b.WriteString(" >") + } else { + // No line break at end of last line, write rest of string and + // add one. + b.WriteByte('\t') + b.Write(data) + b.WriteString("\n >") + } +} + // redirectBuffer is used to set an alternate destination for the logs type redirectBuffer struct { w io.Writer @@ -917,7 +1009,15 @@ func LogToStderr(stderr bool) { // output writes the data to the log files and releases the buffer. func (l *loggingT) output(s severity, log *logr.Logger, buf *buffer, depth int, file string, line int, alsoToStderr bool) { + var isLocked = true l.mu.Lock() + defer func() { + if isLocked { + // Unlock before returning in case that it wasn't done already. + l.mu.Unlock() + } + }() + if l.traceLocation.isSet() { if l.traceLocation.match(file, line) { buf.Write(stacks(false)) @@ -980,6 +1080,7 @@ func (l *loggingT) output(s severity, log *logr.Logger, buf *buffer, depth int, // If we got here via Exit rather than Fatal, print no stacks. if atomic.LoadUint32(&fatalNoStacks) > 0 { l.mu.Unlock() + isLocked = false timeoutFlush(10 * time.Second) os.Exit(1) } @@ -997,11 +1098,12 @@ func (l *loggingT) output(s severity, log *logr.Logger, buf *buffer, depth int, } } l.mu.Unlock() + isLocked = false timeoutFlush(10 * time.Second) - os.Exit(255) // C++ uses -1, which is silly because it's anded with 255 anyway. + os.Exit(255) // C++ uses -1, which is silly because it's anded(&) with 255 anyway. } l.putBuffer(buf) - l.mu.Unlock() + if stats := severityStats[s]; stats != nil { atomic.AddInt64(&stats.lines, 1) atomic.AddInt64(&stats.bytes, int64(len(data))) @@ -1387,6 +1489,14 @@ func InfoSDepth(depth int, msg string, keysAndValues ...interface{}) { logging.infoS(logging.logr, logging.filter, depth, msg, keysAndValues...) } +// InfoSDepth is equivalent to the global InfoSDepth function, guarded by the value of v. +// See the documentation of V for usage. +func (v Verbose) InfoSDepth(depth int, msg string, keysAndValues ...interface{}) { + if v.enabled { + logging.infoS(v.logr, v.filter, depth, msg, keysAndValues...) + } +} + // Deprecated: Use ErrorS instead. func (v Verbose) Error(err error, msg string, args ...interface{}) { if v.enabled { diff --git a/vendor/k8s.io/klog/v2/klog_file.go b/vendor/k8s.io/klog/v2/klog_file.go index de830d922..1025d644f 100644 --- a/vendor/k8s.io/klog/v2/klog_file.go +++ b/vendor/k8s.io/klog/v2/klog_file.go @@ -22,9 +22,7 @@ import ( "errors" "fmt" "os" - "os/user" "path/filepath" - "runtime" "strings" "sync" "time" @@ -57,38 +55,6 @@ func init() { } } -func getUserName() string { - userNameOnce.Do(func() { - // On Windows, the Go 'user' package requires netapi32.dll. - // This affects Windows Nano Server: - // https://github.com/golang/go/issues/21867 - // Fallback to using environment variables. - if runtime.GOOS == "windows" { - u := os.Getenv("USERNAME") - if len(u) == 0 { - return - } - // Sanitize the USERNAME since it may contain filepath separators. - u = strings.Replace(u, `\`, "_", -1) - - // user.Current().Username normally produces something like 'USERDOMAIN\USERNAME' - d := os.Getenv("USERDOMAIN") - if len(d) != 0 { - userName = d + "_" + u - } else { - userName = u - } - } else { - current, err := user.Current() - if err == nil { - userName = current.Username - } - } - }) - - return userName -} - // shortHostname returns its argument, truncating at the first period. // For instance, given "www.google.com" it returns "www". func shortHostname(hostname string) string { diff --git a/vendor/k8s.io/klog/v2/klog_file_others.go b/vendor/k8s.io/klog/v2/klog_file_others.go new file mode 100644 index 000000000..aa4672685 --- /dev/null +++ b/vendor/k8s.io/klog/v2/klog_file_others.go @@ -0,0 +1,19 @@ +//go:build !windows +// +build !windows + +package klog + +import ( + "os/user" +) + +func getUserName() string { + userNameOnce.Do(func() { + current, err := user.Current() + if err == nil { + userName = current.Username + } + }) + + return userName +} diff --git a/vendor/k8s.io/klog/v2/klog_file_windows.go b/vendor/k8s.io/klog/v2/klog_file_windows.go new file mode 100644 index 000000000..2517f9c53 --- /dev/null +++ b/vendor/k8s.io/klog/v2/klog_file_windows.go @@ -0,0 +1,34 @@ +//go:build windows +// +build windows + +package klog + +import ( + "os" + "strings" +) + +func getUserName() string { + userNameOnce.Do(func() { + // On Windows, the Go 'user' package requires netapi32.dll. + // This affects Windows Nano Server: + // https://github.com/golang/go/issues/21867 + // Fallback to using environment variables. + u := os.Getenv("USERNAME") + if len(u) == 0 { + return + } + // Sanitize the USERNAME since it may contain filepath separators. + u = strings.Replace(u, `\`, "_", -1) + + // user.Current().Username normally produces something like 'USERDOMAIN\USERNAME' + d := os.Getenv("USERDOMAIN") + if len(d) != 0 { + userName = d + "_" + u + } else { + userName = u + } + }) + + return userName +} diff --git a/vendor/knative.dev/eventing/test/test_images/wathola-forwarder/main.go b/vendor/knative.dev/eventing/test/test_images/wathola-forwarder/main.go new file mode 100644 index 000000000..5f45b2be6 --- /dev/null +++ b/vendor/knative.dev/eventing/test/test_images/wathola-forwarder/main.go @@ -0,0 +1,25 @@ +/* + * Copyright 2020 The Knative 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 main + +import "knative.dev/eventing/test/upgrade/prober/wathola/forwarder" + +var instance forwarder.Forwarder + +func main() { + instance = forwarder.New() + instance.Forward() +} diff --git a/vendor/knative.dev/eventing/test/test_images/wathola-forwarder/pod.yaml b/vendor/knative.dev/eventing/test/test_images/wathola-forwarder/pod.yaml new file mode 100644 index 000000000..33e872919 --- /dev/null +++ b/vendor/knative.dev/eventing/test/test_images/wathola-forwarder/pod.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Pod +metadata: + name: wathola-forwarder +spec: + containers: + - name: wathola-forwarder + image: ko://knative.dev/eventing/test/test_images/wathola-forwarder diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/client/receiver.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/client/receiver.go new file mode 100644 index 000000000..ed73e6779 --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/client/receiver.go @@ -0,0 +1,108 @@ +/* + * Copyright 2020 The Knative 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 client + +import ( + "context" + nethttp "net/http" + "strings" + + cloudevents "github.com/cloudevents/sdk-go/v2" + cloudeventshttp "github.com/cloudevents/sdk-go/v2/protocol/http" + "github.com/wavesoftware/go-ensure" + "go.opencensus.io/plugin/ochttp" + "knative.dev/eventing/test/upgrade/prober/wathola/config" + "knative.dev/pkg/tracing/propagation/tracecontextb3" +) + +var log = config.Log + +// ReceiveEvent represents a function that receive event +type ReceiveEvent func(e cloudevents.Event) + +// Receive events and push then to passed fn +func Receive( + port int, + canceling chan context.CancelFunc, + receiveEvent ReceiveEvent, + middlewares ...cloudeventshttp.Middleware, +) { + opts := make([]cloudeventshttp.Option, 0) + opts = append(opts, cloudevents.WithPort(port)) + opts = append(opts, cloudevents.WithRoundTripper(&ochttp.Transport{ + Propagation: tracecontextb3.TraceContextEgress, + })) + if config.Instance.Readiness.Enabled { + readyOpt := cloudevents.WithMiddleware(readinessMiddleware) + opts = append(opts, readyOpt) + } + for _, m := range middlewares { + opt := cloudevents.WithMiddleware(m) + opts = append(opts, opt) + } + http, err := cloudevents.NewHTTP(opts...) + if err != nil { + log.Fatalf("failed to create http transport, %v", err) + } + c, err := cloudevents.NewClient(http) + if err != nil { + log.Fatalf("failed to create client, %v", err) + } + log.Infof("Listening for events on port %v", port) + ctx, cancel := context.WithCancel(context.Background()) + cancelFunc := func() { + log.Infof("Stopping event receiver on port %v", port) + cancel() + } + // https://gobyexample.com/non-blocking-channel-operations + select { + case canceling <- cancelFunc: + default: + } + err = c.StartReceiver(ctx, receiveEvent) + if err != nil { + log.Fatal(err) + } +} + +func readinessMiddleware(next nethttp.Handler) nethttp.Handler { + log.Debugf("Using readiness probe: %v", config.Instance.Readiness.URI) + return &readinessProbe{ + next: next, + } +} + +type readinessProbe struct { + next nethttp.Handler +} + +func (r readinessProbe) ServeHTTP(rw nethttp.ResponseWriter, req *nethttp.Request) { + if req.RequestURI == config.Instance.Readiness.URI { + rw.WriteHeader(config.Instance.Readiness.Status) + _, err := rw.Write([]byte(config.Instance.Readiness.Message)) + ensure.NoError(err) + log.Debugf("Received ready check. Headers: %v", headersOf(req)) + } else { + r.next.ServeHTTP(rw, req) + } +} + +func headersOf(req *nethttp.Request) string { + var b strings.Builder + ensure.NoError(req.Header.Write(&b)) + headers := b.String() + return strings.ReplaceAll(headers, "\r\n", "; ") +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/defaults.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/defaults.go new file mode 100644 index 000000000..77f300a61 --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/defaults.go @@ -0,0 +1,84 @@ +/* + * Copyright 2020 The Knative 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 config + +import ( + "fmt" + nethttp "net/http" + "os" + "strconv" + "time" + + "go.uber.org/zap" +) + +const ( + // DefaultReceiverPort point to a default port of receiver component, and is + // unique so that components can be easily run on localhost for easy debugging + DefaultReceiverPort = 22111 + // DefaultForwarderPort point to a default port of forwarder component + DefaultForwarderPort = 22110 +) + +// Instance holds configuration values +var Instance = defaultValues() + +var port = envint("PORT", DefaultReceiverPort) +var forwarderPort = envint("PORT", DefaultForwarderPort) + +func envint(envKey string, defaultValue int) int { + val, ok := os.LookupEnv(envKey) + if !ok { + return defaultValue + } + result, err := strconv.Atoi(val) + if err != nil { + panic(err) + } + return result +} + +func defaultValues() *Config { + return &Config{ + Receiver: ReceiverConfig{ + Port: port, + Teardown: ReceiverTeardownConfig{ + Duration: 3 * time.Second, + }, + Progress: ReceiverProgressConfig{ + Duration: time.Second, + }, + Errors: ReceiverErrorConfig{ + UnavailablePeriodToReport: time.Minute, + }, + }, + Forwarder: ForwarderConfig{ + Target: fmt.Sprintf("http://localhost:%v/", port), + Port: forwarderPort, + }, + Sender: SenderConfig{ + Address: fmt.Sprintf("http://localhost:%v/", forwarderPort), + Interval: 10 * time.Millisecond, + }, + Readiness: ReadinessConfig{ + Enabled: true, + URI: "/healthz", + Message: "OK", + Status: nethttp.StatusOK, + }, + LogLevel: zap.InfoLevel.String(), + } +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/logger.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/logger.go new file mode 100644 index 000000000..a933bd636 --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/logger.go @@ -0,0 +1,32 @@ +/* + * Copyright 2020 The Knative 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 config + +import ( + "go.uber.org/zap" +) + +// Log is a default logger for wathola +var Log = newLogger() +var logConfig = zap.NewProductionConfig() + +func newLogger() *zap.SugaredLogger { + z, err := logConfig.Build() + if err != nil { + panic(err) + } + return z.Sugar() +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/reader.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/reader.go new file mode 100644 index 000000000..f2c725ab5 --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/reader.go @@ -0,0 +1,76 @@ +/* + * Copyright 2020 The Knative 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 config + +import ( + "os" + + "github.com/mitchellh/go-homedir" + "github.com/pelletier/go-toml/v2" +) + +var location = "~/.config/wathola/config.toml" +var logFatal = Log.Fatal + +// ReadIfPresent read a configuration file if it exists +func ReadIfPresent() { + configFile, err := homedir.Expand(location) + if err != nil { + logFatal(err) + } + if fileExists(configFile) { + Log.Infof("Reading config file: %v", configFile) + err = Read(configFile) + if err != nil { + logFatal(err) + } + } else { + Log.Infof("Define config file to be taken into account: %v", configFile) + } + if err = setLogLevel(); err != nil { + logFatal(err) + } +} + +// Read a config file and update configuration object +func Read(configFile string) error { + r, err := os.Open(configFile) + if err != nil { + return err + } + d := toml.NewDecoder(r) + d.SetStrict(true) + err = d.Decode(Instance) + return err +} + +func setLogLevel() error { + err := logConfig.Level.UnmarshalText([]byte(Instance.LogLevel)) + if err == nil { + Instance.LogLevel = logConfig.Level.String() + } else { + Instance.LogLevel = defaultValues().LogLevel + } + return err +} + +func fileExists(filename string) bool { + info, err := os.Stat(filename) + if os.IsNotExist(err) { + return false + } + return !info.IsDir() +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/structure.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/structure.go new file mode 100644 index 000000000..dfbf73f64 --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/config/structure.go @@ -0,0 +1,73 @@ +/* +Copyright 2021 The Knative 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 config + +import ( + "time" +) + +// ReceiverTeardownConfig holds config receiver teardown +type ReceiverTeardownConfig struct { + Duration time.Duration +} + +// ReceiverProgressConfig holds config receiver progress reporting +type ReceiverProgressConfig struct { + Duration time.Duration +} + +// ReceiverErrorConfig holds error reporting config of the receiver +type ReceiverErrorConfig struct { + UnavailablePeriodToReport time.Duration +} + +// ReceiverConfig hold configuration for receiver +type ReceiverConfig struct { + Teardown ReceiverTeardownConfig + Progress ReceiverProgressConfig + Errors ReceiverErrorConfig + Port int +} + +// SenderConfig hold configuration for sender +type SenderConfig struct { + Address interface{} + Interval time.Duration +} + +// ForwarderConfig holds configuration for forwarder +type ForwarderConfig struct { + Target string + Port int +} + +// ReadinessConfig holds a readiness configuration +type ReadinessConfig struct { + Enabled bool + URI string + Message string + Status int +} + +// Config hold complete configuration +type Config struct { + Sender SenderConfig + Forwarder ForwarderConfig + Receiver ReceiverConfig + Readiness ReadinessConfig + LogLevel string +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/operations.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/operations.go new file mode 100644 index 000000000..c2887a39f --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/operations.go @@ -0,0 +1,38 @@ +/* + * Copyright 2020 The Knative 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 event + +// StepsStore contains methods that register step event type +type StepsStore interface { + RegisterStep(step *Step) + Count() int +} + +// FinishedStore registers a finished event type +type FinishedStore interface { + RegisterFinished(finished *Finished) + TotalRequests() int + State() State + DuplicatedThrown() []string + MissingThrown() []string + UnexpectedThrown() []string + UnavailableThrown() []string +} + +// Typed says a type of an event +type Typed interface { + Type() string +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/services.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/services.go new file mode 100644 index 000000000..9e805e6b0 --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/services.go @@ -0,0 +1,225 @@ +/* + * Copyright 2020 The Knative 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 event + +import ( + "fmt" + "sync" + "time" + + "knative.dev/eventing/test/upgrade/prober/wathola/config" +) + +var mutex = sync.RWMutex{} +var lastProgressReport = time.Now() + +type thrownTypes struct { + missing []thrown + duplicated []thrown + unexpected []thrown + unavailable []thrown +} + +// ErrorStore contains errors that was thrown +type ErrorStore struct { + state State + thrown thrownTypes +} + +// NewErrorStore creates a new error store +func NewErrorStore() *ErrorStore { + return &ErrorStore{ + state: Active, + thrown: thrownTypes{ + missing: make([]thrown, 0), + duplicated: make([]thrown, 0), + unexpected: make([]thrown, 0), + unavailable: make([]thrown, 0), + }, + } +} + +// NewStepsStore creates StepsStore +func NewStepsStore(errors *ErrorStore) StepsStore { + return &stepStore{ + store: make(map[int]int), + errors: errors, + } +} + +// NewFinishedStore creates FinishedStore +func NewFinishedStore(steps StepsStore, errors *ErrorStore) FinishedStore { + return &finishedStore{ + received: 0, + eventsSent: -1, + totalRequests: 0, + steps: steps, + errors: errors, + } +} + +func (s *stepStore) RegisterStep(step *Step) { + mutex.Lock() + if times, found := s.store[step.Number]; found { + s.errors.throwDuplicated( + "event #%d received %d times, but should be received only once", + step.Number, times+1) + } else { + s.store[step.Number] = 0 + } + s.store[step.Number]++ + mutex.Unlock() + log.Debugf("event #%d received", step.Number) + s.reportProgress() +} + +func (s *stepStore) Count() int { + return len(s.store) +} + +func (f *finishedStore) RegisterFinished(finished *Finished) { + if f.received > 0 { + f.errors.throwDuplicated( + "finish event should be received only once, received %d", + f.received+1) + } + f.received++ + f.eventsSent = finished.EventsSent + f.totalRequests = finished.TotalRequests + log.Infof("finish event received, expecting %d event ware propagated", finished.EventsSent) + d := config.Instance.Receiver.Teardown.Duration + log.Infof("waiting additional %v to be sure all events came", d) + time.Sleep(d) + receivedEvents := f.steps.Count() + if receivedEvents != finished.EventsSent { + f.errors.throwUnexpected("expecting to have %v unique events received, "+ + "but received %v unique events", finished.EventsSent, receivedEvents) + f.reportViolations(finished) + f.errors.state = Failed + } else { + log.Infof("properly received %d unique events", receivedEvents) + f.errors.state = Success + } + // check down time + for _, unavailablePeriod := range finished.UnavailablePeriods { + if unavailablePeriod > config.Instance.Receiver.Errors.UnavailablePeriodToReport { + f.errors.throwUnavail("actual unavailable period %v is over down time limit of %v", unavailablePeriod, config.Instance.Receiver.Errors.UnavailablePeriodToReport) + f.errors.state = Failed + } + log.Infof("detecting unavailable time %v", unavailablePeriod) + } +} + +func (f *finishedStore) TotalRequests() int { + return f.totalRequests +} + +func (f *finishedStore) State() State { + return f.errors.state +} + +func (f *finishedStore) DuplicatedThrown() []string { + return asStrings(f.errors.thrown.duplicated) +} + +func (f *finishedStore) MissingThrown() []string { + return asStrings(f.errors.thrown.missing) +} + +func (f *finishedStore) UnexpectedThrown() []string { + return asStrings(f.errors.thrown.unexpected) +} + +func (f *finishedStore) UnavailableThrown() []string { + return asStrings(f.errors.thrown.unavailable) +} + +func asStrings(errThrown []thrown) []string { + msgs := make([]string, 0) + for _, t := range errThrown { + errMsg := fmt.Sprintf(t.format, t.args...) + msgs = append(msgs, errMsg) + } + return msgs +} + +func (f *finishedStore) reportViolations(finished *Finished) { + steps := f.steps.(*stepStore) + for eventNo := 1; eventNo <= finished.EventsSent; eventNo++ { + times, ok := steps.store[eventNo] + if !ok { + times = 0 + } + if times != 1 { + throwMethod := f.errors.throwMissing + if times > 1 { + throwMethod = f.errors.throwDuplicated + } + throwMethod("event #%v should be received once, but was received %v times", + eventNo, times) + } + } +} + +func (s *stepStore) reportProgress() { + if lastProgressReport.Add(config.Instance.Receiver.Progress.Duration).Before(time.Now()) { + lastProgressReport = time.Now() + log.Infof("collected %v unique events", s.Count()) + } +} + +func (e *ErrorStore) throwDuplicated(format string, args ...interface{}) { + e.thrown.duplicated = e.appendThrown(e.thrown.duplicated, format, args...) +} + +func (e *ErrorStore) throwMissing(format string, args ...interface{}) { + e.thrown.missing = e.appendThrown(e.thrown.missing, format, args...) +} + +func (e *ErrorStore) throwUnexpected(format string, args ...interface{}) { + e.thrown.unexpected = e.appendThrown(e.thrown.unexpected, format, args...) +} + +func (e *ErrorStore) throwUnavail(format string, args ...interface{}) { + e.thrown.unavailable = e.appendThrown(e.thrown.unavailable, format, args...) +} + +func (e *ErrorStore) appendThrown(errThrown []thrown, format string, args ...interface{}) []thrown { + t := thrown{ + format: format, + args: args, + } + log.Errorf(t.format, t.args...) + return append(errThrown, t) +} + +type stepStore struct { + store map[int]int + errors *ErrorStore +} + +type finishedStore struct { + received int + eventsSent int + totalRequests int + errors *ErrorStore + steps StepsStore +} + +type thrown struct { + format string + args []interface{} +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/types.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/types.go new file mode 100644 index 000000000..2a7fe264b --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/event/types.go @@ -0,0 +1,65 @@ +/* + * Copyright 2020 The Knative 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 event + +import ( + "time" + + "knative.dev/eventing/test/upgrade/prober/wathola/config" +) + +const ( + // StepType is a string type representation of step event + StepType = "dev.knative.eventing.wathola.step" + // FinishedType os a string type representation of finished event + FinishedType = "dev.knative.eventing.wathola.finished" +) + +// Step is a event call at each step of verification +type Step struct { + Number int +} + +// Finished is step call after verification finishes +type Finished struct { + EventsSent int + TotalRequests int + UnavailablePeriods []time.Duration +} + +// Type returns a type of a event +func (s Step) Type() string { + return StepType +} + +// Type returns a type of a event +func (f Finished) Type() string { + return FinishedType +} + +// State defines a state of event store +type State int + +const ( + // Active == 1 (iota has been reset) + Active State = 1 << iota + // Success == 2 + Success State = 1 << iota + // Failed == 4 + Failed State = 1 << iota +) + +var log = config.Log diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/forwarder/operations.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/forwarder/operations.go new file mode 100644 index 000000000..4ee037fde --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/forwarder/operations.go @@ -0,0 +1,21 @@ +/* + * Copyright 2020 The Knative 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 forwarder + +// Forwarder perform waiting and receiving of events and forwarding them to other place +type Forwarder interface { + Forward() +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/forwarder/services.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/forwarder/services.go new file mode 100644 index 000000000..97f47f82a --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/forwarder/services.go @@ -0,0 +1,69 @@ +/* + * Copyright 2020 The Knative 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 forwarder + +import ( + "context" + + cloudevents "github.com/cloudevents/sdk-go/v2" + "knative.dev/eventing/test/upgrade/prober/wathola/client" + "knative.dev/eventing/test/upgrade/prober/wathola/config" + "knative.dev/eventing/test/upgrade/prober/wathola/sender" + + "time" +) + +var ( + log = config.Log + lastProgressReport = time.Now() + Canceling = make(chan context.CancelFunc, 1) +) + +// New creates new forwarder +func New() Forwarder { + config.ReadIfPresent() + f := &forwarder{ + count: 0, + } + return f +} + +func (f *forwarder) Forward() { + port := config.Instance.Forwarder.Port + client.Receive(port, Canceling, f.forwardEvent) +} + +func (f *forwarder) forwardEvent(e cloudevents.Event) { + target := config.Instance.Forwarder.Target + log.Debugf("Forwarding event %v to %v", e.ID(), target) + err := sender.SendEvent(e, target) + if err != nil { + log.Error(err) + } + f.count++ + f.reportProgress() +} + +func (f *forwarder) reportProgress() { + if lastProgressReport.Add(config.Instance.Receiver.Progress.Duration).Before(time.Now()) { + lastProgressReport = time.Now() + log.Infof("forwarded %v events", f.count) + } +} + +type forwarder struct { + count int +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/operations.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/operations.go new file mode 100644 index 000000000..1594de5d4 --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/operations.go @@ -0,0 +1,54 @@ +/* + * Copyright 2020 The Knative 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 sender + +import ( + "math/rand" + "time" + + "knative.dev/eventing/test/upgrade/prober/wathola/config" +) + +// New creates new Sender +func New() Sender { + config.ReadIfPresent() + return &sender{ + eventsSent: 0, + } +} + +// NewEventID creates new event ID +func NewEventID() string { + return randString(16) +} + +const charset = "abcdefghijklmnopqrstuvwxyz" + + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + +var seededRand = rand.New( + rand.NewSource(time.Now().UnixNano())) + +func randStringWithCharset(length int, charset string) string { + b := make([]byte, length) + for i := range b { + b[i] = charset[seededRand.Intn(len(charset))] + } + return string(b) +} + +func randString(length int) string { + return randStringWithCharset(length, charset) +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/services.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/services.go new file mode 100644 index 000000000..89a5ed70a --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/services.go @@ -0,0 +1,195 @@ +/* +Copyright 2021 The Knative 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 sender + +import ( + "context" + "errors" + "fmt" + "strings" + + cloudevents "github.com/cloudevents/sdk-go/v2" + "github.com/wavesoftware/go-ensure" + "knative.dev/eventing/test/upgrade/prober/wathola/config" + "knative.dev/eventing/test/upgrade/prober/wathola/event" + + "os" + "os/signal" + "syscall" + "time" +) + +var ( + // ErrEndpointTypeNotSupported is raised if configured endpoint isn't + // supported by any of the event senders that are registered. + ErrEndpointTypeNotSupported = errors.New("given endpoint isn't " + + "supported by any registered event sender") + log = config.Log + senderConfig = &config.Instance.Sender + eventSenders = make([]EventSender, 0, 1) +) + +type sender struct { + // eventsSent is the number of events successfully sent + eventsSent int + // totalRequests is the number of all the send event requests + totalRequests int + // unavailablePeriods is an array for non-zero retries for each event + unavailablePeriods []time.Duration +} + +func (s *sender) SendContinually() { + var shutdownCh = make(chan struct{}) + defer s.sendFinished() + + go func() { + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGINT, syscall.SIGTERM) + sig := <-c + // sig is a ^C or term, handle it + log.Infof("%v signal received, closing", sig.String()) + close(shutdownCh) + }() + + var start time.Time + retry := 0 + for { + select { + case <-shutdownCh: + // If there is ongoing event transition, we need to push to retries too. + if retry != 0 { + s.unavailablePeriods = append(s.unavailablePeriods, time.Since(start)) + } + return + default: + } + err := s.sendStep() + if err != nil { + if retry == 0 { + start = time.Now() + } + log.Warnf("Could not send step event %v, retrying (%d)", + s.eventsSent, retry) + log.Debug("Error: ", err) + retry++ + } else { + if retry != 0 { + s.unavailablePeriods = append(s.unavailablePeriods, time.Since(start)) + log.Warnf("Event sent after %v retries", retry) + retry = 0 + } + time.Sleep(senderConfig.Interval) + } + } +} + +// NewCloudEvent creates a new cloud event +func NewCloudEvent(data interface{}, typ string) cloudevents.Event { + e := cloudevents.NewEvent() + e.SetDataContentType("application/json") + e.SetType(typ) + host, err := os.Hostname() + ensure.NoError(err) + e.SetSource(fmt.Sprintf("knative://%s/wathola/sender", host)) + e.SetID(NewEventID()) + e.SetTime(time.Now().UTC()) + err = e.SetData(cloudevents.ApplicationJSON, data) + ensure.NoError(err) + errs := e.Validate() + if errs != nil { + ensure.NoError(errs) + } + return e +} + +// ResetEventSenders will reset configured event senders to defaults. +func ResetEventSenders() { + eventSenders = make([]EventSender, 0, 1) +} + +// RegisterEventSender will register a EventSender to be used. +func RegisterEventSender(es EventSender) { + eventSenders = append(eventSenders, es) +} + +// SendEvent will send cloud event to given url +func SendEvent(ce cloudevents.Event, endpoint interface{}) error { + senders := make([]EventSender, 0, len(eventSenders)+1) + senders = append(senders, eventSenders...) + if len(senders) == 0 { + senders = append(senders, httpSender{}) + } + for _, eventSender := range senders { + if eventSender.Supports(endpoint) { + return eventSender.SendEvent(ce, endpoint) + } + } + return fmt.Errorf("%w: endpoint is %#v", ErrEndpointTypeNotSupported, endpoint) +} + +type httpSender struct{} + +func (h httpSender) Supports(endpoint interface{}) bool { + switch url := endpoint.(type) { + default: + return false + case string: + return strings.HasPrefix(url, "http://") || + strings.HasPrefix(url, "https://") + } +} + +func (h httpSender) SendEvent(ce cloudevents.Event, endpoint interface{}) error { + url := endpoint.(string) + c, err := cloudevents.NewClientHTTP() + if err != nil { + return err + } + ctx := cloudevents.ContextWithTarget(context.Background(), url) + + result := c.Send(ctx, ce) + if cloudevents.IsACK(result) { + return nil + } + return result +} + +func (s *sender) sendStep() error { + step := event.Step{Number: s.eventsSent + 1} + ce := NewCloudEvent(step, event.StepType) + endpoint := senderConfig.Address + log.Infof("Sending step event #%v to %#v", step.Number, endpoint) + err := SendEvent(ce, endpoint) + // Record every request regardless of the result + s.totalRequests++ + if err != nil { + return err + } + s.eventsSent++ + return nil +} + +func (s *sender) sendFinished() { + if s.eventsSent == 0 { + return + } + finished := event.Finished{EventsSent: s.eventsSent, TotalRequests: s.totalRequests, UnavailablePeriods: s.unavailablePeriods} + endpoint := senderConfig.Address + ce := NewCloudEvent(finished, event.FinishedType) + log.Infof("Sending finished event (count: %v) to %#v", finished.EventsSent, endpoint) + ensure.NoError(SendEvent(ce, endpoint)) +} diff --git a/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/types.go b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/types.go new file mode 100644 index 000000000..26bafd473 --- /dev/null +++ b/vendor/knative.dev/eventing/test/upgrade/prober/wathola/sender/types.go @@ -0,0 +1,33 @@ +/* +Copyright 2021 The Knative 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 sender + +import cloudevents "github.com/cloudevents/sdk-go/v2" + +// Sender will send messages continuously until process receives a SIGINT +type Sender interface { + SendContinually() +} + +// EventSender will be used to send events to configured endpoint. +type EventSender interface { + // Supports will check given endpoint definition and decide if it's valid for + // this sender. + Supports(endpoint interface{}) bool + // SendEvent will send event to given endpoint. + SendEvent(ce cloudevents.Event, endpoint interface{}) error +} diff --git a/vendor/knative.dev/hack/library.sh b/vendor/knative.dev/hack/library.sh index 0d52ad68e..4af73bec5 100644 --- a/vendor/knative.dev/hack/library.sh +++ b/vendor/knative.dev/hack/library.sh @@ -771,6 +771,7 @@ function current_branch() { # Get the branch name from Prow's env var, see https://github.com/kubernetes/test-infra/blob/master/prow/jobs.md. # Otherwise, try getting the current branch from git. (( IS_PROW )) && branch_name="${PULL_BASE_REF:-}" + [[ -z "${branch_name}" ]] && branch_name="${GITHUB_BASE_REF:-}" [[ -z "${branch_name}" ]] && branch_name="$(git rev-parse --abbrev-ref HEAD)" echo "${branch_name}" } @@ -835,30 +836,56 @@ function shellcheck_new_files() { fi } +# Note: if using Github checkout action please ensure you fetch all tags prior to calling +# this function +# +# ie. +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# +# See: https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches function latest_version() { local branch_name="$(current_branch)" - if [ "$branch_name" = "master" ] || [ "$branch_name" = "main" ]; then - # For main branch, simply use git tag without major version, this will work even - # if the release tag is not in the main + # Use the latest release for main + if [[ "$branch_name" == "main" ]] || [[ "$branch_name" == "master" ]]; then git tag -l "*$(git tag -l "*v[0-9]*" | cut -d '-' -f2 | sort -r --version-sort | head -n1)*" + return + fi + + # Ideally we shouldn't need to treat release branches differently but + # there are scenarios where git describe will return newer tags than + # the ones on the current branch + # + # ie. create a PR pulling commits from 0.24 into a release-0.23 branch + if [[ "$branch_name" == "release-"* ]]; then + # Infer major, minor version from the branch name + local tag="${branch_name##release-}" else - ## Assumption here is we are on a release branch - local major_minor="${branch_name##release-}" - local major_version="$(major_version $major_minor)" - local minor_version="$(minor_version $major_minor)" + # Nearest tag with the `knative-` prefix + local tag=$(git describe --abbrev=0 --match "knative-v[0-9]*") - # Hardcode the jump back from 1.0 - if [ "$major_version" = "1" ] && [ "$minor_version" == 0 ]; then - local tag='v0.26*' - else - # Adjust the minor down by one - local tag="*v$major_version.$(( minor_version - 1 ))*" - fi + # Fallback to older tag scheme vX.Y.Z + [[ -z "${tag}" ]] && tag=$(git describe --abbrev=0 --match "v[0-9]*") + + # Drop the prefix + tag="${tag##knative-}" + fi - # Get the latest patch release for the major minor - git tag -l "${tag}*" | sort -r --version-sort | head -n1 + local major_version="$(major_version ${tag})" + local minor_version="$(minor_version ${tag})" + + # Hardcode the jump back from 1.0 + if [ "$major_version" = "1" ] && [ "$minor_version" = "0" ]; then + local tag_filter='v0.26*' + else + # Adjust the minor down by one + local tag_filter="*v$major_version.$(( minor_version - 1 ))*" fi + + # Get the latest patch release for the major minor + git tag -l "${tag_filter}" | sort -r --version-sort | head -n1 } # Initializations that depend on previous functions. diff --git a/vendor/knative.dev/hack/release.sh b/vendor/knative.dev/hack/release.sh index 25284371c..5e11e87fa 100644 --- a/vendor/knative.dev/hack/release.sh +++ b/vendor/knative.dev/hack/release.sh @@ -606,8 +606,6 @@ function publish_to_github() { if [[ -n "${RELEASE_NOTES}" ]]; then cat "${RELEASE_NOTES}" >> "${description}" fi - git tag -a "${github_tag}" -m "${title}" - git_push tag "${github_tag}" # Include a tag for the go module version # @@ -621,8 +619,14 @@ function publish_to_github() { local go_module_version="v0.$(( release_minor + 27 )).$(patch_version $TAG)" git tag -a "${go_module_version}" -m "${title}" git_push tag "${go_module_version}" + else + # Pre-1.0 - use the tag as the release tag + github_tag="${TAG}" fi + git tag -a "${github_tag}" -m "${title}" + git_push tag "${github_tag}" + [[ -n "${RELEASE_BRANCH}" ]] && commitish="--commitish=${RELEASE_BRANCH}" for i in {2..0}; do hub_tool release create \ diff --git a/vendor/knative.dev/networking/pkg/network.go b/vendor/knative.dev/networking/pkg/network.go index aba0902ef..20f093984 100644 --- a/vendor/knative.dev/networking/pkg/network.go +++ b/vendor/knative.dev/networking/pkg/network.go @@ -594,13 +594,13 @@ func asMode(key string, target *MeshCompatibilityMode) cm.ParseFunc { // asLabelSelector returns a LabelSelector extracted from a given configmap key. func asLabelSelector(key string, target **metav1.LabelSelector) cm.ParseFunc { return func(data map[string]string) error { + *target = nil if raw, ok := data[key]; ok { if len(raw) > 0 { - var selector *metav1.LabelSelector - if err := yaml.Unmarshal([]byte(raw), &selector); err != nil { + *target = &metav1.LabelSelector{} + if err := yaml.Unmarshal([]byte(raw), *target); err != nil { return err } - *target = selector } } return nil diff --git a/vendor/knative.dev/pkg/client/injection/kube/client/client.go b/vendor/knative.dev/pkg/client/injection/kube/client/client.go new file mode 100644 index 000000000..c02352056 --- /dev/null +++ b/vendor/knative.dev/pkg/client/injection/kube/client/client.go @@ -0,0 +1,14372 @@ +/* +Copyright 2021 The Knative 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. +*/ + +// Code generated by injection-gen. DO NOT EDIT. + +package client + +import ( + context "context" + json "encoding/json" + errors "errors" + fmt "fmt" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + apiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" + apiappsv1 "k8s.io/api/apps/v1" + apiappsv1beta1 "k8s.io/api/apps/v1beta1" + appsv1beta2 "k8s.io/api/apps/v1beta2" + authenticationv1 "k8s.io/api/authentication/v1" + authenticationv1beta1 "k8s.io/api/authentication/v1beta1" + authorizationv1 "k8s.io/api/authorization/v1" + authorizationv1beta1 "k8s.io/api/authorization/v1beta1" + autoscalingv1 "k8s.io/api/autoscaling/v1" + autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + apibatchv1 "k8s.io/api/batch/v1" + apibatchv1beta1 "k8s.io/api/batch/v1beta1" + apicertificatesv1 "k8s.io/api/certificates/v1" + apicertificatesv1beta1 "k8s.io/api/certificates/v1beta1" + apicoordinationv1 "k8s.io/api/coordination/v1" + apicoordinationv1beta1 "k8s.io/api/coordination/v1beta1" + apicorev1 "k8s.io/api/core/v1" + apidiscoveryv1 "k8s.io/api/discovery/v1" + apidiscoveryv1beta1 "k8s.io/api/discovery/v1beta1" + apieventsv1 "k8s.io/api/events/v1" + apieventsv1beta1 "k8s.io/api/events/v1beta1" + apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" + apiflowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + apinetworkingv1 "k8s.io/api/networking/v1" + apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" + apinodev1 "k8s.io/api/node/v1" + apinodev1alpha1 "k8s.io/api/node/v1alpha1" + apinodev1beta1 "k8s.io/api/node/v1beta1" + apipolicyv1 "k8s.io/api/policy/v1" + apipolicyv1beta1 "k8s.io/api/policy/v1beta1" + apirbacv1 "k8s.io/api/rbac/v1" + apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" + apirbacv1beta1 "k8s.io/api/rbac/v1beta1" + apischedulingv1 "k8s.io/api/scheduling/v1" + apischedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + apischedulingv1beta1 "k8s.io/api/scheduling/v1beta1" + apistoragev1 "k8s.io/api/storage/v1" + apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" + apistoragev1beta1 "k8s.io/api/storage/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" + v1beta1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1" + v1alpha1 "k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1" + appsv1 "k8s.io/client-go/applyconfigurations/apps/v1" + appsv1beta1 "k8s.io/client-go/applyconfigurations/apps/v1beta1" + v1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" + applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" + v2beta1 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta1" + v2beta2 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta2" + batchv1 "k8s.io/client-go/applyconfigurations/batch/v1" + batchv1beta1 "k8s.io/client-go/applyconfigurations/batch/v1beta1" + certificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1" + certificatesv1beta1 "k8s.io/client-go/applyconfigurations/certificates/v1beta1" + coordinationv1 "k8s.io/client-go/applyconfigurations/coordination/v1" + coordinationv1beta1 "k8s.io/client-go/applyconfigurations/coordination/v1beta1" + corev1 "k8s.io/client-go/applyconfigurations/core/v1" + discoveryv1 "k8s.io/client-go/applyconfigurations/discovery/v1" + discoveryv1beta1 "k8s.io/client-go/applyconfigurations/discovery/v1beta1" + eventsv1 "k8s.io/client-go/applyconfigurations/events/v1" + eventsv1beta1 "k8s.io/client-go/applyconfigurations/events/v1beta1" + extensionsv1beta1 "k8s.io/client-go/applyconfigurations/extensions/v1beta1" + flowcontrolv1alpha1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1" + flowcontrolv1beta1 "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1" + networkingv1 "k8s.io/client-go/applyconfigurations/networking/v1" + networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1" + nodev1 "k8s.io/client-go/applyconfigurations/node/v1" + nodev1alpha1 "k8s.io/client-go/applyconfigurations/node/v1alpha1" + nodev1beta1 "k8s.io/client-go/applyconfigurations/node/v1beta1" + policyv1 "k8s.io/client-go/applyconfigurations/policy/v1" + policyv1beta1 "k8s.io/client-go/applyconfigurations/policy/v1beta1" + rbacv1 "k8s.io/client-go/applyconfigurations/rbac/v1" + rbacv1alpha1 "k8s.io/client-go/applyconfigurations/rbac/v1alpha1" + rbacv1beta1 "k8s.io/client-go/applyconfigurations/rbac/v1beta1" + schedulingv1 "k8s.io/client-go/applyconfigurations/scheduling/v1" + schedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" + schedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" + storagev1 "k8s.io/client-go/applyconfigurations/storage/v1" + storagev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" + storagev1beta1 "k8s.io/client-go/applyconfigurations/storage/v1beta1" + discovery "k8s.io/client-go/discovery" + dynamic "k8s.io/client-go/dynamic" + kubernetes "k8s.io/client-go/kubernetes" + typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1" + typedadmissionregistrationv1beta1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1" + typedinternalv1alpha1 "k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1" + typedappsv1 "k8s.io/client-go/kubernetes/typed/apps/v1" + typedappsv1beta1 "k8s.io/client-go/kubernetes/typed/apps/v1beta1" + typedappsv1beta2 "k8s.io/client-go/kubernetes/typed/apps/v1beta2" + typedauthenticationv1 "k8s.io/client-go/kubernetes/typed/authentication/v1" + typedauthenticationv1beta1 "k8s.io/client-go/kubernetes/typed/authentication/v1beta1" + typedauthorizationv1 "k8s.io/client-go/kubernetes/typed/authorization/v1" + typedauthorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1" + typedautoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1" + typedautoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" + typedautoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" + typedbatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" + typedbatchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" + typedcertificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" + typedcertificatesv1beta1 "k8s.io/client-go/kubernetes/typed/certificates/v1beta1" + typedcoordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1" + typedcoordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1" + typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1" + typeddiscoveryv1 "k8s.io/client-go/kubernetes/typed/discovery/v1" + typeddiscoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" + typedeventsv1 "k8s.io/client-go/kubernetes/typed/events/v1" + typedeventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1" + typedextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" + typedflowcontrolv1alpha1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1" + typedflowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1" + typednetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1" + typednetworkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1" + typednodev1 "k8s.io/client-go/kubernetes/typed/node/v1" + typednodev1alpha1 "k8s.io/client-go/kubernetes/typed/node/v1alpha1" + typednodev1beta1 "k8s.io/client-go/kubernetes/typed/node/v1beta1" + typedpolicyv1 "k8s.io/client-go/kubernetes/typed/policy/v1" + typedpolicyv1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1" + typedrbacv1 "k8s.io/client-go/kubernetes/typed/rbac/v1" + typedrbacv1alpha1 "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1" + typedrbacv1beta1 "k8s.io/client-go/kubernetes/typed/rbac/v1beta1" + typedschedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" + typedschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" + typedschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" + typedstoragev1 "k8s.io/client-go/kubernetes/typed/storage/v1" + typedstoragev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" + typedstoragev1beta1 "k8s.io/client-go/kubernetes/typed/storage/v1beta1" + rest "k8s.io/client-go/rest" + injection "knative.dev/pkg/injection" + dynamicclient "knative.dev/pkg/injection/clients/dynamicclient" + logging "knative.dev/pkg/logging" +) + +func init() { + injection.Default.RegisterClient(withClientFromConfig) + injection.Default.RegisterClientFetcher(func(ctx context.Context) interface{} { + return Get(ctx) + }) + injection.Dynamic.RegisterDynamicClient(withClientFromDynamic) +} + +// Key is used as the key for associating information with a context.Context. +type Key struct{} + +func withClientFromConfig(ctx context.Context, cfg *rest.Config) context.Context { + return context.WithValue(ctx, Key{}, kubernetes.NewForConfigOrDie(cfg)) +} + +func withClientFromDynamic(ctx context.Context) context.Context { + return context.WithValue(ctx, Key{}, &wrapClient{dyn: dynamicclient.Get(ctx)}) +} + +// Get extracts the kubernetes.Interface client from the context. +func Get(ctx context.Context) kubernetes.Interface { + untyped := ctx.Value(Key{}) + if untyped == nil { + if injection.GetConfig(ctx) == nil { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/kubernetes.Interface from context. This context is not the application context (which is typically given to constructors via sharedmain).") + } else { + logging.FromContext(ctx).Panic( + "Unable to fetch k8s.io/client-go/kubernetes.Interface from context.") + } + } + return untyped.(kubernetes.Interface) +} + +type wrapClient struct { + dyn dynamic.Interface +} + +var _ kubernetes.Interface = (*wrapClient)(nil) + +func (w *wrapClient) Discovery() discovery.DiscoveryInterface { + panic("Discovery called on dynamic client!") +} + +func convert(from interface{}, to runtime.Object) error { + bs, err := json.Marshal(from) + if err != nil { + return fmt.Errorf("Marshal() = %w", err) + } + if err := json.Unmarshal(bs, to); err != nil { + return fmt.Errorf("Unmarshal() = %w", err) + } + return nil +} + +// AdmissionregistrationV1 retrieves the AdmissionregistrationV1Client +func (w *wrapClient) AdmissionregistrationV1() typedadmissionregistrationv1.AdmissionregistrationV1Interface { + return &wrapAdmissionregistrationV1{ + dyn: w.dyn, + } +} + +type wrapAdmissionregistrationV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAdmissionregistrationV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAdmissionregistrationV1) MutatingWebhookConfigurations() typedadmissionregistrationv1.MutatingWebhookConfigurationInterface { + return &wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Resource: "mutatingwebhookconfigurations", + }), + } +} + +type wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedadmissionregistrationv1.MutatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl)(nil) + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.MutatingWebhookConfiguration, err error) { + panic("NYI") +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.MutatingWebhookConfiguration, err error) { + panic("NYI") +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1.MutatingWebhookConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.MutatingWebhookConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1.MutatingWebhookConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Update(ctx context.Context, in *admissionregistrationv1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *admissionregistrationv1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1MutatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAdmissionregistrationV1) ValidatingWebhookConfigurations() typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface { + return &wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Resource: "validatingwebhookconfigurations", + }), + } +} + +type wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedadmissionregistrationv1.ValidatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl)(nil) + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.ValidatingWebhookConfiguration, err error) { + panic("NYI") +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.ValidatingWebhookConfiguration, err error) { + panic("NYI") +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1.ValidatingWebhookConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.ValidatingWebhookConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1.ValidatingWebhookConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Update(ctx context.Context, in *admissionregistrationv1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *admissionregistrationv1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1ValidatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AdmissionregistrationV1beta1 retrieves the AdmissionregistrationV1beta1Client +func (w *wrapClient) AdmissionregistrationV1beta1() typedadmissionregistrationv1beta1.AdmissionregistrationV1beta1Interface { + return &wrapAdmissionregistrationV1beta1{ + dyn: w.dyn, + } +} + +type wrapAdmissionregistrationV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAdmissionregistrationV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAdmissionregistrationV1beta1) MutatingWebhookConfigurations() typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface { + return &wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Resource: "mutatingwebhookconfigurations", + }), + } +} + +type wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedadmissionregistrationv1beta1.MutatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl)(nil) + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1beta1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { + panic("NYI") +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1beta1.MutatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { + panic("NYI") +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1beta1.MutatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1beta1.MutatingWebhookConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.MutatingWebhookConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1beta1.MutatingWebhookConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Update(ctx context.Context, in *admissionregistrationv1beta1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *admissionregistrationv1beta1.MutatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1beta1.MutatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "MutatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.MutatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1MutatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAdmissionregistrationV1beta1) ValidatingWebhookConfigurations() typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface { + return &wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Resource: "validatingwebhookconfigurations", + }), + } +} + +type wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedadmissionregistrationv1beta1.ValidatingWebhookConfigurationInterface = (*wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl)(nil) + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Apply(ctx context.Context, in *v1beta1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { + panic("NYI") +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) ApplyStatus(ctx context.Context, in *v1beta1.ValidatingWebhookConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { + panic("NYI") +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Create(ctx context.Context, in *admissionregistrationv1beta1.ValidatingWebhookConfiguration, opts metav1.CreateOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.ValidatingWebhookConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1beta1.ValidatingWebhookConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Update(ctx context.Context, in *admissionregistrationv1beta1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) UpdateStatus(ctx context.Context, in *admissionregistrationv1beta1.ValidatingWebhookConfiguration, opts metav1.UpdateOptions) (*admissionregistrationv1beta1.ValidatingWebhookConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "admissionregistration.k8s.io", + Version: "v1beta1", + Kind: "ValidatingWebhookConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &admissionregistrationv1beta1.ValidatingWebhookConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAdmissionregistrationV1beta1ValidatingWebhookConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// InternalV1alpha1 retrieves the InternalV1alpha1Client +func (w *wrapClient) InternalV1alpha1() typedinternalv1alpha1.InternalV1alpha1Interface { + return &wrapInternalV1alpha1{ + dyn: w.dyn, + } +} + +type wrapInternalV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapInternalV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapInternalV1alpha1) StorageVersions() typedinternalv1alpha1.StorageVersionInterface { + return &wrapInternalV1alpha1StorageVersionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "internal.apiserver.k8s.io", + Version: "v1alpha1", + Resource: "storageversions", + }), + } +} + +type wrapInternalV1alpha1StorageVersionImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedinternalv1alpha1.StorageVersionInterface = (*wrapInternalV1alpha1StorageVersionImpl)(nil) + +func (w *wrapInternalV1alpha1StorageVersionImpl) Apply(ctx context.Context, in *v1alpha1.StorageVersionApplyConfiguration, opts metav1.ApplyOptions) (result *apiserverinternalv1alpha1.StorageVersion, err error) { + panic("NYI") +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) ApplyStatus(ctx context.Context, in *v1alpha1.StorageVersionApplyConfiguration, opts metav1.ApplyOptions) (result *apiserverinternalv1alpha1.StorageVersion, err error) { + panic("NYI") +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Create(ctx context.Context, in *apiserverinternalv1alpha1.StorageVersion, opts metav1.CreateOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "internal.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "StorageVersion", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiserverinternalv1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiserverinternalv1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiserverinternalv1alpha1.StorageVersionList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiserverinternalv1alpha1.StorageVersionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiserverinternalv1alpha1.StorageVersion, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiserverinternalv1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Update(ctx context.Context, in *apiserverinternalv1alpha1.StorageVersion, opts metav1.UpdateOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "internal.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "StorageVersion", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiserverinternalv1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) UpdateStatus(ctx context.Context, in *apiserverinternalv1alpha1.StorageVersion, opts metav1.UpdateOptions) (*apiserverinternalv1alpha1.StorageVersion, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "internal.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "StorageVersion", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiserverinternalv1alpha1.StorageVersion{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapInternalV1alpha1StorageVersionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AppsV1 retrieves the AppsV1Client +func (w *wrapClient) AppsV1() typedappsv1.AppsV1Interface { + return &wrapAppsV1{ + dyn: w.dyn, + } +} + +type wrapAppsV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAppsV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAppsV1) ControllerRevisions(namespace string) typedappsv1.ControllerRevisionInterface { + return &wrapAppsV1ControllerRevisionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "controllerrevisions", + }), + + namespace: namespace, + } +} + +type wrapAppsV1ControllerRevisionImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.ControllerRevisionInterface = (*wrapAppsV1ControllerRevisionImpl)(nil) + +func (w *wrapAppsV1ControllerRevisionImpl) Apply(ctx context.Context, in *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ControllerRevision, err error) { + panic("NYI") +} + +func (w *wrapAppsV1ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *appsv1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ControllerRevision, err error) { + panic("NYI") +} + +func (w *wrapAppsV1ControllerRevisionImpl) Create(ctx context.Context, in *apiappsv1.ControllerRevision, opts metav1.CreateOptions) (*apiappsv1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.ControllerRevision, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.ControllerRevisionList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ControllerRevisionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.ControllerRevision, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) Update(ctx context.Context, in *apiappsv1.ControllerRevision, opts metav1.UpdateOptions) (*apiappsv1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *apiappsv1.ControllerRevision, opts metav1.UpdateOptions) (*apiappsv1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1) DaemonSets(namespace string) typedappsv1.DaemonSetInterface { + return &wrapAppsV1DaemonSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "daemonsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1DaemonSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.DaemonSetInterface = (*wrapAppsV1DaemonSetImpl)(nil) + +func (w *wrapAppsV1DaemonSetImpl) Apply(ctx context.Context, in *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.DaemonSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1DaemonSetImpl) ApplyStatus(ctx context.Context, in *appsv1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.DaemonSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1DaemonSetImpl) Create(ctx context.Context, in *apiappsv1.DaemonSet, opts metav1.CreateOptions) (*apiappsv1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.DaemonSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.DaemonSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DaemonSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.DaemonSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) Update(ctx context.Context, in *apiappsv1.DaemonSet, opts metav1.UpdateOptions) (*apiappsv1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) UpdateStatus(ctx context.Context, in *apiappsv1.DaemonSet, opts metav1.UpdateOptions) (*apiappsv1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1) Deployments(namespace string) typedappsv1.DeploymentInterface { + return &wrapAppsV1DeploymentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "deployments", + }), + + namespace: namespace, + } +} + +type wrapAppsV1DeploymentImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.DeploymentInterface = (*wrapAppsV1DeploymentImpl)(nil) + +func (w *wrapAppsV1DeploymentImpl) Apply(ctx context.Context, in *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.Deployment, err error) { + panic("NYI") +} + +func (w *wrapAppsV1DeploymentImpl) ApplyStatus(ctx context.Context, in *appsv1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.Deployment, err error) { + panic("NYI") +} + +func (w *wrapAppsV1DeploymentImpl) Create(ctx context.Context, in *apiappsv1.Deployment, opts metav1.CreateOptions) (*apiappsv1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.Deployment, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.DeploymentList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.DeploymentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.Deployment, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) Update(ctx context.Context, in *apiappsv1.Deployment, opts metav1.UpdateOptions) (*apiappsv1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) UpdateStatus(ctx context.Context, in *apiappsv1.Deployment, opts metav1.UpdateOptions) (*apiappsv1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1DeploymentImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1DeploymentImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1) ReplicaSets(namespace string) typedappsv1.ReplicaSetInterface { + return &wrapAppsV1ReplicaSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "replicasets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1ReplicaSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.ReplicaSetInterface = (*wrapAppsV1ReplicaSetImpl)(nil) + +func (w *wrapAppsV1ReplicaSetImpl) Apply(ctx context.Context, in *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ReplicaSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1ReplicaSetImpl) ApplyStatus(ctx context.Context, in *appsv1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.ReplicaSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1ReplicaSetImpl) Create(ctx context.Context, in *apiappsv1.ReplicaSet, opts metav1.CreateOptions) (*apiappsv1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.ReplicaSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.ReplicaSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ReplicaSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.ReplicaSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Update(ctx context.Context, in *apiappsv1.ReplicaSet, opts metav1.UpdateOptions) (*apiappsv1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) UpdateStatus(ctx context.Context, in *apiappsv1.ReplicaSet, opts metav1.UpdateOptions) (*apiappsv1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1ReplicaSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1ReplicaSetImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1) StatefulSets(namespace string) typedappsv1.StatefulSetInterface { + return &wrapAppsV1StatefulSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1", + Resource: "statefulsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1StatefulSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1.StatefulSetInterface = (*wrapAppsV1StatefulSetImpl)(nil) + +func (w *wrapAppsV1StatefulSetImpl) Apply(ctx context.Context, in *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.StatefulSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1StatefulSetImpl) ApplyStatus(ctx context.Context, in *appsv1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1.StatefulSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1StatefulSetImpl) Create(ctx context.Context, in *apiappsv1.StatefulSet, opts metav1.CreateOptions) (*apiappsv1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1.StatefulSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1.StatefulSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.StatefulSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1.StatefulSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) Update(ctx context.Context, in *apiappsv1.StatefulSet, opts metav1.UpdateOptions) (*apiappsv1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) UpdateStatus(ctx context.Context, in *apiappsv1.StatefulSet, opts metav1.UpdateOptions) (*apiappsv1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1StatefulSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1StatefulSetImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +// AppsV1beta1 retrieves the AppsV1beta1Client +func (w *wrapClient) AppsV1beta1() typedappsv1beta1.AppsV1beta1Interface { + return &wrapAppsV1beta1{ + dyn: w.dyn, + } +} + +type wrapAppsV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAppsV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAppsV1beta1) ControllerRevisions(namespace string) typedappsv1beta1.ControllerRevisionInterface { + return &wrapAppsV1beta1ControllerRevisionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta1", + Resource: "controllerrevisions", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta1ControllerRevisionImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta1.ControllerRevisionInterface = (*wrapAppsV1beta1ControllerRevisionImpl)(nil) + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Apply(ctx context.Context, in *appsv1beta1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.ControllerRevision, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.ControllerRevision, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Create(ctx context.Context, in *apiappsv1beta1.ControllerRevision, opts metav1.CreateOptions) (*apiappsv1beta1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1beta1.ControllerRevision, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1beta1.ControllerRevisionList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.ControllerRevisionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1beta1.ControllerRevision, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Update(ctx context.Context, in *apiappsv1beta1.ControllerRevision, opts metav1.UpdateOptions) (*apiappsv1beta1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *apiappsv1beta1.ControllerRevision, opts metav1.UpdateOptions) (*apiappsv1beta1.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta1) Deployments(namespace string) typedappsv1beta1.DeploymentInterface { + return &wrapAppsV1beta1DeploymentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta1", + Resource: "deployments", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta1DeploymentImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta1.DeploymentInterface = (*wrapAppsV1beta1DeploymentImpl)(nil) + +func (w *wrapAppsV1beta1DeploymentImpl) Apply(ctx context.Context, in *appsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.Deployment, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta1DeploymentImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.Deployment, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta1DeploymentImpl) Create(ctx context.Context, in *apiappsv1beta1.Deployment, opts metav1.CreateOptions) (*apiappsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1beta1.Deployment, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1beta1.DeploymentList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.DeploymentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1beta1.Deployment, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) Update(ctx context.Context, in *apiappsv1beta1.Deployment, opts metav1.UpdateOptions) (*apiappsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) UpdateStatus(ctx context.Context, in *apiappsv1beta1.Deployment, opts metav1.UpdateOptions) (*apiappsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta1) StatefulSets(namespace string) typedappsv1beta1.StatefulSetInterface { + return &wrapAppsV1beta1StatefulSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta1", + Resource: "statefulsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta1StatefulSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta1.StatefulSetInterface = (*wrapAppsV1beta1StatefulSetImpl)(nil) + +func (w *wrapAppsV1beta1StatefulSetImpl) Apply(ctx context.Context, in *appsv1beta1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.StatefulSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta1StatefulSetImpl) ApplyStatus(ctx context.Context, in *appsv1beta1.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiappsv1beta1.StatefulSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Create(ctx context.Context, in *apiappsv1beta1.StatefulSet, opts metav1.CreateOptions) (*apiappsv1beta1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta1StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiappsv1beta1.StatefulSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiappsv1beta1.StatefulSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.StatefulSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiappsv1beta1.StatefulSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Update(ctx context.Context, in *apiappsv1beta1.StatefulSet, opts metav1.UpdateOptions) (*apiappsv1beta1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) UpdateStatus(ctx context.Context, in *apiappsv1beta1.StatefulSet, opts metav1.UpdateOptions) (*apiappsv1beta1.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta1", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiappsv1beta1.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta1StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AppsV1beta2 retrieves the AppsV1beta2Client +func (w *wrapClient) AppsV1beta2() typedappsv1beta2.AppsV1beta2Interface { + return &wrapAppsV1beta2{ + dyn: w.dyn, + } +} + +type wrapAppsV1beta2 struct { + dyn dynamic.Interface +} + +func (w *wrapAppsV1beta2) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAppsV1beta2) ControllerRevisions(namespace string) typedappsv1beta2.ControllerRevisionInterface { + return &wrapAppsV1beta2ControllerRevisionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "controllerrevisions", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2ControllerRevisionImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.ControllerRevisionInterface = (*wrapAppsV1beta2ControllerRevisionImpl)(nil) + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Apply(ctx context.Context, in *v1beta2.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ControllerRevision, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) ApplyStatus(ctx context.Context, in *v1beta2.ControllerRevisionApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ControllerRevision, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Create(ctx context.Context, in *appsv1beta2.ControllerRevision, opts metav1.CreateOptions) (*appsv1beta2.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.ControllerRevision, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.ControllerRevisionList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ControllerRevisionList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.ControllerRevision, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Update(ctx context.Context, in *appsv1beta2.ControllerRevision, opts metav1.UpdateOptions) (*appsv1beta2.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.ControllerRevision, opts metav1.UpdateOptions) (*appsv1beta2.ControllerRevision, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ControllerRevision", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ControllerRevision{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ControllerRevisionImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2) DaemonSets(namespace string) typedappsv1beta2.DaemonSetInterface { + return &wrapAppsV1beta2DaemonSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "daemonsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2DaemonSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.DaemonSetInterface = (*wrapAppsV1beta2DaemonSetImpl)(nil) + +func (w *wrapAppsV1beta2DaemonSetImpl) Apply(ctx context.Context, in *v1beta2.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.DaemonSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2DaemonSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.DaemonSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Create(ctx context.Context, in *appsv1beta2.DaemonSet, opts metav1.CreateOptions) (*appsv1beta2.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.DaemonSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.DaemonSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DaemonSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.DaemonSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Update(ctx context.Context, in *appsv1beta2.DaemonSet, opts metav1.UpdateOptions) (*appsv1beta2.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.DaemonSet, opts metav1.UpdateOptions) (*appsv1beta2.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2) Deployments(namespace string) typedappsv1beta2.DeploymentInterface { + return &wrapAppsV1beta2DeploymentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "deployments", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2DeploymentImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.DeploymentInterface = (*wrapAppsV1beta2DeploymentImpl)(nil) + +func (w *wrapAppsV1beta2DeploymentImpl) Apply(ctx context.Context, in *v1beta2.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.Deployment, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2DeploymentImpl) ApplyStatus(ctx context.Context, in *v1beta2.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.Deployment, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2DeploymentImpl) Create(ctx context.Context, in *appsv1beta2.Deployment, opts metav1.CreateOptions) (*appsv1beta2.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.Deployment, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.DeploymentList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.DeploymentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.Deployment, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) Update(ctx context.Context, in *appsv1beta2.Deployment, opts metav1.UpdateOptions) (*appsv1beta2.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.Deployment, opts metav1.UpdateOptions) (*appsv1beta2.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2) ReplicaSets(namespace string) typedappsv1beta2.ReplicaSetInterface { + return &wrapAppsV1beta2ReplicaSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "replicasets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2ReplicaSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.ReplicaSetInterface = (*wrapAppsV1beta2ReplicaSetImpl)(nil) + +func (w *wrapAppsV1beta2ReplicaSetImpl) Apply(ctx context.Context, in *v1beta2.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ReplicaSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.ReplicaSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Create(ctx context.Context, in *appsv1beta2.ReplicaSet, opts metav1.CreateOptions) (*appsv1beta2.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.ReplicaSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.ReplicaSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ReplicaSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.ReplicaSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Update(ctx context.Context, in *appsv1beta2.ReplicaSet, opts metav1.UpdateOptions) (*appsv1beta2.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.ReplicaSet, opts metav1.UpdateOptions) (*appsv1beta2.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2) StatefulSets(namespace string) typedappsv1beta2.StatefulSetInterface { + return &wrapAppsV1beta2StatefulSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "apps", + Version: "v1beta2", + Resource: "statefulsets", + }), + + namespace: namespace, + } +} + +type wrapAppsV1beta2StatefulSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedappsv1beta2.StatefulSetInterface = (*wrapAppsV1beta2StatefulSetImpl)(nil) + +func (w *wrapAppsV1beta2StatefulSetImpl) Apply(ctx context.Context, in *v1beta2.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.StatefulSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2StatefulSetImpl) ApplyStatus(ctx context.Context, in *v1beta2.StatefulSetApplyConfiguration, opts metav1.ApplyOptions) (result *appsv1beta2.StatefulSet, err error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Create(ctx context.Context, in *appsv1beta2.StatefulSet, opts metav1.CreateOptions) (*appsv1beta2.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAppsV1beta2StatefulSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.StatefulSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*appsv1beta2.StatefulSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.StatefulSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *appsv1beta2.StatefulSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Update(ctx context.Context, in *appsv1beta2.StatefulSet, opts metav1.UpdateOptions) (*appsv1beta2.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) UpdateStatus(ctx context.Context, in *appsv1beta2.StatefulSet, opts metav1.UpdateOptions) (*appsv1beta2.StatefulSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "apps", + Version: "v1beta2", + Kind: "StatefulSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &appsv1beta2.StatefulSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAppsV1beta2StatefulSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapAppsV1beta2StatefulSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*appsv1beta2.Scale, error) { + panic("NYI") +} + +func (w *wrapAppsV1beta2StatefulSetImpl) UpdateScale(ctx context.Context, _ string, in *appsv1beta2.Scale, opts metav1.UpdateOptions) (*appsv1beta2.Scale, error) { + panic("NYI") +} + +// AuthenticationV1 retrieves the AuthenticationV1Client +func (w *wrapClient) AuthenticationV1() typedauthenticationv1.AuthenticationV1Interface { + return &wrapAuthenticationV1{ + dyn: w.dyn, + } +} + +type wrapAuthenticationV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAuthenticationV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAuthenticationV1) TokenReviews() typedauthenticationv1.TokenReviewInterface { + return &wrapAuthenticationV1TokenReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authentication.k8s.io", + Version: "v1", + Resource: "tokenreviews", + }), + } +} + +type wrapAuthenticationV1TokenReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthenticationv1.TokenReviewInterface = (*wrapAuthenticationV1TokenReviewImpl)(nil) + +func (w *wrapAuthenticationV1TokenReviewImpl) Create(ctx context.Context, in *authenticationv1.TokenReview, opts metav1.CreateOptions) (*authenticationv1.TokenReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authentication.k8s.io", + Version: "v1", + Kind: "TokenReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authenticationv1.TokenReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +// AuthenticationV1beta1 retrieves the AuthenticationV1beta1Client +func (w *wrapClient) AuthenticationV1beta1() typedauthenticationv1beta1.AuthenticationV1beta1Interface { + return &wrapAuthenticationV1beta1{ + dyn: w.dyn, + } +} + +type wrapAuthenticationV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAuthenticationV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAuthenticationV1beta1) TokenReviews() typedauthenticationv1beta1.TokenReviewInterface { + return &wrapAuthenticationV1beta1TokenReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authentication.k8s.io", + Version: "v1beta1", + Resource: "tokenreviews", + }), + } +} + +type wrapAuthenticationV1beta1TokenReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthenticationv1beta1.TokenReviewInterface = (*wrapAuthenticationV1beta1TokenReviewImpl)(nil) + +func (w *wrapAuthenticationV1beta1TokenReviewImpl) Create(ctx context.Context, in *authenticationv1beta1.TokenReview, opts metav1.CreateOptions) (*authenticationv1beta1.TokenReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authentication.k8s.io", + Version: "v1beta1", + Kind: "TokenReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authenticationv1beta1.TokenReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +// AuthorizationV1 retrieves the AuthorizationV1Client +func (w *wrapClient) AuthorizationV1() typedauthorizationv1.AuthorizationV1Interface { + return &wrapAuthorizationV1{ + dyn: w.dyn, + } +} + +type wrapAuthorizationV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAuthorizationV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAuthorizationV1) LocalSubjectAccessReviews(namespace string) typedauthorizationv1.LocalSubjectAccessReviewInterface { + return &wrapAuthorizationV1LocalSubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1", + Resource: "localsubjectaccessreviews", + }), + + namespace: namespace, + } +} + +type wrapAuthorizationV1LocalSubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedauthorizationv1.LocalSubjectAccessReviewInterface = (*wrapAuthorizationV1LocalSubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1LocalSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.LocalSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.LocalSubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1", + Kind: "LocalSubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1.LocalSubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1) SelfSubjectAccessReviews() typedauthorizationv1.SelfSubjectAccessReviewInterface { + return &wrapAuthorizationV1SelfSubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1", + Resource: "selfsubjectaccessreviews", + }), + } +} + +type wrapAuthorizationV1SelfSubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1.SelfSubjectAccessReviewInterface = (*wrapAuthorizationV1SelfSubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1SelfSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.SelfSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.SelfSubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1", + Kind: "SelfSubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1.SelfSubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1) SelfSubjectRulesReviews() typedauthorizationv1.SelfSubjectRulesReviewInterface { + return &wrapAuthorizationV1SelfSubjectRulesReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1", + Resource: "selfsubjectrulesreviews", + }), + } +} + +type wrapAuthorizationV1SelfSubjectRulesReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1.SelfSubjectRulesReviewInterface = (*wrapAuthorizationV1SelfSubjectRulesReviewImpl)(nil) + +func (w *wrapAuthorizationV1SelfSubjectRulesReviewImpl) Create(ctx context.Context, in *authorizationv1.SelfSubjectRulesReview, opts metav1.CreateOptions) (*authorizationv1.SelfSubjectRulesReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1", + Kind: "SelfSubjectRulesReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1.SelfSubjectRulesReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1) SubjectAccessReviews() typedauthorizationv1.SubjectAccessReviewInterface { + return &wrapAuthorizationV1SubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1", + Resource: "subjectaccessreviews", + }), + } +} + +type wrapAuthorizationV1SubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1.SubjectAccessReviewInterface = (*wrapAuthorizationV1SubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1SubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1.SubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1.SubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1", + Kind: "SubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1.SubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +// AuthorizationV1beta1 retrieves the AuthorizationV1beta1Client +func (w *wrapClient) AuthorizationV1beta1() typedauthorizationv1beta1.AuthorizationV1beta1Interface { + return &wrapAuthorizationV1beta1{ + dyn: w.dyn, + } +} + +type wrapAuthorizationV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAuthorizationV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAuthorizationV1beta1) LocalSubjectAccessReviews(namespace string) typedauthorizationv1beta1.LocalSubjectAccessReviewInterface { + return &wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Resource: "localsubjectaccessreviews", + }), + + namespace: namespace, + } +} + +type wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedauthorizationv1beta1.LocalSubjectAccessReviewInterface = (*wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1beta1LocalSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.LocalSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.LocalSubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Kind: "LocalSubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1beta1.LocalSubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1beta1) SelfSubjectAccessReviews() typedauthorizationv1beta1.SelfSubjectAccessReviewInterface { + return &wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Resource: "selfsubjectaccessreviews", + }), + } +} + +type wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1beta1.SelfSubjectAccessReviewInterface = (*wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1beta1SelfSubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SelfSubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.SelfSubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Kind: "SelfSubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1beta1.SelfSubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1beta1) SelfSubjectRulesReviews() typedauthorizationv1beta1.SelfSubjectRulesReviewInterface { + return &wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Resource: "selfsubjectrulesreviews", + }), + } +} + +type wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1beta1.SelfSubjectRulesReviewInterface = (*wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl)(nil) + +func (w *wrapAuthorizationV1beta1SelfSubjectRulesReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SelfSubjectRulesReview, opts metav1.CreateOptions) (*authorizationv1beta1.SelfSubjectRulesReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Kind: "SelfSubjectRulesReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1beta1.SelfSubjectRulesReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAuthorizationV1beta1) SubjectAccessReviews() typedauthorizationv1beta1.SubjectAccessReviewInterface { + return &wrapAuthorizationV1beta1SubjectAccessReviewImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Resource: "subjectaccessreviews", + }), + } +} + +type wrapAuthorizationV1beta1SubjectAccessReviewImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedauthorizationv1beta1.SubjectAccessReviewInterface = (*wrapAuthorizationV1beta1SubjectAccessReviewImpl)(nil) + +func (w *wrapAuthorizationV1beta1SubjectAccessReviewImpl) Create(ctx context.Context, in *authorizationv1beta1.SubjectAccessReview, opts metav1.CreateOptions) (*authorizationv1beta1.SubjectAccessReview, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "authorization.k8s.io", + Version: "v1beta1", + Kind: "SubjectAccessReview", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &authorizationv1beta1.SubjectAccessReview{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +// AutoscalingV1 retrieves the AutoscalingV1Client +func (w *wrapClient) AutoscalingV1() typedautoscalingv1.AutoscalingV1Interface { + return &wrapAutoscalingV1{ + dyn: w.dyn, + } +} + +type wrapAutoscalingV1 struct { + dyn dynamic.Interface +} + +func (w *wrapAutoscalingV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAutoscalingV1) HorizontalPodAutoscalers(namespace string) typedautoscalingv1.HorizontalPodAutoscalerInterface { + return &wrapAutoscalingV1HorizontalPodAutoscalerImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "autoscaling", + Version: "v1", + Resource: "horizontalpodautoscalers", + }), + + namespace: namespace, + } +} + +type wrapAutoscalingV1HorizontalPodAutoscalerImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedautoscalingv1.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV1HorizontalPodAutoscalerImpl)(nil) + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *applyconfigurationsautoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { + panic("NYI") +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *applyconfigurationsautoscalingv1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { + panic("NYI") +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*autoscalingv1.HorizontalPodAutoscalerList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscalerList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *autoscalingv1.HorizontalPodAutoscaler, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *autoscalingv1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV1HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AutoscalingV2beta1 retrieves the AutoscalingV2beta1Client +func (w *wrapClient) AutoscalingV2beta1() typedautoscalingv2beta1.AutoscalingV2beta1Interface { + return &wrapAutoscalingV2beta1{ + dyn: w.dyn, + } +} + +type wrapAutoscalingV2beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapAutoscalingV2beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAutoscalingV2beta1) HorizontalPodAutoscalers(namespace string) typedautoscalingv2beta1.HorizontalPodAutoscalerInterface { + return &wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "autoscaling", + Version: "v2beta1", + Resource: "horizontalpodautoscalers", + }), + + namespace: namespace, + } +} + +type wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedautoscalingv2beta1.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl)(nil) + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *v2beta1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) { + panic("NYI") +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *v2beta1.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) { + panic("NYI") +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv2beta1.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*autoscalingv2beta1.HorizontalPodAutoscalerList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta1.HorizontalPodAutoscalerList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *autoscalingv2beta1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *autoscalingv2beta1.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta1", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta1.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta1HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// AutoscalingV2beta2 retrieves the AutoscalingV2beta2Client +func (w *wrapClient) AutoscalingV2beta2() typedautoscalingv2beta2.AutoscalingV2beta2Interface { + return &wrapAutoscalingV2beta2{ + dyn: w.dyn, + } +} + +type wrapAutoscalingV2beta2 struct { + dyn dynamic.Interface +} + +func (w *wrapAutoscalingV2beta2) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapAutoscalingV2beta2) HorizontalPodAutoscalers(namespace string) typedautoscalingv2beta2.HorizontalPodAutoscalerInterface { + return &wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "autoscaling", + Version: "v2beta2", + Resource: "horizontalpodautoscalers", + }), + + namespace: namespace, + } +} + +type wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedautoscalingv2beta2.HorizontalPodAutoscalerInterface = (*wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl)(nil) + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Apply(ctx context.Context, in *v2beta2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) { + panic("NYI") +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) ApplyStatus(ctx context.Context, in *v2beta2.HorizontalPodAutoscalerApplyConfiguration, opts metav1.ApplyOptions) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) { + panic("NYI") +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Create(ctx context.Context, in *autoscalingv2beta2.HorizontalPodAutoscaler, opts metav1.CreateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta2", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) List(ctx context.Context, opts metav1.ListOptions) (*autoscalingv2beta2.HorizontalPodAutoscalerList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta2.HorizontalPodAutoscalerList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Update(ctx context.Context, in *autoscalingv2beta2.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta2", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) UpdateStatus(ctx context.Context, in *autoscalingv2beta2.HorizontalPodAutoscaler, opts metav1.UpdateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "autoscaling", + Version: "v2beta2", + Kind: "HorizontalPodAutoscaler", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &autoscalingv2beta2.HorizontalPodAutoscaler{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapAutoscalingV2beta2HorizontalPodAutoscalerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// BatchV1 retrieves the BatchV1Client +func (w *wrapClient) BatchV1() typedbatchv1.BatchV1Interface { + return &wrapBatchV1{ + dyn: w.dyn, + } +} + +type wrapBatchV1 struct { + dyn dynamic.Interface +} + +func (w *wrapBatchV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapBatchV1) CronJobs(namespace string) typedbatchv1.CronJobInterface { + return &wrapBatchV1CronJobImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "batch", + Version: "v1", + Resource: "cronjobs", + }), + + namespace: namespace, + } +} + +type wrapBatchV1CronJobImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedbatchv1.CronJobInterface = (*wrapBatchV1CronJobImpl)(nil) + +func (w *wrapBatchV1CronJobImpl) Apply(ctx context.Context, in *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.CronJob, err error) { + panic("NYI") +} + +func (w *wrapBatchV1CronJobImpl) ApplyStatus(ctx context.Context, in *batchv1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.CronJob, err error) { + panic("NYI") +} + +func (w *wrapBatchV1CronJobImpl) Create(ctx context.Context, in *apibatchv1.CronJob, opts metav1.CreateOptions) (*apibatchv1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1CronJobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapBatchV1CronJobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapBatchV1CronJobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apibatchv1.CronJob, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1CronJobImpl) List(ctx context.Context, opts metav1.ListOptions) (*apibatchv1.CronJobList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.CronJobList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1CronJobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apibatchv1.CronJob, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1CronJobImpl) Update(ctx context.Context, in *apibatchv1.CronJob, opts metav1.UpdateOptions) (*apibatchv1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1CronJobImpl) UpdateStatus(ctx context.Context, in *apibatchv1.CronJob, opts metav1.UpdateOptions) (*apibatchv1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1CronJobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapBatchV1) Jobs(namespace string) typedbatchv1.JobInterface { + return &wrapBatchV1JobImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "batch", + Version: "v1", + Resource: "jobs", + }), + + namespace: namespace, + } +} + +type wrapBatchV1JobImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedbatchv1.JobInterface = (*wrapBatchV1JobImpl)(nil) + +func (w *wrapBatchV1JobImpl) Apply(ctx context.Context, in *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.Job, err error) { + panic("NYI") +} + +func (w *wrapBatchV1JobImpl) ApplyStatus(ctx context.Context, in *batchv1.JobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1.Job, err error) { + panic("NYI") +} + +func (w *wrapBatchV1JobImpl) Create(ctx context.Context, in *apibatchv1.Job, opts metav1.CreateOptions) (*apibatchv1.Job, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "Job", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapBatchV1JobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapBatchV1JobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apibatchv1.Job, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) List(ctx context.Context, opts metav1.ListOptions) (*apibatchv1.JobList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.JobList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apibatchv1.Job, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) Update(ctx context.Context, in *apibatchv1.Job, opts metav1.UpdateOptions) (*apibatchv1.Job, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "Job", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) UpdateStatus(ctx context.Context, in *apibatchv1.Job, opts metav1.UpdateOptions) (*apibatchv1.Job, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1", + Kind: "Job", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1.Job{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1JobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// BatchV1beta1 retrieves the BatchV1beta1Client +func (w *wrapClient) BatchV1beta1() typedbatchv1beta1.BatchV1beta1Interface { + return &wrapBatchV1beta1{ + dyn: w.dyn, + } +} + +type wrapBatchV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapBatchV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapBatchV1beta1) CronJobs(namespace string) typedbatchv1beta1.CronJobInterface { + return &wrapBatchV1beta1CronJobImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "batch", + Version: "v1beta1", + Resource: "cronjobs", + }), + + namespace: namespace, + } +} + +type wrapBatchV1beta1CronJobImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedbatchv1beta1.CronJobInterface = (*wrapBatchV1beta1CronJobImpl)(nil) + +func (w *wrapBatchV1beta1CronJobImpl) Apply(ctx context.Context, in *batchv1beta1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1beta1.CronJob, err error) { + panic("NYI") +} + +func (w *wrapBatchV1beta1CronJobImpl) ApplyStatus(ctx context.Context, in *batchv1beta1.CronJobApplyConfiguration, opts metav1.ApplyOptions) (result *apibatchv1beta1.CronJob, err error) { + panic("NYI") +} + +func (w *wrapBatchV1beta1CronJobImpl) Create(ctx context.Context, in *apibatchv1beta1.CronJob, opts metav1.CreateOptions) (*apibatchv1beta1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1beta1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapBatchV1beta1CronJobImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapBatchV1beta1CronJobImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apibatchv1beta1.CronJob, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apibatchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) List(ctx context.Context, opts metav1.ListOptions) (*apibatchv1beta1.CronJobList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apibatchv1beta1.CronJobList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apibatchv1beta1.CronJob, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apibatchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Update(ctx context.Context, in *apibatchv1beta1.CronJob, opts metav1.UpdateOptions) (*apibatchv1beta1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1beta1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) UpdateStatus(ctx context.Context, in *apibatchv1beta1.CronJob, opts metav1.UpdateOptions) (*apibatchv1beta1.CronJob, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "batch", + Version: "v1beta1", + Kind: "CronJob", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apibatchv1beta1.CronJob{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapBatchV1beta1CronJobImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// CertificatesV1 retrieves the CertificatesV1Client +func (w *wrapClient) CertificatesV1() typedcertificatesv1.CertificatesV1Interface { + return &wrapCertificatesV1{ + dyn: w.dyn, + } +} + +type wrapCertificatesV1 struct { + dyn dynamic.Interface +} + +func (w *wrapCertificatesV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCertificatesV1) CertificateSigningRequests() typedcertificatesv1.CertificateSigningRequestInterface { + return &wrapCertificatesV1CertificateSigningRequestImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "certificates.k8s.io", + Version: "v1", + Resource: "certificatesigningrequests", + }), + } +} + +type wrapCertificatesV1CertificateSigningRequestImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcertificatesv1.CertificateSigningRequestInterface = (*wrapCertificatesV1CertificateSigningRequestImpl)(nil) + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Apply(ctx context.Context, in *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1.CertificateSigningRequest, err error) { + panic("NYI") +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) ApplyStatus(ctx context.Context, in *certificatesv1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1.CertificateSigningRequest, err error) { + panic("NYI") +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Create(ctx context.Context, in *apicertificatesv1.CertificateSigningRequest, opts metav1.CreateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicertificatesv1.CertificateSigningRequest, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicertificatesv1.CertificateSigningRequestList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1.CertificateSigningRequestList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicertificatesv1.CertificateSigningRequest, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Update(ctx context.Context, in *apicertificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) UpdateStatus(ctx context.Context, in *apicertificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCertificatesV1CertificateSigningRequestImpl) UpdateApproval(ctx context.Context, _ string, in *apicertificatesv1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1.CertificateSigningRequest, error) { + panic("NYI") +} + +// CertificatesV1beta1 retrieves the CertificatesV1beta1Client +func (w *wrapClient) CertificatesV1beta1() typedcertificatesv1beta1.CertificatesV1beta1Interface { + return &wrapCertificatesV1beta1{ + dyn: w.dyn, + } +} + +type wrapCertificatesV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapCertificatesV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCertificatesV1beta1) CertificateSigningRequests() typedcertificatesv1beta1.CertificateSigningRequestInterface { + return &wrapCertificatesV1beta1CertificateSigningRequestImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "certificates.k8s.io", + Version: "v1beta1", + Resource: "certificatesigningrequests", + }), + } +} + +type wrapCertificatesV1beta1CertificateSigningRequestImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcertificatesv1beta1.CertificateSigningRequestInterface = (*wrapCertificatesV1beta1CertificateSigningRequestImpl)(nil) + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Apply(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1beta1.CertificateSigningRequest, err error) { + panic("NYI") +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) ApplyStatus(ctx context.Context, in *certificatesv1beta1.CertificateSigningRequestApplyConfiguration, opts metav1.ApplyOptions) (result *apicertificatesv1beta1.CertificateSigningRequest, err error) { + panic("NYI") +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Create(ctx context.Context, in *apicertificatesv1beta1.CertificateSigningRequest, opts metav1.CreateOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1beta1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicertificatesv1beta1.CertificateSigningRequestList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1beta1.CertificateSigningRequestList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicertificatesv1beta1.CertificateSigningRequest, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Update(ctx context.Context, in *apicertificatesv1beta1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1beta1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) UpdateStatus(ctx context.Context, in *apicertificatesv1beta1.CertificateSigningRequest, opts metav1.UpdateOptions) (*apicertificatesv1beta1.CertificateSigningRequest, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "certificates.k8s.io", + Version: "v1beta1", + Kind: "CertificateSigningRequest", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicertificatesv1beta1.CertificateSigningRequest{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCertificatesV1beta1CertificateSigningRequestImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// CoordinationV1 retrieves the CoordinationV1Client +func (w *wrapClient) CoordinationV1() typedcoordinationv1.CoordinationV1Interface { + return &wrapCoordinationV1{ + dyn: w.dyn, + } +} + +type wrapCoordinationV1 struct { + dyn dynamic.Interface +} + +func (w *wrapCoordinationV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCoordinationV1) Leases(namespace string) typedcoordinationv1.LeaseInterface { + return &wrapCoordinationV1LeaseImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "coordination.k8s.io", + Version: "v1", + Resource: "leases", + }), + + namespace: namespace, + } +} + +type wrapCoordinationV1LeaseImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcoordinationv1.LeaseInterface = (*wrapCoordinationV1LeaseImpl)(nil) + +func (w *wrapCoordinationV1LeaseImpl) Apply(ctx context.Context, in *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1.Lease, err error) { + panic("NYI") +} + +func (w *wrapCoordinationV1LeaseImpl) ApplyStatus(ctx context.Context, in *coordinationv1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1.Lease, err error) { + panic("NYI") +} + +func (w *wrapCoordinationV1LeaseImpl) Create(ctx context.Context, in *apicoordinationv1.Lease, opts metav1.CreateOptions) (*apicoordinationv1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoordinationV1LeaseImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoordinationV1LeaseImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicoordinationv1.Lease, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicoordinationv1.LeaseList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1.LeaseList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicoordinationv1.Lease, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) Update(ctx context.Context, in *apicoordinationv1.Lease, opts metav1.UpdateOptions) (*apicoordinationv1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) UpdateStatus(ctx context.Context, in *apicoordinationv1.Lease, opts metav1.UpdateOptions) (*apicoordinationv1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1LeaseImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// CoordinationV1beta1 retrieves the CoordinationV1beta1Client +func (w *wrapClient) CoordinationV1beta1() typedcoordinationv1beta1.CoordinationV1beta1Interface { + return &wrapCoordinationV1beta1{ + dyn: w.dyn, + } +} + +type wrapCoordinationV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapCoordinationV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCoordinationV1beta1) Leases(namespace string) typedcoordinationv1beta1.LeaseInterface { + return &wrapCoordinationV1beta1LeaseImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "coordination.k8s.io", + Version: "v1beta1", + Resource: "leases", + }), + + namespace: namespace, + } +} + +type wrapCoordinationV1beta1LeaseImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcoordinationv1beta1.LeaseInterface = (*wrapCoordinationV1beta1LeaseImpl)(nil) + +func (w *wrapCoordinationV1beta1LeaseImpl) Apply(ctx context.Context, in *coordinationv1beta1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1beta1.Lease, err error) { + panic("NYI") +} + +func (w *wrapCoordinationV1beta1LeaseImpl) ApplyStatus(ctx context.Context, in *coordinationv1beta1.LeaseApplyConfiguration, opts metav1.ApplyOptions) (result *apicoordinationv1beta1.Lease, err error) { + panic("NYI") +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Create(ctx context.Context, in *apicoordinationv1beta1.Lease, opts metav1.CreateOptions) (*apicoordinationv1beta1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1beta1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoordinationV1beta1LeaseImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicoordinationv1beta1.Lease, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicoordinationv1beta1.LeaseList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1beta1.LeaseList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicoordinationv1beta1.Lease, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Update(ctx context.Context, in *apicoordinationv1beta1.Lease, opts metav1.UpdateOptions) (*apicoordinationv1beta1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1beta1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) UpdateStatus(ctx context.Context, in *apicoordinationv1beta1.Lease, opts metav1.UpdateOptions) (*apicoordinationv1beta1.Lease, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "coordination.k8s.io", + Version: "v1beta1", + Kind: "Lease", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicoordinationv1beta1.Lease{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoordinationV1beta1LeaseImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// CoreV1 retrieves the CoreV1Client +func (w *wrapClient) CoreV1() typedcorev1.CoreV1Interface { + return &wrapCoreV1{ + dyn: w.dyn, + } +} + +type wrapCoreV1 struct { + dyn dynamic.Interface +} + +func (w *wrapCoreV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapCoreV1) ComponentStatuses() typedcorev1.ComponentStatusInterface { + return &wrapCoreV1ComponentStatusImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "componentstatuses", + }), + } +} + +type wrapCoreV1ComponentStatusImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcorev1.ComponentStatusInterface = (*wrapCoreV1ComponentStatusImpl)(nil) + +func (w *wrapCoreV1ComponentStatusImpl) Apply(ctx context.Context, in *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ComponentStatus, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ComponentStatusImpl) ApplyStatus(ctx context.Context, in *corev1.ComponentStatusApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ComponentStatus, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ComponentStatusImpl) Create(ctx context.Context, in *apicorev1.ComponentStatus, opts metav1.CreateOptions) (*apicorev1.ComponentStatus, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ComponentStatus", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ComponentStatusImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ComponentStatusImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ComponentStatus, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ComponentStatusList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ComponentStatusList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ComponentStatus, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) Update(ctx context.Context, in *apicorev1.ComponentStatus, opts metav1.UpdateOptions) (*apicorev1.ComponentStatus, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ComponentStatus", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) UpdateStatus(ctx context.Context, in *apicorev1.ComponentStatus, opts metav1.UpdateOptions) (*apicorev1.ComponentStatus, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ComponentStatus", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ComponentStatus{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ComponentStatusImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) ConfigMaps(namespace string) typedcorev1.ConfigMapInterface { + return &wrapCoreV1ConfigMapImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "configmaps", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ConfigMapImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ConfigMapInterface = (*wrapCoreV1ConfigMapImpl)(nil) + +func (w *wrapCoreV1ConfigMapImpl) Apply(ctx context.Context, in *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ConfigMap, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ConfigMapImpl) ApplyStatus(ctx context.Context, in *corev1.ConfigMapApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ConfigMap, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ConfigMapImpl) Create(ctx context.Context, in *apicorev1.ConfigMap, opts metav1.CreateOptions) (*apicorev1.ConfigMap, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ConfigMap", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ConfigMapImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ConfigMapImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ConfigMap, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ConfigMapList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ConfigMapList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ConfigMap, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) Update(ctx context.Context, in *apicorev1.ConfigMap, opts metav1.UpdateOptions) (*apicorev1.ConfigMap, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ConfigMap", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) UpdateStatus(ctx context.Context, in *apicorev1.ConfigMap, opts metav1.UpdateOptions) (*apicorev1.ConfigMap, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ConfigMap", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ConfigMap{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ConfigMapImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Endpoints(namespace string) typedcorev1.EndpointsInterface { + return &wrapCoreV1EndpointsImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "endpoints", + }), + + namespace: namespace, + } +} + +type wrapCoreV1EndpointsImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.EndpointsInterface = (*wrapCoreV1EndpointsImpl)(nil) + +func (w *wrapCoreV1EndpointsImpl) Apply(ctx context.Context, in *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Endpoints, err error) { + panic("NYI") +} + +func (w *wrapCoreV1EndpointsImpl) ApplyStatus(ctx context.Context, in *corev1.EndpointsApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Endpoints, err error) { + panic("NYI") +} + +func (w *wrapCoreV1EndpointsImpl) Create(ctx context.Context, in *apicorev1.Endpoints, opts metav1.CreateOptions) (*apicorev1.Endpoints, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Endpoints", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1EndpointsImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1EndpointsImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Endpoints, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.EndpointsList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.EndpointsList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Endpoints, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) Update(ctx context.Context, in *apicorev1.Endpoints, opts metav1.UpdateOptions) (*apicorev1.Endpoints, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Endpoints", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) UpdateStatus(ctx context.Context, in *apicorev1.Endpoints, opts metav1.UpdateOptions) (*apicorev1.Endpoints, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Endpoints", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Endpoints{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EndpointsImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Events(namespace string) typedcorev1.EventInterface { + return &wrapCoreV1EventImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "events", + }), + + namespace: namespace, + } +} + +type wrapCoreV1EventImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.EventInterface = (*wrapCoreV1EventImpl)(nil) + +func (w *wrapCoreV1EventImpl) Apply(ctx context.Context, in *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Event, err error) { + panic("NYI") +} + +func (w *wrapCoreV1EventImpl) ApplyStatus(ctx context.Context, in *corev1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Event, err error) { + panic("NYI") +} + +func (w *wrapCoreV1EventImpl) Create(ctx context.Context, in *apicorev1.Event, opts metav1.CreateOptions) (*apicorev1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Event, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.EventList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.EventList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Event, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Update(ctx context.Context, in *apicorev1.Event, opts metav1.UpdateOptions) (*apicorev1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) UpdateStatus(ctx context.Context, in *apicorev1.Event, opts metav1.UpdateOptions) (*apicorev1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) LimitRanges(namespace string) typedcorev1.LimitRangeInterface { + return &wrapCoreV1LimitRangeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "limitranges", + }), + + namespace: namespace, + } +} + +type wrapCoreV1LimitRangeImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.LimitRangeInterface = (*wrapCoreV1LimitRangeImpl)(nil) + +func (w *wrapCoreV1LimitRangeImpl) Apply(ctx context.Context, in *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.LimitRange, err error) { + panic("NYI") +} + +func (w *wrapCoreV1LimitRangeImpl) ApplyStatus(ctx context.Context, in *corev1.LimitRangeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.LimitRange, err error) { + panic("NYI") +} + +func (w *wrapCoreV1LimitRangeImpl) Create(ctx context.Context, in *apicorev1.LimitRange, opts metav1.CreateOptions) (*apicorev1.LimitRange, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "LimitRange", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1LimitRangeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1LimitRangeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.LimitRange, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.LimitRangeList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.LimitRangeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.LimitRange, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) Update(ctx context.Context, in *apicorev1.LimitRange, opts metav1.UpdateOptions) (*apicorev1.LimitRange, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "LimitRange", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) UpdateStatus(ctx context.Context, in *apicorev1.LimitRange, opts metav1.UpdateOptions) (*apicorev1.LimitRange, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "LimitRange", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.LimitRange{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1LimitRangeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Namespaces() typedcorev1.NamespaceInterface { + return &wrapCoreV1NamespaceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "namespaces", + }), + } +} + +type wrapCoreV1NamespaceImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcorev1.NamespaceInterface = (*wrapCoreV1NamespaceImpl)(nil) + +func (w *wrapCoreV1NamespaceImpl) Apply(ctx context.Context, in *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Namespace, err error) { + panic("NYI") +} + +func (w *wrapCoreV1NamespaceImpl) ApplyStatus(ctx context.Context, in *corev1.NamespaceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Namespace, err error) { + panic("NYI") +} + +func (w *wrapCoreV1NamespaceImpl) Create(ctx context.Context, in *apicorev1.Namespace, opts metav1.CreateOptions) (*apicorev1.Namespace, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Namespace", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCoreV1NamespaceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Namespace, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.NamespaceList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.NamespaceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Namespace, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) Update(ctx context.Context, in *apicorev1.Namespace, opts metav1.UpdateOptions) (*apicorev1.Namespace, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Namespace", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) UpdateStatus(ctx context.Context, in *apicorev1.Namespace, opts metav1.UpdateOptions) (*apicorev1.Namespace, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Namespace", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Namespace{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NamespaceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Nodes() typedcorev1.NodeInterface { + return &wrapCoreV1NodeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "nodes", + }), + } +} + +type wrapCoreV1NodeImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcorev1.NodeInterface = (*wrapCoreV1NodeImpl)(nil) + +func (w *wrapCoreV1NodeImpl) Apply(ctx context.Context, in *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Node, err error) { + panic("NYI") +} + +func (w *wrapCoreV1NodeImpl) ApplyStatus(ctx context.Context, in *corev1.NodeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Node, err error) { + panic("NYI") +} + +func (w *wrapCoreV1NodeImpl) Create(ctx context.Context, in *apicorev1.Node, opts metav1.CreateOptions) (*apicorev1.Node, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Node", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCoreV1NodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1NodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Node, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.NodeList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.NodeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Node, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) Update(ctx context.Context, in *apicorev1.Node, opts metav1.UpdateOptions) (*apicorev1.Node, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Node", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) UpdateStatus(ctx context.Context, in *apicorev1.Node, opts metav1.UpdateOptions) (*apicorev1.Node, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Node", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Node{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1NodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) PersistentVolumes() typedcorev1.PersistentVolumeInterface { + return &wrapCoreV1PersistentVolumeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "persistentvolumes", + }), + } +} + +type wrapCoreV1PersistentVolumeImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedcorev1.PersistentVolumeInterface = (*wrapCoreV1PersistentVolumeImpl)(nil) + +func (w *wrapCoreV1PersistentVolumeImpl) Apply(ctx context.Context, in *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolume, err error) { + panic("NYI") +} + +func (w *wrapCoreV1PersistentVolumeImpl) ApplyStatus(ctx context.Context, in *corev1.PersistentVolumeApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolume, err error) { + panic("NYI") +} + +func (w *wrapCoreV1PersistentVolumeImpl) Create(ctx context.Context, in *apicorev1.PersistentVolume, opts metav1.CreateOptions) (*apicorev1.PersistentVolume, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolume", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapCoreV1PersistentVolumeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1PersistentVolumeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.PersistentVolume, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.PersistentVolumeList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.PersistentVolume, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) Update(ctx context.Context, in *apicorev1.PersistentVolume, opts metav1.UpdateOptions) (*apicorev1.PersistentVolume, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolume", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) UpdateStatus(ctx context.Context, in *apicorev1.PersistentVolume, opts metav1.UpdateOptions) (*apicorev1.PersistentVolume, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolume", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolume{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) PersistentVolumeClaims(namespace string) typedcorev1.PersistentVolumeClaimInterface { + return &wrapCoreV1PersistentVolumeClaimImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "persistentvolumeclaims", + }), + + namespace: namespace, + } +} + +type wrapCoreV1PersistentVolumeClaimImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.PersistentVolumeClaimInterface = (*wrapCoreV1PersistentVolumeClaimImpl)(nil) + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Apply(ctx context.Context, in *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolumeClaim, err error) { + panic("NYI") +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) ApplyStatus(ctx context.Context, in *corev1.PersistentVolumeClaimApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PersistentVolumeClaim, err error) { + panic("NYI") +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Create(ctx context.Context, in *apicorev1.PersistentVolumeClaim, opts metav1.CreateOptions) (*apicorev1.PersistentVolumeClaim, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolumeClaim", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.PersistentVolumeClaim, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.PersistentVolumeClaimList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeClaimList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.PersistentVolumeClaim, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Update(ctx context.Context, in *apicorev1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*apicorev1.PersistentVolumeClaim, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolumeClaim", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) UpdateStatus(ctx context.Context, in *apicorev1.PersistentVolumeClaim, opts metav1.UpdateOptions) (*apicorev1.PersistentVolumeClaim, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PersistentVolumeClaim", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PersistentVolumeClaim{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PersistentVolumeClaimImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Pods(namespace string) typedcorev1.PodInterface { + return &wrapCoreV1PodImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "pods", + }), + + namespace: namespace, + } +} + +type wrapCoreV1PodImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.PodInterface = (*wrapCoreV1PodImpl)(nil) + +func (w *wrapCoreV1PodImpl) Apply(ctx context.Context, in *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Pod, err error) { + panic("NYI") +} + +func (w *wrapCoreV1PodImpl) ApplyStatus(ctx context.Context, in *corev1.PodApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Pod, err error) { + panic("NYI") +} + +func (w *wrapCoreV1PodImpl) Create(ctx context.Context, in *apicorev1.Pod, opts metav1.CreateOptions) (*apicorev1.Pod, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Pod", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1PodImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1PodImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Pod, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.PodList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Pod, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) Update(ctx context.Context, in *apicorev1.Pod, opts metav1.UpdateOptions) (*apicorev1.Pod, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Pod", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) UpdateStatus(ctx context.Context, in *apicorev1.Pod, opts metav1.UpdateOptions) (*apicorev1.Pod, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Pod", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Pod{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1PodImpl) GetEphemeralContainers(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.EphemeralContainers, error) { + panic("NYI") +} + +func (w *wrapCoreV1PodImpl) UpdateEphemeralContainers(ctx context.Context, _ string, in *apicorev1.EphemeralContainers, opts metav1.UpdateOptions) (*apicorev1.EphemeralContainers, error) { + panic("NYI") +} + +func (w *wrapCoreV1) PodTemplates(namespace string) typedcorev1.PodTemplateInterface { + return &wrapCoreV1PodTemplateImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "podtemplates", + }), + + namespace: namespace, + } +} + +type wrapCoreV1PodTemplateImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.PodTemplateInterface = (*wrapCoreV1PodTemplateImpl)(nil) + +func (w *wrapCoreV1PodTemplateImpl) Apply(ctx context.Context, in *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PodTemplate, err error) { + panic("NYI") +} + +func (w *wrapCoreV1PodTemplateImpl) ApplyStatus(ctx context.Context, in *corev1.PodTemplateApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.PodTemplate, err error) { + panic("NYI") +} + +func (w *wrapCoreV1PodTemplateImpl) Create(ctx context.Context, in *apicorev1.PodTemplate, opts metav1.CreateOptions) (*apicorev1.PodTemplate, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PodTemplate", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1PodTemplateImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1PodTemplateImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.PodTemplate, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.PodTemplateList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodTemplateList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.PodTemplate, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) Update(ctx context.Context, in *apicorev1.PodTemplate, opts metav1.UpdateOptions) (*apicorev1.PodTemplate, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PodTemplate", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) UpdateStatus(ctx context.Context, in *apicorev1.PodTemplate, opts metav1.UpdateOptions) (*apicorev1.PodTemplate, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "PodTemplate", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.PodTemplate{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1PodTemplateImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) ReplicationControllers(namespace string) typedcorev1.ReplicationControllerInterface { + return &wrapCoreV1ReplicationControllerImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "replicationcontrollers", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ReplicationControllerImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ReplicationControllerInterface = (*wrapCoreV1ReplicationControllerImpl)(nil) + +func (w *wrapCoreV1ReplicationControllerImpl) Apply(ctx context.Context, in *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ReplicationController, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ReplicationControllerImpl) ApplyStatus(ctx context.Context, in *corev1.ReplicationControllerApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ReplicationController, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ReplicationControllerImpl) Create(ctx context.Context, in *apicorev1.ReplicationController, opts metav1.CreateOptions) (*apicorev1.ReplicationController, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ReplicationController", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ReplicationControllerImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ReplicationControllerImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ReplicationController, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ReplicationControllerList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ReplicationControllerList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ReplicationController, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) Update(ctx context.Context, in *apicorev1.ReplicationController, opts metav1.UpdateOptions) (*apicorev1.ReplicationController, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ReplicationController", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) UpdateStatus(ctx context.Context, in *apicorev1.ReplicationController, opts metav1.UpdateOptions) (*apicorev1.ReplicationController, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ReplicationController", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ReplicationController{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ReplicationControllerImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1ReplicationControllerImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapCoreV1ReplicationControllerImpl) UpdateScale(ctx context.Context, _ string, in *autoscalingv1.Scale, opts metav1.UpdateOptions) (*autoscalingv1.Scale, error) { + panic("NYI") +} + +func (w *wrapCoreV1) ResourceQuotas(namespace string) typedcorev1.ResourceQuotaInterface { + return &wrapCoreV1ResourceQuotaImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "resourcequotas", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ResourceQuotaImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ResourceQuotaInterface = (*wrapCoreV1ResourceQuotaImpl)(nil) + +func (w *wrapCoreV1ResourceQuotaImpl) Apply(ctx context.Context, in *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ResourceQuota, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ResourceQuotaImpl) ApplyStatus(ctx context.Context, in *corev1.ResourceQuotaApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ResourceQuota, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ResourceQuotaImpl) Create(ctx context.Context, in *apicorev1.ResourceQuota, opts metav1.CreateOptions) (*apicorev1.ResourceQuota, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ResourceQuota", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ResourceQuotaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ResourceQuotaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ResourceQuota, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ResourceQuotaList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ResourceQuotaList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ResourceQuota, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) Update(ctx context.Context, in *apicorev1.ResourceQuota, opts metav1.UpdateOptions) (*apicorev1.ResourceQuota, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ResourceQuota", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) UpdateStatus(ctx context.Context, in *apicorev1.ResourceQuota, opts metav1.UpdateOptions) (*apicorev1.ResourceQuota, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ResourceQuota", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ResourceQuota{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ResourceQuotaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Secrets(namespace string) typedcorev1.SecretInterface { + return &wrapCoreV1SecretImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "secrets", + }), + + namespace: namespace, + } +} + +type wrapCoreV1SecretImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.SecretInterface = (*wrapCoreV1SecretImpl)(nil) + +func (w *wrapCoreV1SecretImpl) Apply(ctx context.Context, in *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Secret, err error) { + panic("NYI") +} + +func (w *wrapCoreV1SecretImpl) ApplyStatus(ctx context.Context, in *corev1.SecretApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Secret, err error) { + panic("NYI") +} + +func (w *wrapCoreV1SecretImpl) Create(ctx context.Context, in *apicorev1.Secret, opts metav1.CreateOptions) (*apicorev1.Secret, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Secret", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1SecretImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1SecretImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Secret, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.SecretList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.SecretList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Secret, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) Update(ctx context.Context, in *apicorev1.Secret, opts metav1.UpdateOptions) (*apicorev1.Secret, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Secret", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) UpdateStatus(ctx context.Context, in *apicorev1.Secret, opts metav1.UpdateOptions) (*apicorev1.Secret, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Secret", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Secret{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1SecretImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) Services(namespace string) typedcorev1.ServiceInterface { + return &wrapCoreV1ServiceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "services", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ServiceImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ServiceInterface = (*wrapCoreV1ServiceImpl)(nil) + +func (w *wrapCoreV1ServiceImpl) Apply(ctx context.Context, in *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Service, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ServiceImpl) ApplyStatus(ctx context.Context, in *corev1.ServiceApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.Service, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ServiceImpl) Create(ctx context.Context, in *apicorev1.Service, opts metav1.CreateOptions) (*apicorev1.Service, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ServiceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.Service, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ServiceList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.Service, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) Update(ctx context.Context, in *apicorev1.Service, opts metav1.UpdateOptions) (*apicorev1.Service, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) UpdateStatus(ctx context.Context, in *apicorev1.Service, opts metav1.UpdateOptions) (*apicorev1.Service, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "Service", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.Service{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1) ServiceAccounts(namespace string) typedcorev1.ServiceAccountInterface { + return &wrapCoreV1ServiceAccountImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "", + Version: "v1", + Resource: "serviceaccounts", + }), + + namespace: namespace, + } +} + +type wrapCoreV1ServiceAccountImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedcorev1.ServiceAccountInterface = (*wrapCoreV1ServiceAccountImpl)(nil) + +func (w *wrapCoreV1ServiceAccountImpl) Apply(ctx context.Context, in *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ServiceAccount, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ServiceAccountImpl) ApplyStatus(ctx context.Context, in *corev1.ServiceAccountApplyConfiguration, opts metav1.ApplyOptions) (result *apicorev1.ServiceAccount, err error) { + panic("NYI") +} + +func (w *wrapCoreV1ServiceAccountImpl) Create(ctx context.Context, in *apicorev1.ServiceAccount, opts metav1.CreateOptions) (*apicorev1.ServiceAccount, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ServiceAccount", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapCoreV1ServiceAccountImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapCoreV1ServiceAccountImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apicorev1.ServiceAccount, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) List(ctx context.Context, opts metav1.ListOptions) (*apicorev1.ServiceAccountList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceAccountList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apicorev1.ServiceAccount, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) Update(ctx context.Context, in *apicorev1.ServiceAccount, opts metav1.UpdateOptions) (*apicorev1.ServiceAccount, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ServiceAccount", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) UpdateStatus(ctx context.Context, in *apicorev1.ServiceAccount, opts metav1.UpdateOptions) (*apicorev1.ServiceAccount, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "", + Version: "v1", + Kind: "ServiceAccount", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apicorev1.ServiceAccount{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapCoreV1ServiceAccountImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapCoreV1ServiceAccountImpl) CreateToken(ctx context.Context, _ string, in *authenticationv1.TokenRequest, opts metav1.CreateOptions) (*authenticationv1.TokenRequest, error) { + panic("NYI") +} + +// DiscoveryV1 retrieves the DiscoveryV1Client +func (w *wrapClient) DiscoveryV1() typeddiscoveryv1.DiscoveryV1Interface { + return &wrapDiscoveryV1{ + dyn: w.dyn, + } +} + +type wrapDiscoveryV1 struct { + dyn dynamic.Interface +} + +func (w *wrapDiscoveryV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapDiscoveryV1) EndpointSlices(namespace string) typeddiscoveryv1.EndpointSliceInterface { + return &wrapDiscoveryV1EndpointSliceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "discovery.k8s.io", + Version: "v1", + Resource: "endpointslices", + }), + + namespace: namespace, + } +} + +type wrapDiscoveryV1EndpointSliceImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typeddiscoveryv1.EndpointSliceInterface = (*wrapDiscoveryV1EndpointSliceImpl)(nil) + +func (w *wrapDiscoveryV1EndpointSliceImpl) Apply(ctx context.Context, in *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1.EndpointSlice, err error) { + panic("NYI") +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) ApplyStatus(ctx context.Context, in *discoveryv1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1.EndpointSlice, err error) { + panic("NYI") +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) Create(ctx context.Context, in *apidiscoveryv1.EndpointSlice, opts metav1.CreateOptions) (*apidiscoveryv1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apidiscoveryv1.EndpointSlice, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) List(ctx context.Context, opts metav1.ListOptions) (*apidiscoveryv1.EndpointSliceList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1.EndpointSliceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apidiscoveryv1.EndpointSlice, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) Update(ctx context.Context, in *apidiscoveryv1.EndpointSlice, opts metav1.UpdateOptions) (*apidiscoveryv1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) UpdateStatus(ctx context.Context, in *apidiscoveryv1.EndpointSlice, opts metav1.UpdateOptions) (*apidiscoveryv1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1EndpointSliceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client +func (w *wrapClient) DiscoveryV1beta1() typeddiscoveryv1beta1.DiscoveryV1beta1Interface { + return &wrapDiscoveryV1beta1{ + dyn: w.dyn, + } +} + +type wrapDiscoveryV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapDiscoveryV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapDiscoveryV1beta1) EndpointSlices(namespace string) typeddiscoveryv1beta1.EndpointSliceInterface { + return &wrapDiscoveryV1beta1EndpointSliceImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "discovery.k8s.io", + Version: "v1beta1", + Resource: "endpointslices", + }), + + namespace: namespace, + } +} + +type wrapDiscoveryV1beta1EndpointSliceImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typeddiscoveryv1beta1.EndpointSliceInterface = (*wrapDiscoveryV1beta1EndpointSliceImpl)(nil) + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Apply(ctx context.Context, in *discoveryv1beta1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1beta1.EndpointSlice, err error) { + panic("NYI") +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) ApplyStatus(ctx context.Context, in *discoveryv1beta1.EndpointSliceApplyConfiguration, opts metav1.ApplyOptions) (result *apidiscoveryv1beta1.EndpointSlice, err error) { + panic("NYI") +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Create(ctx context.Context, in *apidiscoveryv1beta1.EndpointSlice, opts metav1.CreateOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1beta1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) List(ctx context.Context, opts metav1.ListOptions) (*apidiscoveryv1beta1.EndpointSliceList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1beta1.EndpointSliceList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apidiscoveryv1beta1.EndpointSlice, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Update(ctx context.Context, in *apidiscoveryv1beta1.EndpointSlice, opts metav1.UpdateOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1beta1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) UpdateStatus(ctx context.Context, in *apidiscoveryv1beta1.EndpointSlice, opts metav1.UpdateOptions) (*apidiscoveryv1beta1.EndpointSlice, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "discovery.k8s.io", + Version: "v1beta1", + Kind: "EndpointSlice", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apidiscoveryv1beta1.EndpointSlice{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapDiscoveryV1beta1EndpointSliceImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// EventsV1 retrieves the EventsV1Client +func (w *wrapClient) EventsV1() typedeventsv1.EventsV1Interface { + return &wrapEventsV1{ + dyn: w.dyn, + } +} + +type wrapEventsV1 struct { + dyn dynamic.Interface +} + +func (w *wrapEventsV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapEventsV1) Events(namespace string) typedeventsv1.EventInterface { + return &wrapEventsV1EventImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "events.k8s.io", + Version: "v1", + Resource: "events", + }), + + namespace: namespace, + } +} + +type wrapEventsV1EventImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedeventsv1.EventInterface = (*wrapEventsV1EventImpl)(nil) + +func (w *wrapEventsV1EventImpl) Apply(ctx context.Context, in *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1.Event, err error) { + panic("NYI") +} + +func (w *wrapEventsV1EventImpl) ApplyStatus(ctx context.Context, in *eventsv1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1.Event, err error) { + panic("NYI") +} + +func (w *wrapEventsV1EventImpl) Create(ctx context.Context, in *apieventsv1.Event, opts metav1.CreateOptions) (*apieventsv1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapEventsV1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapEventsV1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apieventsv1.Event, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apieventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*apieventsv1.EventList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apieventsv1.EventList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apieventsv1.Event, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apieventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) Update(ctx context.Context, in *apieventsv1.Event, opts metav1.UpdateOptions) (*apieventsv1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) UpdateStatus(ctx context.Context, in *apieventsv1.Event, opts metav1.UpdateOptions) (*apieventsv1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// EventsV1beta1 retrieves the EventsV1beta1Client +func (w *wrapClient) EventsV1beta1() typedeventsv1beta1.EventsV1beta1Interface { + return &wrapEventsV1beta1{ + dyn: w.dyn, + } +} + +type wrapEventsV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapEventsV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapEventsV1beta1) Events(namespace string) typedeventsv1beta1.EventInterface { + return &wrapEventsV1beta1EventImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "events.k8s.io", + Version: "v1beta1", + Resource: "events", + }), + + namespace: namespace, + } +} + +type wrapEventsV1beta1EventImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedeventsv1beta1.EventInterface = (*wrapEventsV1beta1EventImpl)(nil) + +func (w *wrapEventsV1beta1EventImpl) Apply(ctx context.Context, in *eventsv1beta1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1beta1.Event, err error) { + panic("NYI") +} + +func (w *wrapEventsV1beta1EventImpl) ApplyStatus(ctx context.Context, in *eventsv1beta1.EventApplyConfiguration, opts metav1.ApplyOptions) (result *apieventsv1beta1.Event, err error) { + panic("NYI") +} + +func (w *wrapEventsV1beta1EventImpl) Create(ctx context.Context, in *apieventsv1beta1.Event, opts metav1.CreateOptions) (*apieventsv1beta1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1beta1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapEventsV1beta1EventImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapEventsV1beta1EventImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apieventsv1beta1.Event, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apieventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) List(ctx context.Context, opts metav1.ListOptions) (*apieventsv1beta1.EventList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apieventsv1beta1.EventList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apieventsv1beta1.Event, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apieventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) Update(ctx context.Context, in *apieventsv1beta1.Event, opts metav1.UpdateOptions) (*apieventsv1beta1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1beta1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) UpdateStatus(ctx context.Context, in *apieventsv1beta1.Event, opts metav1.UpdateOptions) (*apieventsv1beta1.Event, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "events.k8s.io", + Version: "v1beta1", + Kind: "Event", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apieventsv1beta1.Event{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapEventsV1beta1EventImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// ExtensionsV1beta1 retrieves the ExtensionsV1beta1Client +func (w *wrapClient) ExtensionsV1beta1() typedextensionsv1beta1.ExtensionsV1beta1Interface { + return &wrapExtensionsV1beta1{ + dyn: w.dyn, + } +} + +type wrapExtensionsV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapExtensionsV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapExtensionsV1beta1) DaemonSets(namespace string) typedextensionsv1beta1.DaemonSetInterface { + return &wrapExtensionsV1beta1DaemonSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "daemonsets", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1DaemonSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.DaemonSetInterface = (*wrapExtensionsV1beta1DaemonSetImpl)(nil) + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Apply(ctx context.Context, in *extensionsv1beta1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.DaemonSet, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.DaemonSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.DaemonSet, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Create(ctx context.Context, in *apiextensionsv1beta1.DaemonSet, opts metav1.CreateOptions) (*apiextensionsv1beta1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.DaemonSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.DaemonSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DaemonSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.DaemonSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Update(ctx context.Context, in *apiextensionsv1beta1.DaemonSet, opts metav1.UpdateOptions) (*apiextensionsv1beta1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.DaemonSet, opts metav1.UpdateOptions) (*apiextensionsv1beta1.DaemonSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "DaemonSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DaemonSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DaemonSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1) Deployments(namespace string) typedextensionsv1beta1.DeploymentInterface { + return &wrapExtensionsV1beta1DeploymentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "deployments", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1DeploymentImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.DeploymentInterface = (*wrapExtensionsV1beta1DeploymentImpl)(nil) + +func (w *wrapExtensionsV1beta1DeploymentImpl) Apply(ctx context.Context, in *extensionsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Deployment, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.DeploymentApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Deployment, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Create(ctx context.Context, in *apiextensionsv1beta1.Deployment, opts metav1.CreateOptions) (*apiextensionsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.Deployment, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.DeploymentList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.DeploymentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.Deployment, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Update(ctx context.Context, in *apiextensionsv1beta1.Deployment, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.Deployment, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Deployment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Deployment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Deployment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.Scale, error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1DeploymentImpl) UpdateScale(ctx context.Context, _ string, in *apiextensionsv1beta1.Scale, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Scale, error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1) Ingresses(namespace string) typedextensionsv1beta1.IngressInterface { + return &wrapExtensionsV1beta1IngressImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "ingresses", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1IngressImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.IngressInterface = (*wrapExtensionsV1beta1IngressImpl)(nil) + +func (w *wrapExtensionsV1beta1IngressImpl) Apply(ctx context.Context, in *extensionsv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Ingress, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1IngressImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.Ingress, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1IngressImpl) Create(ctx context.Context, in *apiextensionsv1beta1.Ingress, opts metav1.CreateOptions) (*apiextensionsv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.Ingress, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.IngressList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.IngressList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.Ingress, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) Update(ctx context.Context, in *apiextensionsv1beta1.Ingress, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.Ingress, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1) NetworkPolicies(namespace string) typedextensionsv1beta1.NetworkPolicyInterface { + return &wrapExtensionsV1beta1NetworkPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "networkpolicies", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1NetworkPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.NetworkPolicyInterface = (*wrapExtensionsV1beta1NetworkPolicyImpl)(nil) + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Apply(ctx context.Context, in *extensionsv1beta1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.NetworkPolicy, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.NetworkPolicy, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Create(ctx context.Context, in *apiextensionsv1beta1.NetworkPolicy, opts metav1.CreateOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.NetworkPolicyList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.NetworkPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.NetworkPolicy, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Update(ctx context.Context, in *apiextensionsv1beta1.NetworkPolicy, opts metav1.UpdateOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.NetworkPolicy, opts metav1.UpdateOptions) (*apiextensionsv1beta1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1NetworkPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1) PodSecurityPolicies() typedextensionsv1beta1.PodSecurityPolicyInterface { + return &wrapExtensionsV1beta1PodSecurityPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "podsecuritypolicies", + }), + } +} + +type wrapExtensionsV1beta1PodSecurityPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedextensionsv1beta1.PodSecurityPolicyInterface = (*wrapExtensionsV1beta1PodSecurityPolicyImpl)(nil) + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Apply(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.PodSecurityPolicy, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.PodSecurityPolicy, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Create(ctx context.Context, in *apiextensionsv1beta1.PodSecurityPolicy, opts metav1.CreateOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.PodSecurityPolicyList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.PodSecurityPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.PodSecurityPolicy, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Update(ctx context.Context, in *apiextensionsv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*apiextensionsv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1PodSecurityPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1) ReplicaSets(namespace string) typedextensionsv1beta1.ReplicaSetInterface { + return &wrapExtensionsV1beta1ReplicaSetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "extensions", + Version: "v1beta1", + Resource: "replicasets", + }), + + namespace: namespace, + } +} + +type wrapExtensionsV1beta1ReplicaSetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedextensionsv1beta1.ReplicaSetInterface = (*wrapExtensionsV1beta1ReplicaSetImpl)(nil) + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Apply(ctx context.Context, in *extensionsv1beta1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.ReplicaSet, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) ApplyStatus(ctx context.Context, in *extensionsv1beta1.ReplicaSetApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1beta1.ReplicaSet, err error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Create(ctx context.Context, in *apiextensionsv1beta1.ReplicaSet, opts metav1.CreateOptions) (*apiextensionsv1beta1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.ReplicaSet, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1beta1.ReplicaSetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.ReplicaSetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.ReplicaSet, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Update(ctx context.Context, in *apiextensionsv1beta1.ReplicaSet, opts metav1.UpdateOptions) (*apiextensionsv1beta1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) UpdateStatus(ctx context.Context, in *apiextensionsv1beta1.ReplicaSet, opts metav1.UpdateOptions) (*apiextensionsv1beta1.ReplicaSet, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "extensions", + Version: "v1beta1", + Kind: "ReplicaSet", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiextensionsv1beta1.ReplicaSet{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) GetScale(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1beta1.Scale, error) { + panic("NYI") +} + +func (w *wrapExtensionsV1beta1ReplicaSetImpl) UpdateScale(ctx context.Context, _ string, in *apiextensionsv1beta1.Scale, opts metav1.UpdateOptions) (*apiextensionsv1beta1.Scale, error) { + panic("NYI") +} + +// FlowcontrolV1alpha1 retrieves the FlowcontrolV1alpha1Client +func (w *wrapClient) FlowcontrolV1alpha1() typedflowcontrolv1alpha1.FlowcontrolV1alpha1Interface { + return &wrapFlowcontrolV1alpha1{ + dyn: w.dyn, + } +} + +type wrapFlowcontrolV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapFlowcontrolV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapFlowcontrolV1alpha1) FlowSchemas() typedflowcontrolv1alpha1.FlowSchemaInterface { + return &wrapFlowcontrolV1alpha1FlowSchemaImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Resource: "flowschemas", + }), + } +} + +type wrapFlowcontrolV1alpha1FlowSchemaImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedflowcontrolv1alpha1.FlowSchemaInterface = (*wrapFlowcontrolV1alpha1FlowSchemaImpl)(nil) + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1alpha1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.FlowSchema, err error) { + panic("NYI") +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1alpha1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.FlowSchema, err error) { + panic("NYI") +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Create(ctx context.Context, in *apiflowcontrolv1alpha1.FlowSchema, opts metav1.CreateOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1alpha1.FlowSchemaList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.FlowSchemaList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1alpha1.FlowSchema, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Update(ctx context.Context, in *apiflowcontrolv1alpha1.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1alpha1.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1alpha1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1FlowSchemaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapFlowcontrolV1alpha1) PriorityLevelConfigurations() typedflowcontrolv1alpha1.PriorityLevelConfigurationInterface { + return &wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Resource: "prioritylevelconfigurations", + }), + } +} + +type wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedflowcontrolv1alpha1.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl)(nil) + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Apply(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { + panic("NYI") +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1alpha1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { + panic("NYI") +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Create(ctx context.Context, in *apiflowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.CreateOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.PriorityLevelConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1alpha1.PriorityLevelConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Update(ctx context.Context, in *apiflowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1alpha1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1alpha1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1alpha1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1alpha1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1alpha1PriorityLevelConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// FlowcontrolV1beta1 retrieves the FlowcontrolV1beta1Client +func (w *wrapClient) FlowcontrolV1beta1() typedflowcontrolv1beta1.FlowcontrolV1beta1Interface { + return &wrapFlowcontrolV1beta1{ + dyn: w.dyn, + } +} + +type wrapFlowcontrolV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapFlowcontrolV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapFlowcontrolV1beta1) FlowSchemas() typedflowcontrolv1beta1.FlowSchemaInterface { + return &wrapFlowcontrolV1beta1FlowSchemaImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Resource: "flowschemas", + }), + } +} + +type wrapFlowcontrolV1beta1FlowSchemaImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedflowcontrolv1beta1.FlowSchemaInterface = (*wrapFlowcontrolV1beta1FlowSchemaImpl)(nil) + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Apply(ctx context.Context, in *flowcontrolv1beta1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.FlowSchema, err error) { + panic("NYI") +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta1.FlowSchemaApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.FlowSchema, err error) { + panic("NYI") +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Create(ctx context.Context, in *apiflowcontrolv1beta1.FlowSchema, opts metav1.CreateOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1beta1.FlowSchemaList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.FlowSchemaList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1beta1.FlowSchema, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Update(ctx context.Context, in *apiflowcontrolv1beta1.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1beta1.FlowSchema, opts metav1.UpdateOptions) (*apiflowcontrolv1beta1.FlowSchema, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "FlowSchema", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.FlowSchema{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1FlowSchemaImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapFlowcontrolV1beta1) PriorityLevelConfigurations() typedflowcontrolv1beta1.PriorityLevelConfigurationInterface { + return &wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Resource: "prioritylevelconfigurations", + }), + } +} + +type wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedflowcontrolv1beta1.PriorityLevelConfigurationInterface = (*wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl)(nil) + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Apply(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { + panic("NYI") +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) ApplyStatus(ctx context.Context, in *flowcontrolv1beta1.PriorityLevelConfigurationApplyConfiguration, opts metav1.ApplyOptions) (result *apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { + panic("NYI") +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Create(ctx context.Context, in *apiflowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.CreateOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) List(ctx context.Context, opts metav1.ListOptions) (*apiflowcontrolv1beta1.PriorityLevelConfigurationList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.PriorityLevelConfigurationList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiflowcontrolv1beta1.PriorityLevelConfiguration, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Update(ctx context.Context, in *apiflowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) UpdateStatus(ctx context.Context, in *apiflowcontrolv1beta1.PriorityLevelConfiguration, opts metav1.UpdateOptions) (*apiflowcontrolv1beta1.PriorityLevelConfiguration, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "flowcontrol.apiserver.k8s.io", + Version: "v1beta1", + Kind: "PriorityLevelConfiguration", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apiflowcontrolv1beta1.PriorityLevelConfiguration{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapFlowcontrolV1beta1PriorityLevelConfigurationImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NetworkingV1 retrieves the NetworkingV1Client +func (w *wrapClient) NetworkingV1() typednetworkingv1.NetworkingV1Interface { + return &wrapNetworkingV1{ + dyn: w.dyn, + } +} + +type wrapNetworkingV1 struct { + dyn dynamic.Interface +} + +func (w *wrapNetworkingV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNetworkingV1) Ingresses(namespace string) typednetworkingv1.IngressInterface { + return &wrapNetworkingV1IngressImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1", + Resource: "ingresses", + }), + + namespace: namespace, + } +} + +type wrapNetworkingV1IngressImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typednetworkingv1.IngressInterface = (*wrapNetworkingV1IngressImpl)(nil) + +func (w *wrapNetworkingV1IngressImpl) Apply(ctx context.Context, in *networkingv1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.Ingress, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1IngressImpl) ApplyStatus(ctx context.Context, in *networkingv1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.Ingress, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1IngressImpl) Create(ctx context.Context, in *apinetworkingv1.Ingress, opts metav1.CreateOptions) (*apinetworkingv1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1.Ingress, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1.IngressList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1.Ingress, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) Update(ctx context.Context, in *apinetworkingv1.Ingress, opts metav1.UpdateOptions) (*apinetworkingv1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1.Ingress, opts metav1.UpdateOptions) (*apinetworkingv1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapNetworkingV1) IngressClasses() typednetworkingv1.IngressClassInterface { + return &wrapNetworkingV1IngressClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1", + Resource: "ingressclasses", + }), + } +} + +type wrapNetworkingV1IngressClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednetworkingv1.IngressClassInterface = (*wrapNetworkingV1IngressClassImpl)(nil) + +func (w *wrapNetworkingV1IngressClassImpl) Apply(ctx context.Context, in *networkingv1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.IngressClass, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1IngressClassImpl) ApplyStatus(ctx context.Context, in *networkingv1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.IngressClass, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1IngressClassImpl) Create(ctx context.Context, in *apinetworkingv1.IngressClass, opts metav1.CreateOptions) (*apinetworkingv1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1IngressClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1IngressClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1.IngressClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1.IngressClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1.IngressClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) Update(ctx context.Context, in *apinetworkingv1.IngressClass, opts metav1.UpdateOptions) (*apinetworkingv1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1.IngressClass, opts metav1.UpdateOptions) (*apinetworkingv1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1IngressClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapNetworkingV1) NetworkPolicies(namespace string) typednetworkingv1.NetworkPolicyInterface { + return &wrapNetworkingV1NetworkPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1", + Resource: "networkpolicies", + }), + + namespace: namespace, + } +} + +type wrapNetworkingV1NetworkPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typednetworkingv1.NetworkPolicyInterface = (*wrapNetworkingV1NetworkPolicyImpl)(nil) + +func (w *wrapNetworkingV1NetworkPolicyImpl) Apply(ctx context.Context, in *networkingv1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.NetworkPolicy, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) ApplyStatus(ctx context.Context, in *networkingv1.NetworkPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1.NetworkPolicy, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Create(ctx context.Context, in *apinetworkingv1.NetworkPolicy, opts metav1.CreateOptions) (*apinetworkingv1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1.NetworkPolicy, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1.NetworkPolicyList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.NetworkPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1.NetworkPolicy, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Update(ctx context.Context, in *apinetworkingv1.NetworkPolicy, opts metav1.UpdateOptions) (*apinetworkingv1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1.NetworkPolicy, opts metav1.UpdateOptions) (*apinetworkingv1.NetworkPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1", + Kind: "NetworkPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1.NetworkPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1NetworkPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NetworkingV1beta1 retrieves the NetworkingV1beta1Client +func (w *wrapClient) NetworkingV1beta1() typednetworkingv1beta1.NetworkingV1beta1Interface { + return &wrapNetworkingV1beta1{ + dyn: w.dyn, + } +} + +type wrapNetworkingV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapNetworkingV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNetworkingV1beta1) Ingresses(namespace string) typednetworkingv1beta1.IngressInterface { + return &wrapNetworkingV1beta1IngressImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1beta1", + Resource: "ingresses", + }), + + namespace: namespace, + } +} + +type wrapNetworkingV1beta1IngressImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typednetworkingv1beta1.IngressInterface = (*wrapNetworkingV1beta1IngressImpl)(nil) + +func (w *wrapNetworkingV1beta1IngressImpl) Apply(ctx context.Context, in *networkingv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.Ingress, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1beta1IngressImpl) ApplyStatus(ctx context.Context, in *networkingv1beta1.IngressApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.Ingress, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1beta1IngressImpl) Create(ctx context.Context, in *apinetworkingv1beta1.Ingress, opts metav1.CreateOptions) (*apinetworkingv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1beta1IngressImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1beta1IngressImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1beta1.Ingress, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1beta1.IngressList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1beta1.Ingress, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) Update(ctx context.Context, in *apinetworkingv1beta1.Ingress, opts metav1.UpdateOptions) (*apinetworkingv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1beta1.Ingress, opts metav1.UpdateOptions) (*apinetworkingv1beta1.Ingress, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "Ingress", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.Ingress{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapNetworkingV1beta1) IngressClasses() typednetworkingv1beta1.IngressClassInterface { + return &wrapNetworkingV1beta1IngressClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "networking.k8s.io", + Version: "v1beta1", + Resource: "ingressclasses", + }), + } +} + +type wrapNetworkingV1beta1IngressClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednetworkingv1beta1.IngressClassInterface = (*wrapNetworkingV1beta1IngressClassImpl)(nil) + +func (w *wrapNetworkingV1beta1IngressClassImpl) Apply(ctx context.Context, in *networkingv1beta1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.IngressClass, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) ApplyStatus(ctx context.Context, in *networkingv1beta1.IngressClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinetworkingv1beta1.IngressClass, err error) { + panic("NYI") +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Create(ctx context.Context, in *apinetworkingv1beta1.IngressClass, opts metav1.CreateOptions) (*apinetworkingv1beta1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinetworkingv1beta1.IngressClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinetworkingv1beta1.IngressClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinetworkingv1beta1.IngressClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Update(ctx context.Context, in *apinetworkingv1beta1.IngressClass, opts metav1.UpdateOptions) (*apinetworkingv1beta1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) UpdateStatus(ctx context.Context, in *apinetworkingv1beta1.IngressClass, opts metav1.UpdateOptions) (*apinetworkingv1beta1.IngressClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "networking.k8s.io", + Version: "v1beta1", + Kind: "IngressClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinetworkingv1beta1.IngressClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNetworkingV1beta1IngressClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NodeV1 retrieves the NodeV1Client +func (w *wrapClient) NodeV1() typednodev1.NodeV1Interface { + return &wrapNodeV1{ + dyn: w.dyn, + } +} + +type wrapNodeV1 struct { + dyn dynamic.Interface +} + +func (w *wrapNodeV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNodeV1) RuntimeClasses() typednodev1.RuntimeClassInterface { + return &wrapNodeV1RuntimeClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "node.k8s.io", + Version: "v1", + Resource: "runtimeclasses", + }), + } +} + +type wrapNodeV1RuntimeClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednodev1.RuntimeClassInterface = (*wrapNodeV1RuntimeClassImpl)(nil) + +func (w *wrapNodeV1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1.RuntimeClass, err error) { + panic("NYI") +} + +func (w *wrapNodeV1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1.RuntimeClass, err error) { + panic("NYI") +} + +func (w *wrapNodeV1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNodeV1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNodeV1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinodev1.RuntimeClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apinodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinodev1.RuntimeClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apinodev1.RuntimeClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinodev1.RuntimeClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apinodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) Update(ctx context.Context, in *apinodev1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *apinodev1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NodeV1alpha1 retrieves the NodeV1alpha1Client +func (w *wrapClient) NodeV1alpha1() typednodev1alpha1.NodeV1alpha1Interface { + return &wrapNodeV1alpha1{ + dyn: w.dyn, + } +} + +type wrapNodeV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapNodeV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNodeV1alpha1) RuntimeClasses() typednodev1alpha1.RuntimeClassInterface { + return &wrapNodeV1alpha1RuntimeClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "node.k8s.io", + Version: "v1alpha1", + Resource: "runtimeclasses", + }), + } +} + +type wrapNodeV1alpha1RuntimeClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednodev1alpha1.RuntimeClassInterface = (*wrapNodeV1alpha1RuntimeClassImpl)(nil) + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1alpha1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1alpha1.RuntimeClass, err error) { + panic("NYI") +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1alpha1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1alpha1.RuntimeClass, err error) { + panic("NYI") +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1alpha1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1alpha1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1alpha1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinodev1alpha1.RuntimeClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apinodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinodev1alpha1.RuntimeClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apinodev1alpha1.RuntimeClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinodev1alpha1.RuntimeClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apinodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Update(ctx context.Context, in *apinodev1alpha1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1alpha1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1alpha1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *apinodev1alpha1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1alpha1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1alpha1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1alpha1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1alpha1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// NodeV1beta1 retrieves the NodeV1beta1Client +func (w *wrapClient) NodeV1beta1() typednodev1beta1.NodeV1beta1Interface { + return &wrapNodeV1beta1{ + dyn: w.dyn, + } +} + +type wrapNodeV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapNodeV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapNodeV1beta1) RuntimeClasses() typednodev1beta1.RuntimeClassInterface { + return &wrapNodeV1beta1RuntimeClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "node.k8s.io", + Version: "v1beta1", + Resource: "runtimeclasses", + }), + } +} + +type wrapNodeV1beta1RuntimeClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typednodev1beta1.RuntimeClassInterface = (*wrapNodeV1beta1RuntimeClassImpl)(nil) + +func (w *wrapNodeV1beta1RuntimeClassImpl) Apply(ctx context.Context, in *nodev1beta1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1beta1.RuntimeClass, err error) { + panic("NYI") +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) ApplyStatus(ctx context.Context, in *nodev1beta1.RuntimeClassApplyConfiguration, opts metav1.ApplyOptions) (result *apinodev1beta1.RuntimeClass, err error) { + panic("NYI") +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Create(ctx context.Context, in *apinodev1beta1.RuntimeClass, opts metav1.CreateOptions) (*apinodev1beta1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1beta1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apinodev1beta1.RuntimeClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apinodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apinodev1beta1.RuntimeClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apinodev1beta1.RuntimeClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apinodev1beta1.RuntimeClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apinodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Update(ctx context.Context, in *apinodev1beta1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1beta1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1beta1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) UpdateStatus(ctx context.Context, in *apinodev1beta1.RuntimeClass, opts metav1.UpdateOptions) (*apinodev1beta1.RuntimeClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "node.k8s.io", + Version: "v1beta1", + Kind: "RuntimeClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apinodev1beta1.RuntimeClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapNodeV1beta1RuntimeClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// PolicyV1 retrieves the PolicyV1Client +func (w *wrapClient) PolicyV1() typedpolicyv1.PolicyV1Interface { + return &wrapPolicyV1{ + dyn: w.dyn, + } +} + +type wrapPolicyV1 struct { + dyn dynamic.Interface +} + +func (w *wrapPolicyV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapPolicyV1) PodDisruptionBudgets(namespace string) typedpolicyv1.PodDisruptionBudgetInterface { + return &wrapPolicyV1PodDisruptionBudgetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "policy", + Version: "v1", + Resource: "poddisruptionbudgets", + }), + + namespace: namespace, + } +} + +type wrapPolicyV1PodDisruptionBudgetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedpolicyv1.PodDisruptionBudgetInterface = (*wrapPolicyV1PodDisruptionBudgetImpl)(nil) + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) Apply(ctx context.Context, in *policyv1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1.PodDisruptionBudget, err error) { + panic("NYI") +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) ApplyStatus(ctx context.Context, in *policyv1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1.PodDisruptionBudget, err error) { + panic("NYI") +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) Create(ctx context.Context, in *apipolicyv1.PodDisruptionBudget, opts metav1.CreateOptions) (*apipolicyv1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apipolicyv1.PodDisruptionBudget, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apipolicyv1.PodDisruptionBudgetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1.PodDisruptionBudgetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apipolicyv1.PodDisruptionBudget, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) Update(ctx context.Context, in *apipolicyv1.PodDisruptionBudget, opts metav1.UpdateOptions) (*apipolicyv1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) UpdateStatus(ctx context.Context, in *apipolicyv1.PodDisruptionBudget, opts metav1.UpdateOptions) (*apipolicyv1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1PodDisruptionBudgetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// PolicyV1beta1 retrieves the PolicyV1beta1Client +func (w *wrapClient) PolicyV1beta1() typedpolicyv1beta1.PolicyV1beta1Interface { + return &wrapPolicyV1beta1{ + dyn: w.dyn, + } +} + +type wrapPolicyV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapPolicyV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapPolicyV1beta1) Evictions(namespace string) typedpolicyv1beta1.EvictionInterface { + return &wrapPolicyV1beta1EvictionImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "policy", + Version: "v1beta1", + Resource: "evictions", + }), + + namespace: namespace, + } +} + +type wrapPolicyV1beta1EvictionImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedpolicyv1beta1.EvictionInterface = (*wrapPolicyV1beta1EvictionImpl)(nil) + +func (w *wrapPolicyV1beta1) PodDisruptionBudgets(namespace string) typedpolicyv1beta1.PodDisruptionBudgetInterface { + return &wrapPolicyV1beta1PodDisruptionBudgetImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "policy", + Version: "v1beta1", + Resource: "poddisruptionbudgets", + }), + + namespace: namespace, + } +} + +type wrapPolicyV1beta1PodDisruptionBudgetImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedpolicyv1beta1.PodDisruptionBudgetInterface = (*wrapPolicyV1beta1PodDisruptionBudgetImpl)(nil) + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Apply(ctx context.Context, in *policyv1beta1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodDisruptionBudget, err error) { + panic("NYI") +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) ApplyStatus(ctx context.Context, in *policyv1beta1.PodDisruptionBudgetApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodDisruptionBudget, err error) { + panic("NYI") +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Create(ctx context.Context, in *apipolicyv1beta1.PodDisruptionBudget, opts metav1.CreateOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) List(ctx context.Context, opts metav1.ListOptions) (*apipolicyv1beta1.PodDisruptionBudgetList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodDisruptionBudgetList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apipolicyv1beta1.PodDisruptionBudget, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Update(ctx context.Context, in *apipolicyv1beta1.PodDisruptionBudget, opts metav1.UpdateOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) UpdateStatus(ctx context.Context, in *apipolicyv1beta1.PodDisruptionBudget, opts metav1.UpdateOptions) (*apipolicyv1beta1.PodDisruptionBudget, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodDisruptionBudget", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodDisruptionBudget{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodDisruptionBudgetImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapPolicyV1beta1) PodSecurityPolicies() typedpolicyv1beta1.PodSecurityPolicyInterface { + return &wrapPolicyV1beta1PodSecurityPolicyImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "policy", + Version: "v1beta1", + Resource: "podsecuritypolicies", + }), + } +} + +type wrapPolicyV1beta1PodSecurityPolicyImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedpolicyv1beta1.PodSecurityPolicyInterface = (*wrapPolicyV1beta1PodSecurityPolicyImpl)(nil) + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Apply(ctx context.Context, in *policyv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodSecurityPolicy, err error) { + panic("NYI") +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) ApplyStatus(ctx context.Context, in *policyv1beta1.PodSecurityPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *apipolicyv1beta1.PodSecurityPolicy, err error) { + panic("NYI") +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Create(ctx context.Context, in *apipolicyv1beta1.PodSecurityPolicy, opts metav1.CreateOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) List(ctx context.Context, opts metav1.ListOptions) (*apipolicyv1beta1.PodSecurityPolicyList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodSecurityPolicyList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apipolicyv1beta1.PodSecurityPolicy, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Update(ctx context.Context, in *apipolicyv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) UpdateStatus(ctx context.Context, in *apipolicyv1beta1.PodSecurityPolicy, opts metav1.UpdateOptions) (*apipolicyv1beta1.PodSecurityPolicy, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "policy", + Version: "v1beta1", + Kind: "PodSecurityPolicy", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apipolicyv1beta1.PodSecurityPolicy{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapPolicyV1beta1PodSecurityPolicyImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// RbacV1 retrieves the RbacV1Client +func (w *wrapClient) RbacV1() typedrbacv1.RbacV1Interface { + return &wrapRbacV1{ + dyn: w.dyn, + } +} + +type wrapRbacV1 struct { + dyn dynamic.Interface +} + +func (w *wrapRbacV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapRbacV1) ClusterRoles() typedrbacv1.ClusterRoleInterface { + return &wrapRbacV1ClusterRoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Resource: "clusterroles", + }), + } +} + +type wrapRbacV1ClusterRoleImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1.ClusterRoleInterface = (*wrapRbacV1ClusterRoleImpl)(nil) + +func (w *wrapRbacV1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRole, err error) { + panic("NYI") +} + +func (w *wrapRbacV1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRole, err error) { + panic("NYI") +} + +func (w *wrapRbacV1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1.ClusterRole, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1.ClusterRoleList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1.ClusterRole, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) Update(ctx context.Context, in *apirbacv1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1) ClusterRoleBindings() typedrbacv1.ClusterRoleBindingInterface { + return &wrapRbacV1ClusterRoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Resource: "clusterrolebindings", + }), + } +} + +type wrapRbacV1ClusterRoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1.ClusterRoleBindingInterface = (*wrapRbacV1ClusterRoleBindingImpl)(nil) + +func (w *wrapRbacV1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.ClusterRoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1.ClusterRoleBinding, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1.ClusterRoleBindingList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1.ClusterRoleBinding, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Update(ctx context.Context, in *apirbacv1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1) Roles(namespace string) typedrbacv1.RoleInterface { + return &wrapRbacV1RoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Resource: "roles", + }), + + namespace: namespace, + } +} + +type wrapRbacV1RoleImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1.RoleInterface = (*wrapRbacV1RoleImpl)(nil) + +func (w *wrapRbacV1RoleImpl) Apply(ctx context.Context, in *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.Role, err error) { + panic("NYI") +} + +func (w *wrapRbacV1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.Role, err error) { + panic("NYI") +} + +func (w *wrapRbacV1RoleImpl) Create(ctx context.Context, in *apirbacv1.Role, opts metav1.CreateOptions) (*apirbacv1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1.Role, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1.RoleList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1.Role, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) Update(ctx context.Context, in *apirbacv1.Role, opts metav1.UpdateOptions) (*apirbacv1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1.Role, opts metav1.UpdateOptions) (*apirbacv1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1) RoleBindings(namespace string) typedrbacv1.RoleBindingInterface { + return &wrapRbacV1RoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Resource: "rolebindings", + }), + + namespace: namespace, + } +} + +type wrapRbacV1RoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1.RoleBindingInterface = (*wrapRbacV1RoleBindingImpl)(nil) + +func (w *wrapRbacV1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.RoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1.RoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1.RoleBinding, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1.RoleBindingList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1.RoleBinding, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) Update(ctx context.Context, in *apirbacv1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// RbacV1alpha1 retrieves the RbacV1alpha1Client +func (w *wrapClient) RbacV1alpha1() typedrbacv1alpha1.RbacV1alpha1Interface { + return &wrapRbacV1alpha1{ + dyn: w.dyn, + } +} + +type wrapRbacV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapRbacV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapRbacV1alpha1) ClusterRoles() typedrbacv1alpha1.ClusterRoleInterface { + return &wrapRbacV1alpha1ClusterRoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Resource: "clusterroles", + }), + } +} + +type wrapRbacV1alpha1ClusterRoleImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1alpha1.ClusterRoleInterface = (*wrapRbacV1alpha1ClusterRoleImpl)(nil) + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1alpha1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRole, err error) { + panic("NYI") +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRole, err error) { + panic("NYI") +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1alpha1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1alpha1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1alpha1.ClusterRole, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1alpha1.ClusterRoleList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1alpha1.ClusterRole, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Update(ctx context.Context, in *apirbacv1alpha1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1alpha1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1alpha1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1alpha1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1alpha1) ClusterRoleBindings() typedrbacv1alpha1.ClusterRoleBindingInterface { + return &wrapRbacV1alpha1ClusterRoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Resource: "clusterrolebindings", + }), + } +} + +type wrapRbacV1alpha1ClusterRoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1alpha1.ClusterRoleBindingInterface = (*wrapRbacV1alpha1ClusterRoleBindingImpl)(nil) + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1alpha1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.ClusterRoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1alpha1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1alpha1.ClusterRoleBindingList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1alpha1.ClusterRoleBinding, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Update(ctx context.Context, in *apirbacv1alpha1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1alpha1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1alpha1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1alpha1) Roles(namespace string) typedrbacv1alpha1.RoleInterface { + return &wrapRbacV1alpha1RoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Resource: "roles", + }), + + namespace: namespace, + } +} + +type wrapRbacV1alpha1RoleImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1alpha1.RoleInterface = (*wrapRbacV1alpha1RoleImpl)(nil) + +func (w *wrapRbacV1alpha1RoleImpl) Apply(ctx context.Context, in *rbacv1alpha1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.Role, err error) { + panic("NYI") +} + +func (w *wrapRbacV1alpha1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.Role, err error) { + panic("NYI") +} + +func (w *wrapRbacV1alpha1RoleImpl) Create(ctx context.Context, in *apirbacv1alpha1.Role, opts metav1.CreateOptions) (*apirbacv1alpha1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1alpha1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1alpha1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1alpha1.Role, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1alpha1.RoleList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1alpha1.Role, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) Update(ctx context.Context, in *apirbacv1alpha1.Role, opts metav1.UpdateOptions) (*apirbacv1alpha1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1alpha1.Role, opts metav1.UpdateOptions) (*apirbacv1alpha1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1alpha1) RoleBindings(namespace string) typedrbacv1alpha1.RoleBindingInterface { + return &wrapRbacV1alpha1RoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Resource: "rolebindings", + }), + + namespace: namespace, + } +} + +type wrapRbacV1alpha1RoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1alpha1.RoleBindingInterface = (*wrapRbacV1alpha1RoleBindingImpl)(nil) + +func (w *wrapRbacV1alpha1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1alpha1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.RoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1alpha1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1alpha1.RoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1alpha1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1alpha1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1alpha1.RoleBinding, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1alpha1.RoleBindingList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1alpha1.RoleBinding, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Update(ctx context.Context, in *apirbacv1alpha1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1alpha1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1alpha1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1alpha1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1alpha1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1alpha1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1alpha1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// RbacV1beta1 retrieves the RbacV1beta1Client +func (w *wrapClient) RbacV1beta1() typedrbacv1beta1.RbacV1beta1Interface { + return &wrapRbacV1beta1{ + dyn: w.dyn, + } +} + +type wrapRbacV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapRbacV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapRbacV1beta1) ClusterRoles() typedrbacv1beta1.ClusterRoleInterface { + return &wrapRbacV1beta1ClusterRoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Resource: "clusterroles", + }), + } +} + +type wrapRbacV1beta1ClusterRoleImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1beta1.ClusterRoleInterface = (*wrapRbacV1beta1ClusterRoleImpl)(nil) + +func (w *wrapRbacV1beta1ClusterRoleImpl) Apply(ctx context.Context, in *rbacv1beta1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRole, err error) { + panic("NYI") +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.ClusterRoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRole, err error) { + panic("NYI") +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Create(ctx context.Context, in *apirbacv1beta1.ClusterRole, opts metav1.CreateOptions) (*apirbacv1beta1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1beta1.ClusterRole, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1beta1.ClusterRoleList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1beta1.ClusterRole, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Update(ctx context.Context, in *apirbacv1beta1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1beta1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1beta1.ClusterRole, opts metav1.UpdateOptions) (*apirbacv1beta1.ClusterRole, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRole", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRole{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1beta1) ClusterRoleBindings() typedrbacv1beta1.ClusterRoleBindingInterface { + return &wrapRbacV1beta1ClusterRoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Resource: "clusterrolebindings", + }), + } +} + +type wrapRbacV1beta1ClusterRoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedrbacv1beta1.ClusterRoleBindingInterface = (*wrapRbacV1beta1ClusterRoleBindingImpl)(nil) + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Apply(ctx context.Context, in *rbacv1beta1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.ClusterRoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.ClusterRoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Create(ctx context.Context, in *apirbacv1beta1.ClusterRoleBinding, opts metav1.CreateOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1beta1.ClusterRoleBindingList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1beta1.ClusterRoleBinding, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Update(ctx context.Context, in *apirbacv1beta1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1beta1.ClusterRoleBinding, opts metav1.UpdateOptions) (*apirbacv1beta1.ClusterRoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "ClusterRoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.ClusterRoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1ClusterRoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1beta1) Roles(namespace string) typedrbacv1beta1.RoleInterface { + return &wrapRbacV1beta1RoleImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Resource: "roles", + }), + + namespace: namespace, + } +} + +type wrapRbacV1beta1RoleImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1beta1.RoleInterface = (*wrapRbacV1beta1RoleImpl)(nil) + +func (w *wrapRbacV1beta1RoleImpl) Apply(ctx context.Context, in *rbacv1beta1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.Role, err error) { + panic("NYI") +} + +func (w *wrapRbacV1beta1RoleImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.RoleApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.Role, err error) { + panic("NYI") +} + +func (w *wrapRbacV1beta1RoleImpl) Create(ctx context.Context, in *apirbacv1beta1.Role, opts metav1.CreateOptions) (*apirbacv1beta1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1beta1RoleImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1beta1RoleImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1beta1.Role, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1beta1.RoleList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1beta1.Role, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) Update(ctx context.Context, in *apirbacv1beta1.Role, opts metav1.UpdateOptions) (*apirbacv1beta1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) UpdateStatus(ctx context.Context, in *apirbacv1beta1.Role, opts metav1.UpdateOptions) (*apirbacv1beta1.Role, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "Role", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.Role{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapRbacV1beta1) RoleBindings(namespace string) typedrbacv1beta1.RoleBindingInterface { + return &wrapRbacV1beta1RoleBindingImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Resource: "rolebindings", + }), + + namespace: namespace, + } +} + +type wrapRbacV1beta1RoleBindingImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedrbacv1beta1.RoleBindingInterface = (*wrapRbacV1beta1RoleBindingImpl)(nil) + +func (w *wrapRbacV1beta1RoleBindingImpl) Apply(ctx context.Context, in *rbacv1beta1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.RoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1beta1RoleBindingImpl) ApplyStatus(ctx context.Context, in *rbacv1beta1.RoleBindingApplyConfiguration, opts metav1.ApplyOptions) (result *apirbacv1beta1.RoleBinding, err error) { + panic("NYI") +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Create(ctx context.Context, in *apirbacv1beta1.RoleBinding, opts metav1.CreateOptions) (*apirbacv1beta1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapRbacV1beta1RoleBindingImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apirbacv1beta1.RoleBinding, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) List(ctx context.Context, opts metav1.ListOptions) (*apirbacv1beta1.RoleBindingList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleBindingList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apirbacv1beta1.RoleBinding, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Update(ctx context.Context, in *apirbacv1beta1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1beta1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) UpdateStatus(ctx context.Context, in *apirbacv1beta1.RoleBinding, opts metav1.UpdateOptions) (*apirbacv1beta1.RoleBinding, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "rbac.authorization.k8s.io", + Version: "v1beta1", + Kind: "RoleBinding", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apirbacv1beta1.RoleBinding{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapRbacV1beta1RoleBindingImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// SchedulingV1 retrieves the SchedulingV1Client +func (w *wrapClient) SchedulingV1() typedschedulingv1.SchedulingV1Interface { + return &wrapSchedulingV1{ + dyn: w.dyn, + } +} + +type wrapSchedulingV1 struct { + dyn dynamic.Interface +} + +func (w *wrapSchedulingV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapSchedulingV1) PriorityClasses() typedschedulingv1.PriorityClassInterface { + return &wrapSchedulingV1PriorityClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "scheduling.k8s.io", + Version: "v1", + Resource: "priorityclasses", + }), + } +} + +type wrapSchedulingV1PriorityClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedschedulingv1.PriorityClassInterface = (*wrapSchedulingV1PriorityClassImpl)(nil) + +func (w *wrapSchedulingV1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1.PriorityClass, err error) { + panic("NYI") +} + +func (w *wrapSchedulingV1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1.PriorityClass, err error) { + panic("NYI") +} + +func (w *wrapSchedulingV1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapSchedulingV1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapSchedulingV1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apischedulingv1.PriorityClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apischedulingv1.PriorityClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1.PriorityClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apischedulingv1.PriorityClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) Update(ctx context.Context, in *apischedulingv1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) UpdateStatus(ctx context.Context, in *apischedulingv1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client +func (w *wrapClient) SchedulingV1alpha1() typedschedulingv1alpha1.SchedulingV1alpha1Interface { + return &wrapSchedulingV1alpha1{ + dyn: w.dyn, + } +} + +type wrapSchedulingV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapSchedulingV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapSchedulingV1alpha1) PriorityClasses() typedschedulingv1alpha1.PriorityClassInterface { + return &wrapSchedulingV1alpha1PriorityClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "scheduling.k8s.io", + Version: "v1alpha1", + Resource: "priorityclasses", + }), + } +} + +type wrapSchedulingV1alpha1PriorityClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedschedulingv1alpha1.PriorityClassInterface = (*wrapSchedulingV1alpha1PriorityClassImpl)(nil) + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1alpha1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1alpha1.PriorityClass, err error) { + panic("NYI") +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1alpha1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1alpha1.PriorityClass, err error) { + panic("NYI") +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1alpha1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1alpha1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1alpha1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apischedulingv1alpha1.PriorityClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apischedulingv1alpha1.PriorityClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1alpha1.PriorityClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apischedulingv1alpha1.PriorityClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Update(ctx context.Context, in *apischedulingv1alpha1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1alpha1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1alpha1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) UpdateStatus(ctx context.Context, in *apischedulingv1alpha1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1alpha1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1alpha1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1alpha1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1alpha1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// SchedulingV1beta1 retrieves the SchedulingV1beta1Client +func (w *wrapClient) SchedulingV1beta1() typedschedulingv1beta1.SchedulingV1beta1Interface { + return &wrapSchedulingV1beta1{ + dyn: w.dyn, + } +} + +type wrapSchedulingV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapSchedulingV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapSchedulingV1beta1) PriorityClasses() typedschedulingv1beta1.PriorityClassInterface { + return &wrapSchedulingV1beta1PriorityClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "scheduling.k8s.io", + Version: "v1beta1", + Resource: "priorityclasses", + }), + } +} + +type wrapSchedulingV1beta1PriorityClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedschedulingv1beta1.PriorityClassInterface = (*wrapSchedulingV1beta1PriorityClassImpl)(nil) + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Apply(ctx context.Context, in *schedulingv1beta1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1beta1.PriorityClass, err error) { + panic("NYI") +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) ApplyStatus(ctx context.Context, in *schedulingv1beta1.PriorityClassApplyConfiguration, opts metav1.ApplyOptions) (result *apischedulingv1beta1.PriorityClass, err error) { + panic("NYI") +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Create(ctx context.Context, in *apischedulingv1beta1.PriorityClass, opts metav1.CreateOptions) (*apischedulingv1beta1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1beta1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apischedulingv1beta1.PriorityClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apischedulingv1beta1.PriorityClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1beta1.PriorityClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apischedulingv1beta1.PriorityClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Update(ctx context.Context, in *apischedulingv1beta1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1beta1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1beta1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) UpdateStatus(ctx context.Context, in *apischedulingv1beta1.PriorityClass, opts metav1.UpdateOptions) (*apischedulingv1beta1.PriorityClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "scheduling.k8s.io", + Version: "v1beta1", + Kind: "PriorityClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apischedulingv1beta1.PriorityClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapSchedulingV1beta1PriorityClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// StorageV1 retrieves the StorageV1Client +func (w *wrapClient) StorageV1() typedstoragev1.StorageV1Interface { + return &wrapStorageV1{ + dyn: w.dyn, + } +} + +type wrapStorageV1 struct { + dyn dynamic.Interface +} + +func (w *wrapStorageV1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapStorageV1) CSIDrivers() typedstoragev1.CSIDriverInterface { + return &wrapStorageV1CSIDriverImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1", + Resource: "csidrivers", + }), + } +} + +type wrapStorageV1CSIDriverImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1.CSIDriverInterface = (*wrapStorageV1CSIDriverImpl)(nil) + +func (w *wrapStorageV1CSIDriverImpl) Apply(ctx context.Context, in *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIDriver, err error) { + panic("NYI") +} + +func (w *wrapStorageV1CSIDriverImpl) ApplyStatus(ctx context.Context, in *storagev1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSIDriver, err error) { + panic("NYI") +} + +func (w *wrapStorageV1CSIDriverImpl) Create(ctx context.Context, in *apistoragev1.CSIDriver, opts metav1.CreateOptions) (*apistoragev1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1CSIDriverImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1CSIDriverImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.CSIDriver, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.CSIDriverList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIDriverList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.CSIDriver, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) Update(ctx context.Context, in *apistoragev1.CSIDriver, opts metav1.UpdateOptions) (*apistoragev1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) UpdateStatus(ctx context.Context, in *apistoragev1.CSIDriver, opts metav1.UpdateOptions) (*apistoragev1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSIDriverImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1) CSINodes() typedstoragev1.CSINodeInterface { + return &wrapStorageV1CSINodeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1", + Resource: "csinodes", + }), + } +} + +type wrapStorageV1CSINodeImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1.CSINodeInterface = (*wrapStorageV1CSINodeImpl)(nil) + +func (w *wrapStorageV1CSINodeImpl) Apply(ctx context.Context, in *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSINode, err error) { + panic("NYI") +} + +func (w *wrapStorageV1CSINodeImpl) ApplyStatus(ctx context.Context, in *storagev1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.CSINode, err error) { + panic("NYI") +} + +func (w *wrapStorageV1CSINodeImpl) Create(ctx context.Context, in *apistoragev1.CSINode, opts metav1.CreateOptions) (*apistoragev1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1CSINodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1CSINodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.CSINode, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.CSINodeList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSINodeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.CSINode, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) Update(ctx context.Context, in *apistoragev1.CSINode, opts metav1.UpdateOptions) (*apistoragev1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) UpdateStatus(ctx context.Context, in *apistoragev1.CSINode, opts metav1.UpdateOptions) (*apistoragev1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1CSINodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1) StorageClasses() typedstoragev1.StorageClassInterface { + return &wrapStorageV1StorageClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1", + Resource: "storageclasses", + }), + } +} + +type wrapStorageV1StorageClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1.StorageClassInterface = (*wrapStorageV1StorageClassImpl)(nil) + +func (w *wrapStorageV1StorageClassImpl) Apply(ctx context.Context, in *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.StorageClass, err error) { + panic("NYI") +} + +func (w *wrapStorageV1StorageClassImpl) ApplyStatus(ctx context.Context, in *storagev1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.StorageClass, err error) { + panic("NYI") +} + +func (w *wrapStorageV1StorageClassImpl) Create(ctx context.Context, in *apistoragev1.StorageClass, opts metav1.CreateOptions) (*apistoragev1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1StorageClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1StorageClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.StorageClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.StorageClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.StorageClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.StorageClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) Update(ctx context.Context, in *apistoragev1.StorageClass, opts metav1.UpdateOptions) (*apistoragev1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) UpdateStatus(ctx context.Context, in *apistoragev1.StorageClass, opts metav1.UpdateOptions) (*apistoragev1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1StorageClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1) VolumeAttachments() typedstoragev1.VolumeAttachmentInterface { + return &wrapStorageV1VolumeAttachmentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1", + Resource: "volumeattachments", + }), + } +} + +type wrapStorageV1VolumeAttachmentImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1.VolumeAttachmentInterface = (*wrapStorageV1VolumeAttachmentImpl)(nil) + +func (w *wrapStorageV1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.VolumeAttachment, err error) { + panic("NYI") +} + +func (w *wrapStorageV1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1.VolumeAttachment, err error) { + panic("NYI") +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1.VolumeAttachment, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1.VolumeAttachmentList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.VolumeAttachmentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1.VolumeAttachment, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Update(ctx context.Context, in *apistoragev1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *apistoragev1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// StorageV1alpha1 retrieves the StorageV1alpha1Client +func (w *wrapClient) StorageV1alpha1() typedstoragev1alpha1.StorageV1alpha1Interface { + return &wrapStorageV1alpha1{ + dyn: w.dyn, + } +} + +type wrapStorageV1alpha1 struct { + dyn dynamic.Interface +} + +func (w *wrapStorageV1alpha1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapStorageV1alpha1) CSIStorageCapacities(namespace string) typedstoragev1alpha1.CSIStorageCapacityInterface { + return &wrapStorageV1alpha1CSIStorageCapacityImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Resource: "csistoragecapacities", + }), + + namespace: namespace, + } +} + +type wrapStorageV1alpha1CSIStorageCapacityImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedstoragev1alpha1.CSIStorageCapacityInterface = (*wrapStorageV1alpha1CSIStorageCapacityImpl)(nil) + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Apply(ctx context.Context, in *storagev1alpha1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.CSIStorageCapacity, err error) { + panic("NYI") +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) ApplyStatus(ctx context.Context, in *storagev1alpha1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.CSIStorageCapacity, err error) { + panic("NYI") +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Create(ctx context.Context, in *apistoragev1alpha1.CSIStorageCapacity, opts metav1.CreateOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1alpha1.CSIStorageCapacityList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.CSIStorageCapacityList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1alpha1.CSIStorageCapacity, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Update(ctx context.Context, in *apistoragev1alpha1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) UpdateStatus(ctx context.Context, in *apistoragev1alpha1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1alpha1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1CSIStorageCapacityImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1alpha1) VolumeAttachments() typedstoragev1alpha1.VolumeAttachmentInterface { + return &wrapStorageV1alpha1VolumeAttachmentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Resource: "volumeattachments", + }), + } +} + +type wrapStorageV1alpha1VolumeAttachmentImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1alpha1.VolumeAttachmentInterface = (*wrapStorageV1alpha1VolumeAttachmentImpl)(nil) + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1alpha1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.VolumeAttachment, err error) { + panic("NYI") +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1alpha1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1alpha1.VolumeAttachment, err error) { + panic("NYI") +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1alpha1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1alpha1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1alpha1.VolumeAttachment, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1alpha1.VolumeAttachmentList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.VolumeAttachmentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1alpha1.VolumeAttachment, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Update(ctx context.Context, in *apistoragev1alpha1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1alpha1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *apistoragev1alpha1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1alpha1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1alpha1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1alpha1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1alpha1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +// StorageV1beta1 retrieves the StorageV1beta1Client +func (w *wrapClient) StorageV1beta1() typedstoragev1beta1.StorageV1beta1Interface { + return &wrapStorageV1beta1{ + dyn: w.dyn, + } +} + +type wrapStorageV1beta1 struct { + dyn dynamic.Interface +} + +func (w *wrapStorageV1beta1) RESTClient() rest.Interface { + panic("RESTClient called on dynamic client!") +} + +func (w *wrapStorageV1beta1) CSIDrivers() typedstoragev1beta1.CSIDriverInterface { + return &wrapStorageV1beta1CSIDriverImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "csidrivers", + }), + } +} + +type wrapStorageV1beta1CSIDriverImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1beta1.CSIDriverInterface = (*wrapStorageV1beta1CSIDriverImpl)(nil) + +func (w *wrapStorageV1beta1CSIDriverImpl) Apply(ctx context.Context, in *storagev1beta1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIDriver, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1CSIDriverImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSIDriverApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIDriver, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Create(ctx context.Context, in *apistoragev1beta1.CSIDriver, opts metav1.CreateOptions) (*apistoragev1beta1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1CSIDriverImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.CSIDriver, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.CSIDriverList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIDriverList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.CSIDriver, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Update(ctx context.Context, in *apistoragev1beta1.CSIDriver, opts metav1.UpdateOptions) (*apistoragev1beta1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.CSIDriver, opts metav1.UpdateOptions) (*apistoragev1beta1.CSIDriver, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIDriver", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIDriver{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIDriverImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1beta1) CSINodes() typedstoragev1beta1.CSINodeInterface { + return &wrapStorageV1beta1CSINodeImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "csinodes", + }), + } +} + +type wrapStorageV1beta1CSINodeImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1beta1.CSINodeInterface = (*wrapStorageV1beta1CSINodeImpl)(nil) + +func (w *wrapStorageV1beta1CSINodeImpl) Apply(ctx context.Context, in *storagev1beta1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSINode, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1CSINodeImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSINodeApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSINode, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1CSINodeImpl) Create(ctx context.Context, in *apistoragev1beta1.CSINode, opts metav1.CreateOptions) (*apistoragev1beta1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1CSINodeImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1CSINodeImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.CSINode, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.CSINodeList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSINodeList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.CSINode, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) Update(ctx context.Context, in *apistoragev1beta1.CSINode, opts metav1.UpdateOptions) (*apistoragev1beta1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.CSINode, opts metav1.UpdateOptions) (*apistoragev1beta1.CSINode, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSINode", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSINode{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSINodeImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1beta1) CSIStorageCapacities(namespace string) typedstoragev1beta1.CSIStorageCapacityInterface { + return &wrapStorageV1beta1CSIStorageCapacityImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "csistoragecapacities", + }), + + namespace: namespace, + } +} + +type wrapStorageV1beta1CSIStorageCapacityImpl struct { + dyn dynamic.NamespaceableResourceInterface + + namespace string +} + +var _ typedstoragev1beta1.CSIStorageCapacityInterface = (*wrapStorageV1beta1CSIStorageCapacityImpl)(nil) + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Apply(ctx context.Context, in *storagev1beta1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIStorageCapacity, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.CSIStorageCapacityApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.CSIStorageCapacity, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Create(ctx context.Context, in *apistoragev1beta1.CSIStorageCapacity, opts metav1.CreateOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Namespace(w.namespace).Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.Namespace(w.namespace).DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { + uo, err := w.dyn.Namespace(w.namespace).Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.CSIStorageCapacityList, error) { + uo, err := w.dyn.Namespace(w.namespace).List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIStorageCapacityList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.CSIStorageCapacity, err error) { + uo, err := w.dyn.Namespace(w.namespace).Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Update(ctx context.Context, in *apistoragev1beta1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.CSIStorageCapacity, opts metav1.UpdateOptions) (*apistoragev1beta1.CSIStorageCapacity, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "CSIStorageCapacity", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Namespace(w.namespace).UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.CSIStorageCapacity{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1CSIStorageCapacityImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1beta1) StorageClasses() typedstoragev1beta1.StorageClassInterface { + return &wrapStorageV1beta1StorageClassImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "storageclasses", + }), + } +} + +type wrapStorageV1beta1StorageClassImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1beta1.StorageClassInterface = (*wrapStorageV1beta1StorageClassImpl)(nil) + +func (w *wrapStorageV1beta1StorageClassImpl) Apply(ctx context.Context, in *storagev1beta1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.StorageClass, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1StorageClassImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.StorageClassApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.StorageClass, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1StorageClassImpl) Create(ctx context.Context, in *apistoragev1beta1.StorageClass, opts metav1.CreateOptions) (*apistoragev1beta1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1StorageClassImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1StorageClassImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.StorageClass, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.StorageClassList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.StorageClassList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.StorageClass, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) Update(ctx context.Context, in *apistoragev1beta1.StorageClass, opts metav1.UpdateOptions) (*apistoragev1beta1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.StorageClass, opts metav1.UpdateOptions) (*apistoragev1beta1.StorageClass, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "StorageClass", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.StorageClass{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1StorageClassImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} + +func (w *wrapStorageV1beta1) VolumeAttachments() typedstoragev1beta1.VolumeAttachmentInterface { + return &wrapStorageV1beta1VolumeAttachmentImpl{ + dyn: w.dyn.Resource(schema.GroupVersionResource{ + Group: "storage.k8s.io", + Version: "v1beta1", + Resource: "volumeattachments", + }), + } +} + +type wrapStorageV1beta1VolumeAttachmentImpl struct { + dyn dynamic.NamespaceableResourceInterface +} + +var _ typedstoragev1beta1.VolumeAttachmentInterface = (*wrapStorageV1beta1VolumeAttachmentImpl)(nil) + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Apply(ctx context.Context, in *storagev1beta1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.VolumeAttachment, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) ApplyStatus(ctx context.Context, in *storagev1beta1.VolumeAttachmentApplyConfiguration, opts metav1.ApplyOptions) (result *apistoragev1beta1.VolumeAttachment, err error) { + panic("NYI") +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Create(ctx context.Context, in *apistoragev1beta1.VolumeAttachment, opts metav1.CreateOptions) (*apistoragev1beta1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Create(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return w.dyn.Delete(ctx, name, opts) +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + return w.dyn.DeleteCollection(ctx, opts, listOpts) +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Get(ctx context.Context, name string, opts metav1.GetOptions) (*apistoragev1beta1.VolumeAttachment, error) { + uo, err := w.dyn.Get(ctx, name, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) List(ctx context.Context, opts metav1.ListOptions) (*apistoragev1beta1.VolumeAttachmentList, error) { + uo, err := w.dyn.List(ctx, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.VolumeAttachmentList{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apistoragev1beta1.VolumeAttachment, err error) { + uo, err := w.dyn.Patch(ctx, name, pt, data, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Update(ctx context.Context, in *apistoragev1beta1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1beta1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.Update(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) UpdateStatus(ctx context.Context, in *apistoragev1beta1.VolumeAttachment, opts metav1.UpdateOptions) (*apistoragev1beta1.VolumeAttachment, error) { + in.SetGroupVersionKind(schema.GroupVersionKind{ + Group: "storage.k8s.io", + Version: "v1beta1", + Kind: "VolumeAttachment", + }) + uo := &unstructured.Unstructured{} + if err := convert(in, uo); err != nil { + return nil, err + } + uo, err := w.dyn.UpdateStatus(ctx, uo, opts) + if err != nil { + return nil, err + } + out := &apistoragev1beta1.VolumeAttachment{} + if err := convert(uo, out); err != nil { + return nil, err + } + return out, nil +} + +func (w *wrapStorageV1beta1VolumeAttachmentImpl) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return nil, errors.New("NYI: Watch") +} diff --git a/vendor/knative.dev/pkg/client/injection/kube/client/client_expansion.go b/vendor/knative.dev/pkg/client/injection/kube/client/client_expansion.go new file mode 100644 index 000000000..622d9f362 --- /dev/null +++ b/vendor/knative.dev/pkg/client/injection/kube/client/client_expansion.go @@ -0,0 +1,147 @@ +/* +Copyright 2021 The Knative 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 client + +import ( + context "context" + fmt "fmt" + + certificatesv1beta1 "k8s.io/api/certificates/v1beta1" + corev1 "k8s.io/api/core/v1" + eventsv1beta1 "k8s.io/api/events/v1beta1" + extensionsv1beta1 "k8s.io/api/extensions/v1beta1" + policyv1beta1 "k8s.io/api/policy/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + restclient "k8s.io/client-go/rest" +) + +func (*wrapCoreV1NamespaceImpl) Finalize(context.Context, *corev1.Namespace, metav1.UpdateOptions) (*corev1.Namespace, error) { + panic("NYI") +} + +func (*wrapCoreV1ServiceImpl) ProxyGet(string, string, string, string, map[string]string) restclient.ResponseWrapper { + panic("NYI") +} + +func (e *wrapEventsV1beta1EventImpl) CreateWithEventNamespace(event *eventsv1beta1.Event) (*eventsv1beta1.Event, error) { + if e.namespace != "" && event.Namespace != e.namespace { + return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) + } + ne := &wrapEventsV1beta1EventImpl{ + dyn: e.dyn, + namespace: event.Namespace, + } + return ne.Create(context.TODO(), event, metav1.CreateOptions{}) +} + +func (e *wrapEventsV1beta1EventImpl) UpdateWithEventNamespace(event *eventsv1beta1.Event) (*eventsv1beta1.Event, error) { + if e.namespace != "" && event.Namespace != e.namespace { + return nil, fmt.Errorf("can't update an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) + } + ne := &wrapEventsV1beta1EventImpl{ + dyn: e.dyn, + namespace: event.Namespace, + } + return ne.Update(context.TODO(), event, metav1.UpdateOptions{}) +} + +func (e *wrapEventsV1beta1EventImpl) PatchWithEventNamespace(event *eventsv1beta1.Event, bytes []byte) (*eventsv1beta1.Event, error) { + if e.namespace != "" && event.Namespace != e.namespace { + return nil, fmt.Errorf("can't patch an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) + } + ne := &wrapEventsV1beta1EventImpl{ + dyn: e.dyn, + namespace: event.Namespace, + } + return ne.Patch(context.TODO(), event.Name, types.StrategicMergePatchType, bytes, metav1.PatchOptions{}) +} + +func (e *wrapCoreV1EventImpl) CreateWithEventNamespace(event *corev1.Event) (*corev1.Event, error) { + if e.namespace != "" && event.Namespace != e.namespace { + return nil, fmt.Errorf("can't create an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) + } + ne := &wrapCoreV1EventImpl{ + dyn: e.dyn, + namespace: event.Namespace, + } + return ne.Create(context.TODO(), event, metav1.CreateOptions{}) +} + +func (e *wrapCoreV1EventImpl) UpdateWithEventNamespace(event *corev1.Event) (*corev1.Event, error) { + if e.namespace != "" && event.Namespace != e.namespace { + return nil, fmt.Errorf("can't update an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) + } + ne := &wrapCoreV1EventImpl{ + dyn: e.dyn, + namespace: event.Namespace, + } + return ne.Update(context.TODO(), event, metav1.UpdateOptions{}) +} + +func (e *wrapCoreV1EventImpl) PatchWithEventNamespace(event *corev1.Event, bytes []byte) (*corev1.Event, error) { + if e.namespace != "" && event.Namespace != e.namespace { + return nil, fmt.Errorf("can't patch an event with namespace '%v' in namespace '%v'", event.Namespace, e.namespace) + } + ne := &wrapCoreV1EventImpl{ + dyn: e.dyn, + namespace: event.Namespace, + } + return ne.Patch(context.TODO(), event.Name, types.StrategicMergePatchType, bytes, metav1.PatchOptions{}) +} + +func (*wrapCoreV1EventImpl) Search(*runtime.Scheme, runtime.Object) (*corev1.EventList, error) { + panic("NYI") +} + +func (*wrapCoreV1EventImpl) GetFieldSelector(*string, *string, *string, *string) fields.Selector { + panic("NYI") +} + +func (*wrapCoreV1NodeImpl) PatchStatus(context.Context, string, []byte) (*corev1.Node, error) { + panic("NYI") +} + +func (*wrapCoreV1PodImpl) Bind(context.Context, *corev1.Binding, metav1.CreateOptions) error { + panic("NYI") +} + +func (*wrapCoreV1PodImpl) Evict(context.Context, *policyv1beta1.Eviction) error { + panic("NYI") +} + +func (*wrapCoreV1PodImpl) GetLogs(string, *corev1.PodLogOptions) *restclient.Request { + panic("NYI") +} + +func (*wrapCoreV1PodImpl) ProxyGet(string, string, string, string, map[string]string) restclient.ResponseWrapper { + panic("NYI") +} + +func (*wrapExtensionsV1beta1DeploymentImpl) Rollback(context.Context, *extensionsv1beta1.DeploymentRollback, metav1.CreateOptions) error { + panic("NYI") +} + +func (*wrapPolicyV1beta1EvictionImpl) Evict(context.Context, *policyv1beta1.Eviction) error { + panic("NYI") +} + +func (*wrapCertificatesV1beta1CertificateSigningRequestImpl) UpdateApproval(context.Context, *certificatesv1beta1.CertificateSigningRequest, metav1.UpdateOptions) (*certificatesv1beta1.CertificateSigningRequest, error) { + panic("NYI") +} diff --git a/vendor/knative.dev/pkg/tracing/http.go b/vendor/knative.dev/pkg/tracing/http.go new file mode 100644 index 000000000..89509ed0b --- /dev/null +++ b/vendor/knative.dev/pkg/tracing/http.go @@ -0,0 +1,57 @@ +/* +Copyright 2019 The Knative 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 tracing + +import ( + "net/http" + + "go.opencensus.io/plugin/ochttp" + "go.opencensus.io/trace" + "k8s.io/apimachinery/pkg/util/sets" + "knative.dev/pkg/tracing/propagation/tracecontextb3" +) + +var ( + // neverSample forcibly turns off sampling. + neverSample = trace.StartOptions{ + Sampler: trace.NeverSample(), + } + // underlyingSampling uses the underlying sampling configuration (normally via the ConfigMap + // config-tracing). + underlyingSampling = trace.StartOptions{} + + // HTTPSpanMiddleware is an http.Handler middleware to create spans for the HTTP endpoint. + HTTPSpanMiddleware = HTTPSpanIgnoringPaths() +) + +// HTTPSpanIgnoringPaths is an http.Handler middleware to create spans for the HTTP +// endpoint, not sampling any request whose path is in pathsToIgnore. +func HTTPSpanIgnoringPaths(pathsToIgnore ...string) func(http.Handler) http.Handler { + pathsToIgnoreSet := sets.NewString(pathsToIgnore...) + return func(next http.Handler) http.Handler { + return &ochttp.Handler{ + Handler: next, + GetStartOptions: func(r *http.Request) trace.StartOptions { + if pathsToIgnoreSet.Has(r.URL.Path) { + return neverSample + } + return underlyingSampling + }, + Propagation: tracecontextb3.TraceContextEgress, + } + } +} diff --git a/vendor/knative.dev/pkg/tracing/opencensus.go b/vendor/knative.dev/pkg/tracing/opencensus.go new file mode 100644 index 000000000..9793e5c0f --- /dev/null +++ b/vendor/knative.dev/pkg/tracing/opencensus.go @@ -0,0 +1,190 @@ +/* +Copyright 2020 The Knative 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 tracing + +import ( + "errors" + "fmt" + "io" + "os" + "sync" + + oczipkin "contrib.go.opencensus.io/exporter/zipkin" + "github.com/openzipkin/zipkin-go" + httpreporter "github.com/openzipkin/zipkin-go/reporter/http" + "go.opencensus.io/trace" + "go.uber.org/zap" + + "knative.dev/pkg/tracing/config" +) + +// ConfigOption is the interface for adding additional exporters and configuring opencensus tracing. +type ConfigOption func(*config.Config) error + +// OpenCensusTracer is responsible for managing and updating configuration of OpenCensus tracing +type OpenCensusTracer struct { + curCfg *config.Config + configOptions []ConfigOption + + closer io.Closer + exporter trace.Exporter +} + +// OpenCensus tracing keeps state in globals and therefore we can only run one OpenCensusTracer +var ( + octMutex sync.Mutex + globalOct *OpenCensusTracer +) + +func NewOpenCensusTracer(configOptions ...ConfigOption) *OpenCensusTracer { + return &OpenCensusTracer{ + configOptions: configOptions, + } +} + +func (oct *OpenCensusTracer) ApplyConfig(cfg *config.Config) error { + err := oct.acquireGlobal() + defer octMutex.Unlock() + if err != nil { + return err + } + + // Short circuit if our config hasn't changed. + if oct.curCfg != nil && oct.curCfg.Equals(cfg) { + return nil + } + + // Apply config options + for _, configOpt := range oct.configOptions { + if err = configOpt(cfg); err != nil { + return err + } + } + + // Set config + trace.ApplyConfig(*createOCTConfig(cfg)) + + return nil +} + +func (oct *OpenCensusTracer) Finish() error { + err := oct.acquireGlobal() + defer octMutex.Unlock() + if err != nil { + return errors.New("finish called on OpenTracer which is not the global OpenCensusTracer") + } + + for _, configOpt := range oct.configOptions { + if err = configOpt(nil); err != nil { + return err + } + } + globalOct = nil + + return nil +} + +func (oct *OpenCensusTracer) acquireGlobal() error { + octMutex.Lock() + + if globalOct == nil { + globalOct = oct + } else if globalOct != oct { + return errors.New("an OpenCensusTracer already exists and only one can be run at a time") + } + + return nil +} + +func createOCTConfig(cfg *config.Config) *trace.Config { + octCfg := trace.Config{} + + if cfg.Backend != config.None { + if cfg.Debug { + octCfg.DefaultSampler = trace.AlwaysSample() + } else { + octCfg.DefaultSampler = trace.ProbabilitySampler(cfg.SampleRate) + } + } else { + octCfg.DefaultSampler = trace.NeverSample() + } + + return &octCfg +} + +// WithExporter returns a ConfigOption for use with NewOpenCensusTracer that configures +// it to export traces based on the configuration read from config-tracing. +func WithExporter(name string, logger *zap.SugaredLogger) ConfigOption { + return WithExporterFull(name, name, logger) +} + +// WithExporterFull supports host argument for WithExporter. +// The host arg is used for a value of tag ip="{IP}" so you can use an actual IP. Otherwise, +// the host name must be able to be resolved. +// e.g) +// "name" is a service name like activator-service. +// "host" is a endpoint IP like activator-service's endpoint IP. +func WithExporterFull(name, host string, logger *zap.SugaredLogger) ConfigOption { + return func(cfg *config.Config) error { + var ( + exporter trace.Exporter + closer io.Closer + ) + switch cfg.Backend { + case config.Zipkin: + // If host isn't specified, then zipkin.NewEndpoint will return an error saying that it + // can't find the host named ''. So, if not specified, default it to this machine's + // hostname. + if host == "" { + n, err := os.Hostname() + if err != nil { + return fmt.Errorf("unable to get hostname: %w", err) + } + host = n + } + if name == "" { + name = host + } + zipEP, err := zipkin.NewEndpoint(name, host) + if err != nil { + logger.Errorw("error building zipkin endpoint", zap.Error(err)) + return err + } + reporter := httpreporter.NewReporter(cfg.ZipkinEndpoint) + exporter = oczipkin.NewExporter(reporter, zipEP) + closer = reporter + + default: + // Disables tracing. + } + if exporter != nil { + trace.RegisterExporter(exporter) + } + // We know this is set because we are called with acquireGlobal lock held + if globalOct.exporter != nil { + trace.UnregisterExporter(globalOct.exporter) + } + if globalOct.closer != nil { + globalOct.closer.Close() + } + + globalOct.exporter = exporter + globalOct.closer = closer + + return nil + } +} diff --git a/vendor/knative.dev/pkg/tracing/setup.go b/vendor/knative.dev/pkg/tracing/setup.go new file mode 100644 index 000000000..c5de76489 --- /dev/null +++ b/vendor/knative.dev/pkg/tracing/setup.go @@ -0,0 +1,68 @@ +/* +Copyright 2020 The Knative 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 tracing + +import ( + "fmt" + + "go.uber.org/zap" + + "knative.dev/pkg/configmap" + "knative.dev/pkg/tracing/config" +) + +// SetupStaticPublishing sets up trace publishing for the process. Note that other +// pieces still need to generate the traces, this just ensures that if generated, they are collected +// appropriately. This is normally done by using tracing.HTTPSpanMiddleware as a middleware HTTP +// handler. The configuration will not be dynamically updated. +func SetupStaticPublishing(logger *zap.SugaredLogger, serviceName string, cfg *config.Config) error { + oct := NewOpenCensusTracer(WithExporter(serviceName, logger)) + if err := oct.ApplyConfig(cfg); err != nil { + return fmt.Errorf("unable to set OpenCensusTracing config: %w", err) + } + return nil +} + +// SetupDynamicPublishing sets up trace publishing for the process, by watching a +// ConfigMap for the configuration. Note that other pieces still need to generate the traces, this +// just ensures that if generated, they are collected appropriately. This is normally done by using +// tracing.HTTPSpanMiddleware as a middleware HTTP handler. The configuration will be dynamically +// updated when the ConfigMap is updated. +func SetupDynamicPublishing(logger *zap.SugaredLogger, configMapWatcher configmap.Watcher, serviceName, tracingConfigName string) error { + oct := NewOpenCensusTracer(WithExporter(serviceName, logger)) + + tracerUpdater := func(name string, value interface{}) { + if name == tracingConfigName { + cfg := value.(*config.Config) + logger.Debugw("Updating tracing config", zap.Any("cfg", cfg)) + if err := oct.ApplyConfig(cfg); err != nil { + logger.Errorw("Unable to apply open census tracer config", zap.Error(err)) + } + } + } + + // Set up our config store. + configStore := configmap.NewUntypedStore( + "config-tracing-store", + logger, + configmap.Constructors{ + "config-tracing": config.NewTracingConfigFromConfigMap, + }, + tracerUpdater) + configStore.WatchConfigs(configMapWatcher) + return nil +} diff --git a/vendor/knative.dev/pkg/tracing/zipkin.go b/vendor/knative.dev/pkg/tracing/zipkin.go new file mode 100644 index 000000000..ab94386ff --- /dev/null +++ b/vendor/knative.dev/pkg/tracing/zipkin.go @@ -0,0 +1,69 @@ +/* +Copyright 2019 The Knative 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 tracing + +import ( + "contrib.go.opencensus.io/exporter/zipkin" + zipkinmodel "github.com/openzipkin/zipkin-go/model" + zipkinreporter "github.com/openzipkin/zipkin-go/reporter" + "go.opencensus.io/trace" + + "knative.dev/pkg/tracing/config" +) + +// ZipkinReporterFactory is a factory function which creates a reporter given a config +type ZipkinReporterFactory func(*config.Config) (zipkinreporter.Reporter, error) + +// WithZipkinExporter returns a config with zipkin enabled. +// +// Deprecated: This function is the legacy entrypoint and should be replaced with one of: +// - WithExporter() in production code +// - testing/FakeZipkinExporter() in test code. +func WithZipkinExporter(reporterFact ZipkinReporterFactory, endpoint *zipkinmodel.Endpoint) ConfigOption { + return func(cfg *config.Config) error { + var ( + reporter zipkinreporter.Reporter + exporter trace.Exporter + ) + + if cfg != nil && cfg.Backend == config.Zipkin { + // Initialize our reporter / exporter + // do this before cleanup to minimize time where we have duplicate exporters + reporter, err := reporterFact(cfg) + if err != nil { + return err + } + exporter := zipkin.NewExporter(reporter, endpoint) + trace.RegisterExporter(exporter) + } + + // We know this is set because we are called with acquireGlobal lock held + oct := globalOct + if oct.exporter != nil { + trace.UnregisterExporter(oct.exporter) + } + + if oct.closer != nil { + _ = oct.closer.Close() + } + + oct.closer = reporter + oct.exporter = exporter + + return nil + } +} diff --git a/vendor/knative.dev/reconciler-test/LICENSE b/vendor/knative.dev/reconciler-test/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/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/knative.dev/reconciler-test/cmd/eventshub/main.go b/vendor/knative.dev/reconciler-test/cmd/eventshub/main.go new file mode 100644 index 000000000..566b2cd92 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/cmd/eventshub/main.go @@ -0,0 +1,50 @@ +/* +Copyright 2020 The Knative 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 + + https://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 main + +import ( + "context" + + "knative.dev/pkg/logging" + + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/eventshub/logger_vent" + "knative.dev/reconciler-test/pkg/eventshub/receiver" + "knative.dev/reconciler-test/pkg/eventshub/recorder_vent" + "knative.dev/reconciler-test/pkg/eventshub/sender" +) + +func main() { + eventshub.Start( + map[string]eventshub.EventLogFactory{ + eventshub.RecorderEventLog: func(ctx context.Context) (eventshub.EventLog, error) { + return recorder_vent.NewFromEnv(ctx), nil + }, + eventshub.LoggerEventLog: func(ctx context.Context) (eventshub.EventLog, error) { + return logger_vent.Logger(logging.FromContext(ctx).Named("event logger").Infof), nil + }, + }, + map[string]eventshub.EventGeneratorStarter{ + eventshub.ReceiverEventGenerator: func(ctx context.Context, logs *eventshub.EventLogs) error { + return receiver.NewFromEnv(ctx, logs).Start(ctx, eventshub.WithTracing) + }, + eventshub.SenderEventGenerator: func(ctx context.Context, logs *eventshub.EventLogs) error { + return sender.Start(ctx, logs) + }, + }, + ) +} diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/execution.go b/vendor/knative.dev/reconciler-test/pkg/environment/execution.go new file mode 100644 index 000000000..dea615af1 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/environment/execution.go @@ -0,0 +1,84 @@ +package environment + +import ( + "context" + "sync" + "testing" + + "knative.dev/reconciler-test/pkg/feature" +) + +func categorizeSteps(steps []feature.Step) map[feature.Timing][]feature.Step { + res := make(map[feature.Timing][]feature.Step, 4) + + res[feature.Setup] = filterStepTimings(steps, feature.Setup) + res[feature.Requirement] = filterStepTimings(steps, feature.Requirement) + res[feature.Assert] = filterStepTimings(steps, feature.Assert) + res[feature.Teardown] = filterStepTimings(steps, feature.Teardown) + + return res +} + +func filterStepTimings(steps []feature.Step, timing feature.Timing) []feature.Step { + var res []feature.Step + for _, s := range steps { + if s.T == timing { + res = append(res, s) + } + } + return res +} + +// executeWithSkippingT executes the step in a sub test wrapping t in order to never fail the subtest +// This blocks until the test completes. +func (mr *MagicEnvironment) executeWithSkippingT(ctx context.Context, originalT *testing.T, f *feature.Feature, s *feature.Step) feature.T { + originalT.Helper() + return mr.executeStep(ctx, originalT, f, s, createSkippingT) +} + +// executeWithoutWrappingT executes the step in a sub test without wrapping t. +// This blocks until the test completes. +func (mr *MagicEnvironment) executeWithoutWrappingT(ctx context.Context, originalT *testing.T, f *feature.Feature, s *feature.Step) feature.T { + originalT.Helper() + return mr.executeStep(ctx, originalT, f, s, func(t *testing.T) feature.T { + return t + }) +} + +func (mr *MagicEnvironment) executeStep(ctx context.Context, originalT *testing.T, f *feature.Feature, s *feature.Step, tDecorator func(t *testing.T) feature.T) feature.T { + originalT.Helper() + + wg := &sync.WaitGroup{} + wg.Add(1) + + var internalT feature.T + originalT.Run(f.Name+"/"+s.T.String()+"/"+s.TestName(), func(st *testing.T) { + st.Helper() + internalT = tDecorator(st) + + // Create a cancel tied to this step + internalCtx, internalCancelFn := context.WithCancel(ctx) + + defer func() { + if r := recover(); r != nil { + internalT.Errorf("Panic happened: '%v'", r) + } + // Close the context as soon as possible (this defer is invoked before the Cleanup) + internalCancelFn() + }() + + mr.milestones.StepStarted(f.Name, s, internalT) + internalT.Cleanup(func() { + mr.milestones.StepFinished(f.Name, s, internalT) + wg.Done() // Make sure wg.Done() is invoked at the very end of the execution + }) + + // Perform step. + s.Fn(internalCtx, internalT) + }) + + // Wait for the test to execute before spawning the next one + wg.Wait() + + return internalT +} diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/flags.go b/vendor/knative.dev/reconciler-test/pkg/environment/flags.go new file mode 100644 index 000000000..154d6bcf6 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/environment/flags.go @@ -0,0 +1,131 @@ +/* +Copyright 2020 The Knative 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 environment + +import ( + "flag" + "fmt" + "strconv" + "strings" + + "knative.dev/reconciler-test/pkg/feature" +) + +var ( + s = new(feature.States) + l = new(feature.Levels) + f = new(string) +) + +// InitFlags registers the requirement and state filter flags supported by the +// testing framework. +func InitFlags(fs *flag.FlagSet) { + // States + *s = feature.Any + for state, name := range feature.StatesMapping { + flagName := "feature." + strings.ReplaceAll(strings.ToLower(name), " ", "") + usage := fmt.Sprintf("toggles %q state assertions", name) + fs.Var(stateValue{state, s}, flagName, usage) + } + fs.Var(stateValue{feature.Any, s}, "feature.any", "toggles all features") + + // Levels + *l = feature.All + for level, name := range feature.LevelMapping { + flagName := "requirement." + strings.ReplaceAll(strings.ToLower(name), " ", "") + usage := fmt.Sprintf("toggles %q requirement assertions", name) + fs.Var(levelValue{level, l}, flagName, usage) + } + fs.Var(levelValue{feature.All, l}, "requirement.all", "toggles all requirement assertions") + + // Feature + fs.StringVar(f, "feature", "", "run only Features matching `regexp`") +} + +type stateValue struct { + mask feature.States + value *feature.States +} + +func (sv stateValue) Get() interface{} { + return *sv.value & sv.mask +} + +func (sv stateValue) Set(s string) error { + v, err := strconv.ParseBool(s) + if err != nil { + return err + } + + if v { + *sv.value = *sv.value | sv.mask // set + } else { + *sv.value = *sv.value &^ sv.mask // clear + } + + return nil +} + +func (sv stateValue) IsBoolFlag() bool { + return true +} + +func (sv stateValue) String() string { + if sv.value != nil && sv.mask&*sv.value != 0 { + return "true" + } + + return "false" +} + +type levelValue struct { + mask feature.Levels + value *feature.Levels +} + +func (lv levelValue) Get() interface{} { + return *lv.value & lv.mask +} + +func (lv levelValue) Set(s string) error { + v, err := strconv.ParseBool(s) + if err != nil { + return err + } + + if v { + *lv.value = *lv.value | lv.mask // set + } else { + *lv.value = *lv.value &^ lv.mask // clear + } + + fmt.Println(lv.value.String(), " set level to ", s) + + return nil +} + +func (lv levelValue) IsBoolFlag() bool { + return true +} + +func (lv levelValue) String() string { + if lv.value != nil && lv.mask&*lv.value != 0 { + return "true" + } + + return "false" +} diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/images.go b/vendor/knative.dev/reconciler-test/pkg/environment/images.go new file mode 100644 index 000000000..96f0a2692 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/environment/images.go @@ -0,0 +1,78 @@ +/* +Copyright 2020 The Knative 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 environment + +import ( + "fmt" + "strings" + "sync" + + "knative.dev/reconciler-test/pkg/images" +) + +var packages = []string(nil) +var packageToImageConfig = map[string]string{} +var packaged sync.Once + +// RegisterPackage registers an interest in producing an image based on the +// provide package. +// Can be called multiple times with the same package. +// A package will be used to produce the image and used +// like `image: ko://` inside test yaml. +func RegisterPackage(pack ...string) { + for _, p := range pack { + exists := false + for _, k := range packages { + if p == k { + exists = true + break + } + } + if !exists { + packages = append(packages, p) + } + } +} + +// WithImages will bypass ProduceImages() and use the provided image set +// instead. Should be called before ProduceImages(), if used, likely in an +// init() method. An images value should be a container registry image. The +// images map is presented to the templates on the field `images`, and used +// like `image: ` inside test yaml. +func WithImages(images map[string]string) { + packaged.Do(func() { + packageToImageConfig = images + }) +} + +// ProduceImages returns back the packages that have been added. +// Will produce images once, can be called many times. +func ProduceImages() (map[string]string, error) { + var propErr error + packaged.Do(func() { + for _, pack := range packages { + image, err := images.KoPublish(pack) + if err != nil { + fmt.Printf("error attempting to ko publish: %s\n", err) + propErr = err + return + } + packageToImageConfig["ko://"+pack] = strings.TrimSpace(image) + } + }) + return packageToImageConfig, propErr +} diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/interfaces.go b/vendor/knative.dev/reconciler-test/pkg/environment/interfaces.go new file mode 100644 index 000000000..3d859a557 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/environment/interfaces.go @@ -0,0 +1,83 @@ +/* +Copyright 2020 The Knative 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 environment + +import ( + "context" + "testing" + + corev1 "k8s.io/api/core/v1" + "knative.dev/reconciler-test/pkg/feature" +) + +// EnvOpts are options used to adjust the context or change how the +// environment is setup. +type EnvOpts func(ctx context.Context, env Environment) (context.Context, error) + +// GlobalEnvironment is the factory for an instance of Environment. +// GlobalEnvironment holds the understanding of the particular cluster that +// will be used for the feature testing. +type GlobalEnvironment interface { + Environment(opts ...EnvOpts) (context.Context, Environment) +} + +// Environment is the ephemeral testing environment to test features. +type Environment interface { + // Prerequisite will execute the feature using the given Context and T, + // the feature should not have any asserts. + Prerequisite(ctx context.Context, t *testing.T, f *feature.Feature) + + // Test will execute the feature test using the given Context and T. + Test(ctx context.Context, t *testing.T, f *feature.Feature) + + // TestSet will execute the feature set using the given Context and T. + TestSet(ctx context.Context, t *testing.T, fs *feature.FeatureSet) + + // Namespace returns the namespace of this environment. + Namespace() string + + // RequirementLevel returns the requirement level for this environment. + RequirementLevel() feature.Levels + + // FeatureState returns the requirement level for this environment. + FeatureState() feature.States + + // Images returns back the name to container image mapping to be used with + // yaml template parsing. + // The map will be in the form `key`: `image` and `key` and the intention + // usage is to use this key to string substitute for image in test yaml. + Images() map[string]string + + // TemplateConfig returns the base template config to use when processing + // yaml templates. + TemplateConfig(base map[string]interface{}) map[string]interface{} + + // Reference registers an object reference to the environment, so that it + // can be listed in env.References() or be cleaned up in env.Finish(). + // This can be one way a feature communicates with future features run in + // the same environment. + Reference(ref ...corev1.ObjectReference) + + // References returns the list of known object references that have been + // installed in the environment. + References() []corev1.ObjectReference + + // Finish signals to the environment no future features will be run. The + // namespace will be deleted if it was created by the environment, + // References will be cleaned up if registered. + Finish() +} diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/magic.go b/vendor/knative.dev/reconciler-test/pkg/environment/magic.go new file mode 100644 index 000000000..ea9b2a841 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/environment/magic.go @@ -0,0 +1,329 @@ +/* +Copyright 2020 The Knative 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 environment + +import ( + "context" + "errors" + "fmt" + "regexp" + "testing" + "time" + + "github.com/google/uuid" + "go.uber.org/zap" + corev1 "k8s.io/api/core/v1" + "knative.dev/pkg/logging" + + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/milestone" + "knative.dev/reconciler-test/pkg/state" +) + +func NewGlobalEnvironment(ctx context.Context) GlobalEnvironment { + fmt.Printf("level %s, state %s, feature %s\n\n", l, s, *f) + + return &MagicGlobalEnvironment{ + c: ctx, + instanceID: uuid.New().String(), + RequirementLevel: *l, + FeatureState: *s, + FeatureMatch: regexp.MustCompile(*f), + } +} + +type MagicGlobalEnvironment struct { + c context.Context + // instanceID represents this instance of the GlobalEnvironment. It is used + // to link runs together from a single global environment. + instanceID string + + RequirementLevel feature.Levels + FeatureState feature.States + FeatureMatch *regexp.Regexp +} + +type MagicEnvironment struct { + c context.Context + l feature.Levels + s feature.States + featureMatch *regexp.Regexp + + images map[string]string + namespace string + namespaceCreated bool + refs []corev1.ObjectReference + + // milestones sends milestone events, if configured. + milestones milestone.Emitter +} + +const ( + NamespaceDeleteErrorReason = "NamespaceDeleteError" +) + +func (mr *MagicEnvironment) Reference(ref ...corev1.ObjectReference) { + mr.refs = append(mr.refs, ref...) +} + +func (mr *MagicEnvironment) References() []corev1.ObjectReference { + return mr.refs +} + +func (mr *MagicEnvironment) Finish() { + if err := mr.DeleteNamespaceIfNeeded(); err != nil { + mr.milestones.Exception(NamespaceDeleteErrorReason, "failed to delete namespace %q, %v", mr.namespace, err) + panic(err) + } + mr.milestones.Finished() +} + +// WithPollTimings is an environment option to override default poll timings. +func WithPollTimings(interval, timeout time.Duration) EnvOpts { + return func(ctx context.Context, env Environment) (context.Context, error) { + return ContextWithPollTimings(ctx, interval, timeout), nil + } +} + +// Managed enables auto-lifecycle management of the environment. Including: +// - registers a t.Cleanup callback on env.Finish(). +func Managed(t feature.T) EnvOpts { + return func(ctx context.Context, env Environment) (context.Context, error) { + t.Cleanup(env.Finish) + return ctx, nil + } +} + +func (mr *MagicGlobalEnvironment) Environment(opts ...EnvOpts) (context.Context, Environment) { + images, err := ProduceImages() + if err != nil { + panic(err) + } + + namespace := feature.MakeK8sNamePrefix(feature.AppendRandomString("test")) + + env := &MagicEnvironment{ + c: mr.c, + l: mr.RequirementLevel, + s: mr.FeatureState, + featureMatch: mr.FeatureMatch, + + images: images, + namespace: namespace, + } + + ctx := ContextWith(mr.c, env) + + for _, opt := range opts { + if ctx, err = opt(ctx, env); err != nil { + panic(err) + } + } + + // It is possible to have milestones set in the options, check for nil in + // env first before attempting to pull one from the os environment. + if env.milestones == nil { + milestones, err := milestone.NewMilestoneEmitterFromEnv(mr.instanceID, namespace) + if err != nil { + // This is just an FYI error, don't block the test run. + logging.FromContext(mr.c).Error("failed to create the milestone event sender", zap.Error(err)) + } + if milestones != nil { + env.milestones = milestones + } + } + + if err := env.CreateNamespaceIfNeeded(); err != nil { + panic(err) + } + + env.milestones.Environment(map[string]string{ + // TODO: we could add more detail here, don't send secrets. + "requirementLevel": env.RequirementLevel().String(), + "featureState": env.FeatureState().String(), + "namespace": env.Namespace(), + }) + + return ctx, env +} + +func (mr *MagicEnvironment) Images() map[string]string { + return mr.images +} + +func (mr *MagicEnvironment) TemplateConfig(base map[string]interface{}) map[string]interface{} { + cfg := make(map[string]interface{}) + for k, v := range base { + cfg[k] = v + } + cfg["namespace"] = mr.namespace + return cfg +} + +func (mr *MagicEnvironment) RequirementLevel() feature.Levels { + return mr.l +} + +func (mr *MagicEnvironment) FeatureState() feature.States { + return mr.s +} + +// InNamespace takes the namespace that the tests should be run in instead of creating +// a namespace. This is useful if the Unit Under Test (UUT) is created ahead of the tests +// to be run. Longer term this should make it easier to decouple the UUT from the generic +// conformance tests, for example, create a Broker of type {Kafka, RabbitMQ} and the tests +// themselves should not care. +func InNamespace(namespace string) EnvOpts { + return func(ctx context.Context, env Environment) (context.Context, error) { + mr, ok := env.(*MagicEnvironment) + if !ok { + return ctx, errors.New("InNamespace: not a magic env") + } + mr.namespace = namespace + return ctx, nil + } +} + +func (mr *MagicEnvironment) Namespace() string { + return mr.namespace +} + +func (mr *MagicEnvironment) Prerequisite(ctx context.Context, t *testing.T, f *feature.Feature) { + t.Helper() // Helper marks the calling function as a test helper function. + t.Run("Prerequisite", func(t *testing.T) { + mr.Test(ctx, t, f) + }) +} + +// Test implements Environment.Test. +// In the MagicEnvironment implementation, the Store that is inside of the +// Feature will be assigned to the context. If no Store is set on Feature, +// Test will create a new store.KVStore and set it on the feature and then +// apply it to the Context. +func (mr *MagicEnvironment) Test(ctx context.Context, originalT *testing.T, f *feature.Feature) { + originalT.Helper() // Helper marks the calling function as a test helper function. + + if !mr.featureMatch.MatchString(f.Name) { + originalT.Logf("Skipping feature '%s' assertions because --feature=%s doesn't match", f.Name, mr.featureMatch.String()) + return + } + + mr.milestones.TestStarted(f.Name, originalT) + defer mr.milestones.TestFinished(f.Name, originalT) + + if f.State == nil { + f.State = &state.KVStore{} + } + ctx = state.ContextWith(ctx, f.State) + ctx = feature.ContextWith(ctx, f) + + steps := categorizeSteps(f.Steps) + + skipAssertions := false + skipRequirements := false + skipReason := "" + + mr.milestones.StepsPlanned(f.Name, steps, originalT) + + for _, s := range steps[feature.Setup] { + s := s + + // Setup are executed always, no matter their level and state + internalT := mr.executeWithoutWrappingT(ctx, originalT, f, &s) + + // Failed setup fails everything, so just run the teardown + if internalT.Failed() { + skipAssertions = true + skipRequirements = true // No need to test other requirements + break // No need to continue the setup + } + } + + for _, s := range steps[feature.Requirement] { + s := s + + if skipRequirements { + break + } + + internalT := mr.executeWithoutWrappingT(ctx, originalT, f, &s) + + if internalT.Failed() { + skipAssertions = true + skipRequirements = true // No need to test other requirements + } + } + + for _, s := range steps[feature.Assert] { + s := s + + if skipAssertions { + break + } + + if mr.shouldFail(&s) { + mr.executeWithoutWrappingT(ctx, originalT, f, &s) + } else { + mr.executeWithSkippingT(ctx, originalT, f, &s) + } + + // TODO implement fail fast feature to avoid proceeding with testing if an "expected level" assert fails here + } + + for _, s := range steps[feature.Teardown] { + s := s + + // Teardown are executed always, no matter their level and state + mr.executeWithoutWrappingT(ctx, originalT, f, &s) + } + + if skipReason != "" { + originalT.Skipf("Skipping feature '%s' assertions because %s", f.Name, skipReason) + } +} + +// TODO: this logic is strange and hard to follow. +func (mr *MagicEnvironment) shouldFail(s *feature.Step) bool { + return !(mr.s&s.S == 0 || mr.l&s.L == 0) +} + +// TestSet implements Environment.TestSet +func (mr *MagicEnvironment) TestSet(ctx context.Context, t *testing.T, fs *feature.FeatureSet) { + t.Helper() // Helper marks the calling function as a test helper function + + mr.milestones.TestSetStarted(fs.Name, t) + defer mr.milestones.TestSetFinished(fs.Name, t) + + for _, f := range fs.Features { + // Make sure the name is appended + f.Name = fs.Name + "/" + f.Name + mr.Test(ctx, t, &f) + } +} + +type envKey struct{} + +func ContextWith(ctx context.Context, e Environment) context.Context { + return context.WithValue(ctx, envKey{}, e) +} + +func FromContext(ctx context.Context) Environment { + if e, ok := ctx.Value(envKey{}).(Environment); ok { + return e + } + panic("no Environment found in context") +} diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/namespace.go b/vendor/knative.dev/reconciler-test/pkg/environment/namespace.go new file mode 100644 index 000000000..8d2783561 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/environment/namespace.go @@ -0,0 +1,88 @@ +/* +Copyright 2020 The Knative 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 environment + +import ( + "context" + "fmt" + + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + kubeclient "knative.dev/pkg/client/injection/kube/client" +) + +// CreateNamespaceIfNeeded creates a new namespace if it does not exist. +func (mr *MagicEnvironment) CreateNamespaceIfNeeded() error { + c := kubeclient.Get(mr.c) + nsSpec, err := c.CoreV1().Namespaces().Get(context.Background(), mr.namespace, metav1.GetOptions{}) + + if err != nil { + if !apierrors.IsNotFound(err) { + return err + } + + // Namespace was not found, try to create it. + + nsSpec = &corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: mr.namespace}} + nsSpec, err = c.CoreV1().Namespaces().Create(context.Background(), nsSpec, metav1.CreateOptions{}) + + if err != nil { + return fmt.Errorf("failed to create Namespace: %s; %v", mr.namespace, err) + } + mr.namespaceCreated = true + mr.milestones.NamespaceCreated(mr.namespace) + + interval, timeout := PollTimingsFromContext(mr.c) + + // https://github.com/kubernetes/kubernetes/issues/66689 + // We can only start creating pods after the default ServiceAccount is created by the kube-controller-manager. + if err := wait.PollImmediate(interval, timeout, func() (bool, error) { + sas := c.CoreV1().ServiceAccounts(mr.namespace) + if _, err := sas.Get(context.Background(), "default", metav1.GetOptions{}); err == nil { + return true, nil + } + return false, nil + }); err != nil { + return fmt.Errorf("the default ServiceAccount was not created for the Namespace: %s", mr.namespace) + } + } + return nil +} + +func (mr *MagicEnvironment) DeleteNamespaceIfNeeded() error { + if mr.namespaceCreated { + c := kubeclient.Get(mr.c) + + _, err := c.CoreV1().Namespaces().Get(context.Background(), mr.namespace, metav1.GetOptions{}) + if apierrors.IsNotFound(err) { + mr.namespaceCreated = false + return nil + } else if err != nil { + return err + } + + if err := c.CoreV1().Namespaces().Delete(context.Background(), mr.namespace, metav1.DeleteOptions{}); err != nil { + return err + } + mr.namespaceCreated = false + mr.milestones.NamespaceDeleted(mr.namespace) + } + + return nil +} diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/t.go b/vendor/knative.dev/reconciler-test/pkg/environment/t.go new file mode 100644 index 000000000..ddab939b3 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/environment/t.go @@ -0,0 +1,118 @@ +/* +Copyright 2021 The Knative 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 environment + +import ( + "testing" + + "go.uber.org/atomic" + + "knative.dev/reconciler-test/pkg/feature" +) + +// skippingT records if the test succeeded or failing, but never fails it +type skippingT struct { + *testing.T + + failed *atomic.Bool + skipped *atomic.Bool +} + +var _ feature.T = (*skippingT)(nil) + +func createSkippingT(originalT *testing.T) feature.T { + return &skippingT{ + T: originalT, + failed: atomic.NewBool(false), + skipped: atomic.NewBool(false), + } +} + +func (t *skippingT) Error(args ...interface{}) { + t.T.Helper() + t.failed.Store(true) + t.T.Log(args...) +} + +func (t *skippingT) Errorf(format string, args ...interface{}) { + t.T.Helper() + t.failed.Store(true) + t.T.Logf(format, args...) +} + +func (t *skippingT) Fail() { + t.T.Helper() + t.failed.Store(true) +} + +func (t *skippingT) FailNow() { + t.T.Helper() + t.failed.Store(true) + t.T.SkipNow() +} + +func (t *skippingT) Failed() bool { + return t.failed.Load() +} + +func (t *skippingT) Fatal(args ...interface{}) { + t.T.Helper() + t.failed.Store(true) + t.T.Log(args...) + t.T.SkipNow() +} + +func (t *skippingT) Fatalf(format string, args ...interface{}) { + t.T.Helper() + t.failed.Store(true) + t.T.Logf(format, args...) + t.T.SkipNow() +} + +func (t *skippingT) Log(args ...interface{}) { + t.T.Helper() + t.T.Log(args...) +} + +func (t *skippingT) Logf(format string, args ...interface{}) { + t.T.Helper() + t.T.Logf(format, args...) +} + +func (t *skippingT) Skip(args ...interface{}) { + t.T.Helper() + t.skipped.Store(true) + t.T.Log(args...) + t.T.SkipNow() +} + +func (t *skippingT) Skipf(format string, args ...interface{}) { + t.T.Helper() + t.skipped.Store(true) + t.T.Logf(format, args...) + t.T.SkipNow() +} + +func (t *skippingT) SkipNow() { + t.T.Helper() + t.skipped.Store(true) + t.T.SkipNow() +} + +func (t *skippingT) Skipped() bool { + return t.skipped.Load() +} diff --git a/vendor/knative.dev/reconciler-test/pkg/environment/timings.go b/vendor/knative.dev/reconciler-test/pkg/environment/timings.go new file mode 100644 index 000000000..aac96e828 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/environment/timings.go @@ -0,0 +1,55 @@ +/* +Copyright 2021 The Knative 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 environment + +import ( + "context" + "time" +) + +const ( + DefaultPollInterval = 3 * time.Second + DefaultPollTimeout = 2 * time.Minute +) + +type timingsKey struct{} +type timingsType struct { + interval time.Duration + timeout time.Duration +} + +// PollTimingsFromContext will get the previously set poll timing from context, +// or return the defaults if not found. +// - values from from context. +// - defaults. +func ContextWithPollTimings(ctx context.Context, interval, timeout time.Duration) context.Context { + return context.WithValue(ctx, timingsKey{}, timingsType{ + interval: interval, + timeout: timeout, + }) +} + +// PollTimingsFromContext will get the previously set poll timing from context, +// or return the defaults if not found. +// - values from from context. +// - defaults. +func PollTimingsFromContext(ctx context.Context) (time.Duration, time.Duration) { + if t, ok := ctx.Value(timingsKey{}).(timingsType); ok { + return t.interval, t.timeout + } + return DefaultPollInterval, DefaultPollTimeout +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/102-service.yaml b/vendor/knative.dev/reconciler-test/pkg/eventshub/102-service.yaml new file mode 100644 index 000000000..c3d58ba09 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/102-service.yaml @@ -0,0 +1,26 @@ +# Copyright 2020 The Knative 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 +# +# https://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. + +apiVersion: v1 +kind: Service +metadata: + name: {{ .name }} + namespace: {{ .namespace }} +spec: + selector: + app: eventshub-{{ .name }} + ports: + - protocol: TCP + port: 80 + targetPort: 8080 diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/103-pod.yaml b/vendor/knative.dev/reconciler-test/pkg/eventshub/103-pod.yaml new file mode 100644 index 000000000..80f37d081 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/103-pod.yaml @@ -0,0 +1,43 @@ +# Copyright 2020 The Knative 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 +# +# https://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. + +apiVersion: v1 +kind: Pod +metadata: + name: {{ .name }} + namespace: {{ .namespace }} + labels: + app: eventshub-{{ .name }} +spec: + serviceAccountName: "{{ .namespace }}" + restartPolicy: "Never" + containers: + - name: eventshub + image: {{ .image }} + imagePullPolicy: "IfNotPresent" + env: + - name: "SYSTEM_NAMESPACE" + valueFrom: + fieldRef: + fieldPath: "metadata.namespace" + - name: "POD_NAME" + valueFrom: + fieldRef: + fieldPath: "metadata.name" + - name: "EVENT_LOGS" + value: "recorder,logger" + {{ range $key, $value := .envs }} + - name: {{printf "%q" $key}} + value: {{printf "%q" $value}} + {{ end }} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/doc.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/doc.go new file mode 100644 index 000000000..1f285282b --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Knative 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 + + https://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. +*/ + +/* +assert contains the necessary matchers and steps to perform assertions on eventshub contents +*/ +package assert diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/event_info_matchers.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/event_info_matchers.go new file mode 100644 index 000000000..f74764d83 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/event_info_matchers.go @@ -0,0 +1,119 @@ +/* +Copyright 2020 The Knative 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 + + https://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 assert + +import ( + "fmt" + "strings" + + cloudevents "github.com/cloudevents/sdk-go/v2" + cetest "github.com/cloudevents/sdk-go/v2/test" + + "knative.dev/reconciler-test/pkg/eventshub" +) + +// Matcher that never fails +func Any() eventshub.EventInfoMatcher { + return func(ei eventshub.EventInfo) error { + return nil + } +} + +// Matcher that fails if there is an error in the EventInfo +func NoError() eventshub.EventInfoMatcher { + return func(ei eventshub.EventInfo) error { + if ei.Error != "" { + return fmt.Errorf("not expecting an error in event info: %s", ei.Error) + } + return nil + } +} + +// Convert a matcher that checks valid messages to a function +// that checks EventInfo structures, returning an error for any that don't +// contain valid events. +func MatchEvent(evf ...cetest.EventMatcher) eventshub.EventInfoMatcher { + return func(ei eventshub.EventInfo) error { + if ei.Event == nil { + return fmt.Errorf("Saw nil event") + } else { + return cetest.AllOf(evf...)(*ei.Event) + } + } +} + +// Convert a matcher that checks valid messages to a function +// that checks EventInfo structures, returning an error for any that don't +// contain valid events. +func HasAdditionalHeader(key, value string) eventshub.EventInfoMatcher { + key = strings.ToLower(key) + return func(ei eventshub.EventInfo) error { + for k, v := range ei.HTTPHeaders { + if strings.ToLower(k) == key && v[0] == value { + return nil + } + } + return fmt.Errorf("cannot find header '%s' = '%s' between the headers", key, value) + } +} + +// Reexport kinds here to simplify the usage +const ( + EventReceived = eventshub.EventReceived + EventRejected = eventshub.EventRejected + + EventSent = eventshub.EventSent + EventResponse = eventshub.EventResponse +) + +// MatchKind matches the kind of EventInfo +func MatchKind(kind eventshub.EventKind) eventshub.EventInfoMatcher { + return func(info eventshub.EventInfo) error { + if kind != info.Kind { + return fmt.Errorf("event kind don't match. Expected: '%s', Actual: '%s'", kind, info.Kind) + } + return nil + } +} + +// MatchStatusCode matches the status code of EventInfo +func MatchStatusCode(statusCode int) eventshub.EventInfoMatcher { + return func(info eventshub.EventInfo) error { + if info.StatusCode != statusCode { + return fmt.Errorf("event status code don't match. Expected: '%d', Actual: '%d'", statusCode, info.StatusCode) + } + return nil + } +} + +// MatchHeartBeatsImageMessage matches that the data field of the event, in the format of the heartbeats image, contains the following msg field +func MatchHeartBeatsImageMessage(expectedMsg string) cetest.EventMatcher { + return cetest.AllOf( + cetest.HasDataContentType(cloudevents.ApplicationJSON), + func(have cloudevents.Event) error { + var m map[string]interface{} + err := have.DataAs(&m) + if err != nil { + return fmt.Errorf("cannot parse heartbeats message %s", err.Error()) + } + if m["msg"].(string) != expectedMsg { + return fmt.Errorf("heartbeats message don't match. Expected: '%s', Actual: '%s'", expectedMsg, m["msg"].(string)) + } + return nil + }, + ) +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go new file mode 100644 index 000000000..0bfd0bb7d --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/assert/step.go @@ -0,0 +1,67 @@ +package assert + +import ( + "context" + + cetest "github.com/cloudevents/sdk-go/v2/test" + + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/feature" +) + +type MatchAssertionBuilder struct { + storeName string + matchers []eventshub.EventInfoMatcher +} + +// OnStore creates an assertion builder starting from the name of the store +func OnStore(name string) MatchAssertionBuilder { + return MatchAssertionBuilder{ + storeName: name, + matchers: nil, + } +} + +// Match adds the provided matchers in this builder +func (m MatchAssertionBuilder) Match(matchers ...eventshub.EventInfoMatcher) MatchAssertionBuilder { + m.matchers = append(m.matchers, matchers...) + return m +} + +// MatchEvent is a shortcut for Match(MatchEvent()) +func (m MatchAssertionBuilder) MatchEvent(matchers ...cetest.EventMatcher) MatchAssertionBuilder { + m.matchers = append(m.matchers, MatchEvent(matchers...)) + return m +} + +// AtLeast builds the assertion feature.StepFn +// OnStore(store).Match(matchers).AtLeast(min) is equivalent to StoreFromContext(ctx, store).AssertAtLeast(min, matchers) +func (m MatchAssertionBuilder) AtLeast(min int) feature.StepFn { + return func(ctx context.Context, t feature.T) { + eventshub.StoreFromContext(ctx, m.storeName).AssertAtLeast(t, min, m.matchers...) + } +} + +// InRange builds the assertion feature.StepFn +// OnStore(store).Match(matchers).InRange(min, max) is equivalent to StoreFromContext(ctx, store).AssertInRange(min, max, matchers) +func (m MatchAssertionBuilder) InRange(min int, max int) feature.StepFn { + return func(ctx context.Context, t feature.T) { + eventshub.StoreFromContext(ctx, m.storeName).AssertInRange(t, min, max, m.matchers...) + } +} + +// Exact builds the assertion feature.StepFn +// OnStore(store).Match(matchers).Exact(n) is equivalent to StoreFromContext(ctx, store).AssertExact(n, matchers) +func (m MatchAssertionBuilder) Exact(n int) feature.StepFn { + return func(ctx context.Context, t feature.T) { + eventshub.StoreFromContext(ctx, m.storeName).AssertExact(t, n, m.matchers...) + } +} + +// Not builds the assertion feature.StepFn +// OnStore(store).Match(matchers).Not() is equivalent to StoreFromContext(ctx, store).AssertNot(matchers) +func (m MatchAssertionBuilder) Not() feature.StepFn { + return func(ctx context.Context, t feature.T) { + eventshub.StoreFromContext(ctx, m.storeName).AssertNot(t, m.matchers...) + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfibonacci/fibonacci.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfibonacci/fibonacci.go new file mode 100644 index 000000000..f0106cd2a --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfibonacci/fibonacci.go @@ -0,0 +1,34 @@ +/* +Copyright 2020 The Knative 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 dropeventsfibonacci + +type Fibonacci struct { + Prev uint64 + Current uint64 +} + +func (f *Fibonacci) Skip(counter uint64) bool { + if f.Current == counter { + f.Next() + return true + } + return false +} + +func (f *Fibonacci) Next() { + f.Prev, f.Current = f.Current, f.Prev+f.Current +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfirst/sequence.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfirst/sequence.go new file mode 100644 index 000000000..9f223b1a7 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfirst/sequence.go @@ -0,0 +1,25 @@ +/* +Copyright 2020 The Knative 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 dropeventsfirst + +type First struct { + N uint64 +} + +func (f First) Skip(counter uint64) bool { + return f.N >= counter +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/receiver.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/receiver.go new file mode 100644 index 000000000..5b2f21dd3 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/dropevents/receiver.go @@ -0,0 +1,71 @@ +/* +Copyright 2020 The Knative 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 dropevents + +import ( + "sync" + + "knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfibonacci" + "knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfirst" +) + +const ( + Fibonacci = "fibonacci" + Sequence = "sequence" +) + +// Skipper represents the logic to apply to accept/reject events. +type Skipper interface { + // Skip returns true if the message must be rejected + Skip(counter uint64) bool +} + +type noopSkip struct{} + +var NoopSkipper Skipper = noopSkip{} + +func (n noopSkip) Skip(uint64) bool { + return false +} + +type CounterHandler struct { + counter uint64 + Skipper Skipper + sync.Mutex +} + +func (h *CounterHandler) Skip() bool { + h.Lock() + defer h.Unlock() + + h.counter++ + return h.Skipper.Skip(h.counter) +} + +// count is only used for SKIP_ALGORITHM=Sequence. +func SkipperAlgorithmWithCount(algorithm string, count uint64) Skipper { + switch algorithm { + case Fibonacci: + return &dropeventsfibonacci.Fibonacci{Prev: 1, Current: 1} + + case Sequence: + return dropeventsfirst.First{N: count} + + default: + panic("unknown algorithm: " + algorithm) + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/event_info.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/event_info.go new file mode 100644 index 000000000..e8f2ca054 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/event_info.go @@ -0,0 +1,130 @@ +/* +Copyright 2020 The Knative 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 + + https://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 eventshub + +import ( + "fmt" + "strings" + "time" + + cloudevents "github.com/cloudevents/sdk-go/v2" +) + +const ( + // EventReason is the Kubernetes event reason used for observed events. + CloudEventObservedReason = "CloudEventObserved" +) + +type EventKind string + +const ( + EventReceived EventKind = "Received" + EventRejected EventKind = "Rejected" + + EventSent EventKind = "Sent" + EventResponse EventKind = "Response" +) + +// Structure to hold information about an event seen by eventshub pod. +type EventInfo struct { + Kind EventKind `json:"kind"` + + // Set if the http request received by the pod couldn't be decoded or + // didn't pass validation + Error string `json:"error,omitempty"` + // Event received if the cloudevent received by the pod passed validation + Event *cloudevents.Event `json:"event,omitempty"` + // In case there is a valid event in this instance, this contains all the HTTP headers, + // including the CE- headers. + HTTPHeaders map[string][]string `json:"httpHeaders,omitempty"` + // In case there is a valid event in this instance, this field is not filled + Body []byte `json:"body,omitempty"` + + StatusCode int `json:"statusCode,omitempty"` + + Origin string `json:"origin,omitempty"` + Observer string `json:"observer,omitempty"` + Time time.Time `json:"time,omitempty"` + Sequence uint64 `json:"sequence"` + // SentId is just a correlator to correlate EventSent and EventResponse kinds. + // This is filled with the ID of the sent event (if any) and in the Response also + // jot it down so you can correlate which event (ID) as well as sequence to match sent/response 1:1. + SentId string `json:"id"` + + // AdditionalInfo can be used by event generator implementations to add more event details + AdditionalInfo map[string]interface{} `json:"additionalInfo"` +} + +// Pretty print the event. Meant for debugging. +func (ei *EventInfo) String() string { + var sb strings.Builder + sb.WriteString("-- EventInfo --\n") + sb.WriteString(fmt.Sprintf("--- Kind: %v ---\n", ei.Kind)) + if ei.Event != nil { + sb.WriteString("--- Event ---\n") + sb.WriteString(ei.Event.String()) + sb.WriteRune('\n') + } + if ei.Error != "" { + sb.WriteString("--- Error ---\n") + sb.WriteString(ei.Error) + sb.WriteRune('\n') + } + if len(ei.HTTPHeaders) != 0 { + sb.WriteString("--- HTTP headers ---\n") + for k, v := range ei.HTTPHeaders { + sb.WriteString(" " + k + ": " + v[0] + "\n") + } + sb.WriteRune('\n') + } + if ei.Body != nil { + sb.WriteString("--- Body ---\n") + sb.Write(ei.Body) + sb.WriteRune('\n') + } + if ei.StatusCode != 0 { + sb.WriteString(fmt.Sprintf("--- Status Code: %d ---\n", ei.StatusCode)) + } + sb.WriteString("--- Origin: '" + ei.Origin + "' ---\n") + sb.WriteString("--- Observer: '" + ei.Observer + "' ---\n") + sb.WriteString("--- Time: " + ei.Time.String() + " ---\n") + sb.WriteString(fmt.Sprintf("--- Sequence: %d ---\n", ei.Sequence)) + sb.WriteString("--- Sent Id: '" + ei.SentId + " ---\n") + sb.WriteString("--------------------\n") + return sb.String() +} + +// This is mainly used for providing better failure messages +type SearchedInfo struct { + TotalEvent int + LastNEvent []EventInfo + + StoreEventsSeen int + StoreEventsNotMine int +} + +// Pretty print the SearchedInfor for error messages +func (s *SearchedInfo) String() string { + var sb strings.Builder + sb.WriteString(fmt.Sprintf("%d events seen, last %d events (total events seen %d, events ignored %d):\n", + s.TotalEvent, len(s.LastNEvent), s.StoreEventsSeen, s.StoreEventsNotMine)) + for _, ei := range s.LastNEvent { + sb.WriteString(ei.String()) + sb.WriteRune('\n') + } + return sb.String() +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/event_info_store.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/event_info_store.go new file mode 100644 index 000000000..481962a41 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/event_info_store.go @@ -0,0 +1,248 @@ +/* +Copyright 2020 The Knative 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 + + https://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 eventshub + +import ( + "context" + "encoding/json" + "fmt" + "strconv" + "strings" + "sync" + "time" + + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/wait" + + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/k8s" +) + +const ( + // The interval and timeout used for checking events + retryInterval = 4 * time.Second + retryTimeout = 4 * time.Minute +) + +// EventInfoMatcher returns an error if the input event info doesn't match the criteria +type EventInfoMatcher func(EventInfo) error + +// Stateful store of events published by eventshub pod it is pointed at. +// Implements k8s.EventHandler +type Store struct { + podName string + podNamespace string + + lock sync.Mutex + collected []EventInfo + + eventsSeen int + eventsNotMine int +} + +func StoreFromContext(ctx context.Context, name string) *Store { + if store, ok := k8s.EventListenerFromContext(ctx).GetHandler(name).(*Store); ok && store != nil { + return store + } + panic("no event store found in the context for the provided name " + name) +} + +func registerEventsHubStore(eventListener *k8s.EventListener, t feature.T, podName string, podNamespace string) { + store := &Store{ + podName: podName, + podNamespace: podNamespace, + } + + numEventsAlreadyPresent := eventListener.AddHandler(podName, store) + t.Logf("Store added to the EventListener, which has already seen %v events", numEventsAlreadyPresent) +} + +func (ei *Store) getDebugInfo() string { + return fmt.Sprintf("Pod '%s' in namespace '%s'", ei.podName, ei.podNamespace) +} + +func (ei *Store) Collected() []EventInfo { + ei.lock.Lock() + defer ei.lock.Unlock() + return ei.collected +} + +func (ei *Store) Handle(event *corev1.Event) { + ei.lock.Lock() + defer ei.lock.Unlock() + ei.eventsSeen += 1 + // Filter events + if !ei.isMyEvent(event) { + ei.eventsNotMine += 1 + return + } + + eventInfo := EventInfo{} + err := json.Unmarshal([]byte(event.Message), &eventInfo) + if err != nil { + fmt.Printf("[ERROR] Received EventInfo that cannot be unmarshalled! \n----\n%s\n----\n%+v\n", event.Message, err) + return + } + + ei.collected = append(ei.collected, eventInfo) +} + +func (ei *Store) isMyEvent(event *corev1.Event) bool { + return event.Type == corev1.EventTypeNormal && + event.Reason == CloudEventObservedReason && + event.InvolvedObject.Kind == "Pod" && + event.InvolvedObject.Name == ei.podName && + event.InvolvedObject.Namespace == ei.podNamespace +} + +// Find all events received by the eventshub pod that match the provided matchers, +// returning all matching events as well as a SearchedInfo structure including the +// last 5 events seen and the total events matched. This SearchedInfo structure +// is primarily to ease debugging in failure printouts. The provided function is +// guaranteed to be called exactly once on each EventInfo from the pod. +// The error array contains the eventual match errors, while the last return error contains +// an eventual communication error while trying to get the events from the eventshub pod +func (ei *Store) Find(matchers ...EventInfoMatcher) ([]EventInfo, SearchedInfo, []error, error) { + f := allOf(matchers...) + const maxLastEvents = 5 + allMatch := []EventInfo{} + ei.lock.Lock() + sInfo := SearchedInfo{ + StoreEventsSeen: ei.eventsSeen, + StoreEventsNotMine: ei.eventsNotMine, + } + ei.lock.Unlock() + lastEvents := []EventInfo{} + var nonMatchingErrors []error + + allEvents := ei.Collected() + for i := range allEvents { + if err := f(allEvents[i]); err == nil { + allMatch = append(allMatch, allEvents[i]) + } else { + nonMatchingErrors = append(nonMatchingErrors, err) + } + lastEvents = append(lastEvents, allEvents[i]) + if len(lastEvents) > maxLastEvents { + copy(lastEvents, lastEvents[1:]) + lastEvents = lastEvents[:maxLastEvents] + } + } + sInfo.LastNEvent = lastEvents + sInfo.TotalEvent = len(allEvents) + + return allMatch, sInfo, nonMatchingErrors, nil +} + +// AssertAtLeast assert that there are at least min number of match for the provided matchers. +// This method fails the test if the assert is not fulfilled. +func (ei *Store) AssertAtLeast(t feature.T, min int, matchers ...EventInfoMatcher) []EventInfo { + events, err := ei.waitAtLeastNMatch(allOf(matchers...), min) + if err != nil { + t.Fatalf("Timeout waiting for at least %d matches.\nError: %+v", min, errors.WithStack(err)) + } + return events +} + +// AssertInRange asserts that there are at least min number of matches and at most max number of matches for the provided matchers. +// This method fails the test if the assert is not fulfilled. +func (ei *Store) AssertInRange(t feature.T, min int, max int, matchers ...EventInfoMatcher) []EventInfo { + events := ei.AssertAtLeast(t, min, matchers...) + if max > 0 && len(events) > max { + t.Fatalf("Assert in range failed: %+v", errors.WithStack(fmt.Errorf("expected <= %d events, saw %d", max, len(events)))) + } + return events +} + +// AssertNot asserts that there aren't any matches for the provided matchers. +// This method fails the test if the assert is not fulfilled. +func (ei *Store) AssertNot(t feature.T, matchers ...EventInfoMatcher) []EventInfo { + res, recentEvents, _, err := ei.Find(matchers...) + if err != nil { + t.Fatalf("Unexpected error during find on eventshub '%s': %+v", ei.podName, errors.WithStack(err)) + } + + if len(res) != 0 { + t.Fatalf("Assert not failed: %+v", errors.WithStack( + fmt.Errorf("Unexpected matches on eventshub '%s', found: %v. %s", ei.podName, res, &recentEvents)), + ) + } + return res +} + +// AssertExact assert that there are exactly n matches for the provided matchers. +// This method fails the test if the assert is not fulfilled. +func (ei *Store) AssertExact(t feature.T, n int, matchers ...EventInfoMatcher) []EventInfo { + events := ei.AssertInRange(t, n, n, matchers...) + return events +} + +// Wait a long time (currently 4 minutes) until the provided function matches at least +// five events. The matching events are returned if we find at least n. If the +// function times out, an error is returned. +// If you need to perform assert on the result (aka you want to fail if error != nil), then use AssertAtLeast +func (ei *Store) waitAtLeastNMatch(f EventInfoMatcher, min int) ([]EventInfo, error) { + var matchRet []EventInfo + var internalErr error + + wait.PollImmediate(retryInterval, retryTimeout, func() (bool, error) { + allMatch, sInfo, matchErrs, err := ei.Find(f) + if err != nil { + internalErr = fmt.Errorf("FAIL MATCHING: unexpected error during find: %v", err) + return false, nil + } + count := len(allMatch) + if count < min { + internalErr = fmt.Errorf( + "FAIL MATCHING: saw %d/%d matching events.\n- Store-\n%s\n- Recent events -\n%s\n- Match errors -\n%s\n", + count, + min, + ei.getDebugInfo(), + &sInfo, + formatErrors(matchErrs), + ) + return false, nil + } + matchRet = allMatch + internalErr = nil + return true, nil + }) + return matchRet, internalErr +} + +func formatErrors(errs []error) string { + var sb strings.Builder + for i, err := range errs { + sb.WriteString(strconv.Itoa(i) + " - ") + sb.WriteString(err.Error()) + sb.WriteRune('\n') + } + return sb.String() +} + +// We don't need to expose this, since all the signatures already executes this +func allOf(matchers ...EventInfoMatcher) EventInfoMatcher { + return func(have EventInfo) error { + for _, m := range matchers { + if err := m(have); err != nil { + return err + } + } + return nil + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/event_log.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/event_log.go new file mode 100644 index 000000000..dc17e88f5 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/event_log.go @@ -0,0 +1,53 @@ +/* +Copyright 2020 The Knative 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 eventshub + +import "sync" + +// EventLog is the contract for an event logger to vent an event. +type EventLog interface { + Vent(observed EventInfo) error +} + +// EventLogs is a struct to hold different EventLog and run them, guarded by a lock +type EventLogs struct { + mutex sync.Mutex + logs []EventLog +} + +func NewEventLogs(logs ...EventLog) *EventLogs { + return &EventLogs{logs: logs} +} + +func (e *EventLogs) Vent(observed EventInfo) error { + e.mutex.Lock() + defer e.mutex.Unlock() + for _, el := range e.logs { + if err := el.Vent(observed); err != nil { + return err + } + } + return nil +} + +const ( + ReceiverEventGenerator string = "receiver" + SenderEventGenerator string = "sender" + + RecorderEventLog string = "recorder" + LoggerEventLog string = "logger" +) diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/eventshub.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/eventshub.go new file mode 100644 index 000000000..acf491118 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/eventshub.go @@ -0,0 +1,97 @@ +/* +Copyright 2020 The Knative 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 + + https://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 eventshub + +import ( + "context" + + "github.com/kelseyhightower/envconfig" + "golang.org/x/sync/errgroup" + "knative.dev/pkg/injection" + "knative.dev/pkg/logging" +) + +type envConfig struct { + EventGenerators []string `envconfig:"EVENT_GENERATORS" required:"true"` + EventLogs []string `envconfig:"EVENT_LOGS" required:"true"` +} + +// EventLogFactory creates a new EventLog instance. +type EventLogFactory func(context.Context) (EventLog, error) + +// EventGeneratorStarter starts a new event generator. This function is executed in a separate goroutine, so it can block. +type EventGeneratorStarter func(context.Context, *EventLogs) error + +// Start starts a new eventshub process, with the provided factories. +// You can create your own eventshub providing event log factories and event generator factories. +func Start(eventLogFactories map[string]EventLogFactory, eventGeneratorFactories map[string]EventGeneratorStarter) { + //nolint // nil ctx is fine here, look at the code of EnableInjectionOrDie + ctx, _ := injection.EnableInjectionOrDie(nil, nil) + ctx = ConfigureLogging(ctx, "eventshub") + + if err := ConfigureTracing(logging.FromContext(ctx), ""); err != nil { + logging.FromContext(ctx).Fatal("Unable to setup trace publishing", err) + } + + var env envConfig + if err := envconfig.Process("", &env); err != nil { + logging.FromContext(ctx).Fatal("Failed to process env var", err) + } + logging.FromContext(ctx).Infof("Events Hub environment configuration: %+v", env) + + eventLogs := createEventLogs(ctx, eventLogFactories, env.EventLogs) + err := startEventGenerators(ctx, eventGeneratorFactories, env.EventGenerators, eventLogs) + + if err != nil { + logging.FromContext(ctx).Fatal("Error during start: ", err) + } + + logging.FromContext(ctx).Info("Closing the eventshub process") +} + +func createEventLogs(ctx context.Context, factories map[string]EventLogFactory, logTypes []string) *EventLogs { + var eventLogs []EventLog + for _, logType := range logTypes { + factory, ok := factories[logType] + if !ok { + logging.FromContext(ctx).Fatal("Cannot recognize event log type: ", logType) + } + + eventLog, err := factory(ctx) + if err != nil { + logging.FromContext(ctx).Fatalf("Error while instantiating the event log %s: %s", logType, err) + } + + eventLogs = append(eventLogs, eventLog) + } + return NewEventLogs(eventLogs...) +} + +func startEventGenerators(ctx context.Context, factories map[string]EventGeneratorStarter, genTypes []string, eventLogs *EventLogs) error { + errs, _ := errgroup.WithContext(ctx) + for _, genType := range genTypes { + factory, ok := factories[genType] + if !ok { + logging.FromContext(ctx).Fatal("Cannot recognize event generator type: ", genType) + } + + errs.Go(func() error { + return factory(ctx, eventLogs) + }) + } + return errs.Wait() +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/eventshub_image.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/eventshub_image.go new file mode 100644 index 000000000..5c79e80ed --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/eventshub_image.go @@ -0,0 +1,45 @@ +/* +Copyright 2021 The Knative 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 + + https://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 eventshub + +import ( + "context" + + "knative.dev/reconciler-test/pkg/environment" +) + +const ( + thisPackage = "knative.dev/reconciler-test/cmd/eventshub" + defaultEventshubImage = "ko://" + thisPackage +) + +type eventshubImageKey struct{} + +// ImageFromContext gets the eventshub image from context +func ImageFromContext(ctx context.Context) string { + if e, ok := ctx.Value(eventshubImageKey{}).(string); ok { + return e + } + return defaultEventshubImage +} + +// WithCustomImage allows you to specify a custom eventshub image to be used when invoking eventshub.Install +func WithCustomImage(image string) environment.EnvOpts { + return func(ctx context.Context, env environment.Environment) (context.Context, error) { + return context.WithValue(ctx, eventshubImageKey{}, image), nil + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/logger_vent/logger.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/logger_vent/logger.go new file mode 100644 index 000000000..90247e13d --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/logger_vent/logger.go @@ -0,0 +1,29 @@ +/* +Copyright 2020 The Knative 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 logger_vent + +import ( + "knative.dev/reconciler-test/pkg/eventshub" +) + +type Logger func(string, ...interface{}) + +func (l Logger) Vent(observed eventshub.EventInfo) error { + l("Event: \n%s", observed.String()) + + return nil +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/options.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/options.go new file mode 100644 index 000000000..3032726dd --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/options.go @@ -0,0 +1,272 @@ +/* +Copyright 2020 The Knative 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 + + https://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 eventshub + +import ( + "context" + "encoding/json" + "fmt" + "math" + "strconv" + "time" + + cloudevents "github.com/cloudevents/sdk-go/v2" + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/network" + + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/eventshub/dropevents" + "knative.dev/reconciler-test/pkg/k8s" +) + +// EventsHubOption is used to define an env for the eventshub image +type EventsHubOption = func(context.Context, map[string]string) error + +// StartReceiver starts the receiver in the eventshub +// This can be used together with EchoEvent, ReplyWithTransformedEvent, ReplyWithAppendedData +var StartReceiver EventsHubOption = envAdditive("EVENT_GENERATORS", "receiver") + +// StartSender starts the sender in the eventshub +// This can be used together with InputEvent, AddTracing, EnableIncrementalId, InputEncoding and InputHeader options +func StartSender(sinkSvc string) EventsHubOption { + return compose(envAdditive("EVENT_GENERATORS", "sender"), func(ctx context.Context, envs map[string]string) error { + envs["SINK"] = "http://" + network.GetServiceHostname(sinkSvc, environment.FromContext(ctx).Namespace()) + return nil + }) +} + +// StartSenderToResource starts the sender in the eventshub pointing to the provided resource +// This can be used together with InputEvent, AddTracing, EnableIncrementalId, InputEncoding and InputHeader options +func StartSenderToResource(gvr schema.GroupVersionResource, name string) EventsHubOption { + return compose(envAdditive("EVENT_GENERATORS", "sender"), func(ctx context.Context, envs map[string]string) error { + u, err := k8s.Address(ctx, gvr, name) + if err != nil { + return err + } + if u == nil { + return fmt.Errorf("resource %v named %s is not addressable", gvr, name) + } + envs["SINK"] = u.String() + return nil + }) +} + +// StartSenderURL starts the sender in the eventshub sinking to a URL. +// This can be used together with InputEvent, AddTracing, EnableIncrementalId, InputEncoding and InputHeader options +func StartSenderURL(sink string) EventsHubOption { + return compose(envAdditive("EVENT_GENERATORS", "sender"), func(ctx context.Context, envs map[string]string) error { + envs["SINK"] = sink + return nil + }) +} + +// --- Receiver options + +// EchoEvent is an option to let the eventshub reply with the received event +var EchoEvent EventsHubOption = envOption("REPLY", "true") + +// ReplyWithTransformedEvent is an option to let the eventshub reply with the transformed event +func ReplyWithTransformedEvent(replyEventType string, replyEventSource string, replyEventData string) EventsHubOption { + return compose( + envOption("REPLY", "true"), + envOptionalOpt("REPLY_EVENT_TYPE", replyEventType), + envOptionalOpt("REPLY_EVENT_SOURCE", replyEventSource), + envOptionalOpt("REPLY_EVENT_DATA", replyEventData), + ) +} + +// ReplyWithAppendedData is an option to let the eventshub reply with the transformed event with appended data +func ReplyWithAppendedData(appendData string) EventsHubOption { + return compose( + envOption("REPLY", "true"), + envOptionalOpt("REPLY_APPEND_DATA", appendData), + ) +} + +// ResponseWaitTime defines how much the receiver has to wait before replying. +func ResponseWaitTime(delay time.Duration) EventsHubOption { + return envDuration("RESPONSE_WAIT_TIME", delay) +} + +// FibonacciDrop will cause the receiver to reply with a bad status code following the fibonacci sequence +var FibonacciDrop = envOption("SKIP_ALGORITHM", dropevents.Fibonacci) + +// DropFirstN will cause the receiver to reply with a bad status code to the first n events +func DropFirstN(n uint) EventsHubOption { + return compose( + envOption("SKIP_ALGORITHM", dropevents.Sequence), + envOption("SKIP_COUNTER", strconv.FormatUint(uint64(n), 10)), + ) +} + +// DropEventsResponseCode will cause the receiver to reply with the specific status code to the dropped events +func DropEventsResponseCode(code int) EventsHubOption { + return compose( + envOption("SKIP_RESPONSE_CODE", strconv.Itoa(code)), + ) +} + +// DropEventsResponseHeaders will cause the receiver to reply with the specific headers to the dropped events +func DropEventsResponseHeaders(headers map[string]string) EventsHubOption { + headerEnvConfigString := "" + for k, v := range headers { + if headerEnvConfigString != "" { + headerEnvConfigString = headerEnvConfigString + "," + } + headerEnvConfigString = fmt.Sprintf("%s%s:%s", headerEnvConfigString, k, v) // Format as envconfig map[string]string + } + return compose( + envOptionalOpt("SKIP_RESPONSE_HEADERS", headerEnvConfigString), + ) +} + +// --- Sender options + +// InitialSenderDelay defines how much the sender has to wait (in millisecond), when started, before start sending events. +// Note: this delay is executed before the probe sink. +func InitialSenderDelay(delay time.Duration) EventsHubOption { + return envDuration("DELAY", delay) +} + +// EnableProbeSink probes the sink with HTTP head requests up until the sink replies. +// The specified duration defines the maximum timeout to probe it, before failing. +// Note: the probe sink is executed after the initial delay +func EnableProbeSink(timeout time.Duration) EventsHubOption { + return compose( + envOption("PROBE_SINK", "true"), + envDuration("PROBE_SINK_TIMEOUT", timeout), + ) +} + +// DisableProbeSink will disable the probe sink feature of sender, starting sending directly events after it's started. +var DisableProbeSink = envOption("PROBE_SINK", "false") + +// InputYAML is an option to provide the events to send via yaml path when deploying the event sender +func InputYAML(path string) EventsHubOption { + return envAdditive("INPUT_YAML", path) +} + +// InputEvent is an option to provide the event to send when deploying the event sender +func InputEvent(event cloudevents.Event) EventsHubOption { + encodedEvent, err := json.Marshal(event) + if err != nil { + return func(ctx context.Context, envs map[string]string) error { + return err + } + } + return envOption("INPUT_EVENT", string(encodedEvent)) +} + +// InputEventWithEncoding is an option to provide the event to send when deploying the event sender forcing the specified encoding. +func InputEventWithEncoding(event cloudevents.Event, encoding cloudevents.Encoding) EventsHubOption { + encodedEvent, err := json.Marshal(event) + if err != nil { + return func(ctx context.Context, envs map[string]string) error { + return err + } + } + return compose( + envOption("INPUT_EVENT", string(encodedEvent)), + envOption("EVENT_ENCODING", encoding.String()), + ) +} + +// InputHeader adds the following header to the sent headers. +func InputHeader(k, v string) EventsHubOption { + return envAdditive("INPUT_HEADERS", k+":"+v) +} + +// InputBody overwrites the request header with the following body. +func InputBody(b string) EventsHubOption { + return envOption("INPUT_BODY", b) +} + +// InputMethod overrides which http method to use when sending events (default is POST) +func InputMethod(method string) EventsHubOption { + return envOption("INPUT_METHOD", method) +} + +// AddTracing adds tracing headers when sending events. +var AddTracing = envOption("ADD_TRACING", "true") + +// AddSequence adds an extension named 'sequence' which contains the incremental number of sent events +// (similar to EnableIncrementalId, but without overwriting the id attribute). +var AddSequence = envOption("ADD_SEQUENCE", "true") + +// EnableIncrementalId replaces the event id with a new incremental id for each sent event. +var EnableIncrementalId = envOption("INCREMENTAL_ID", "true") + +// OverrideTime overrides the event time with the time when sending the event. +var OverrideTime = envOption("OVERRIDE_TIME", "true") + +// SendMultipleEvents defines how much events to send and the period (in millisecond) between them. +func SendMultipleEvents(numberOfEvents int, period time.Duration) EventsHubOption { + return compose( + envOption("MAX_MESSAGES", strconv.Itoa(numberOfEvents)), + envDuration("PERIOD", period), + ) +} + +// --- Options utils + +func noop(context.Context, map[string]string) error { + return nil +} + +func compose(options ...EventsHubOption) EventsHubOption { + return func(ctx context.Context, envs map[string]string) error { + for _, opt := range options { + if err := opt(ctx, envs); err != nil { + return err + } + } + return nil + } +} + +func envOptionalOpt(key, value string) EventsHubOption { + if value != "" { + return func(ctx context.Context, envs map[string]string) error { + envs[key] = value + return nil + } + } else { + return noop + } +} + +func envOption(key, value string) EventsHubOption { + return func(ctx context.Context, envs map[string]string) error { + envs[key] = value + return nil + } +} + +func envAdditive(key, value string) EventsHubOption { + return func(ctx context.Context, m map[string]string) error { + if containedValue, ok := m[key]; ok { + m[key] = containedValue + "," + value + } else { + m[key] = value + } + return nil + } +} + +func envDuration(key string, value time.Duration) EventsHubOption { + return envOption(key, strconv.Itoa(int(math.Ceil(value.Seconds())))) +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/prober.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/prober.go new file mode 100644 index 000000000..8f18f7662 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/prober.go @@ -0,0 +1,424 @@ +/* +Copyright 2021 The Knative 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 eventshub + +import ( + "context" + "errors" + "fmt" + "log" + "strconv" + "time" + + conformanceevent "github.com/cloudevents/conformance/pkg/event" + cetest "github.com/cloudevents/sdk-go/v2/test" + "github.com/google/uuid" + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/wait" + duckv1 "knative.dev/pkg/apis/duck/v1" + + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/resources/svc" +) + +func NewProber() *EventProber { + return &EventProber{ + shortNameToName: make(map[string]string), + } +} + +type EventProber struct { + target target + shortNameToName map[string]string + ids []string + senderOptions []EventsHubOption + receiverOptions []EventsHubOption +} + +type target struct { + // Need [GVR + Name] OR [URI] + gvr schema.GroupVersionResource + name string + uri string +} + +type EventInfoCombined struct { + Sent EventInfo + Response EventInfo +} + +// SetTargetResource configures the senders target as a GVR and name, used when sender is installed. +func (p *EventProber) SetTargetResource(targetGVR schema.GroupVersionResource, targetName string) { + p.target = target{ + gvr: targetGVR, + name: targetName, + } +} + +// SetTargetKRef configures the senders target as KRef, used when sender is installed. +// Note: namespace is ignored. +func (p *EventProber) SetTargetKRef(ref *duckv1.KReference) error { + gv, err := schema.ParseGroupVersion(ref.APIVersion) + if err != nil { + return err + } + gvk := schema.GroupVersionKind{ + Group: gv.Group, + Version: gv.Version, + Kind: ref.Kind, + } + gvr, _ := meta.UnsafeGuessKindToResource(gvk) + p.target = target{ + gvr: gvr, + name: ref.Name, + } + return nil +} + +// SetTargetURI configures the senders target as a URI, used when sender is installed. +func (p *EventProber) SetTargetURI(targetURI string) { + p.target = target{ + uri: targetURI, + } +} + +// ReceiversRejectFirstN adds DropFirstN to the default config for new receivers. +func (p *EventProber) ReceiversRejectFirstN(n uint) { + p.receiverOptions = append(p.receiverOptions, DropFirstN(n)) +} + +// ReceiversRejectResponseCode adds DropEventsResponseCode to the default config for new receivers. +func (p *EventProber) ReceiversRejectResponseCode(code int) { + p.receiverOptions = append(p.receiverOptions, DropEventsResponseCode(code)) +} + +// ReceiversHaveResponseDelay adds ResponseWaitTime to the default config for +// new receivers. +func (p *EventProber) ReceiversHaveResponseDelay(delay time.Duration) { + p.receiverOptions = append(p.receiverOptions, ResponseWaitTime(delay)) +} + +// ReceiverInstall installs an eventshub receiver into the test env. +func (p *EventProber) ReceiverInstall(prefix string, opts ...EventsHubOption) feature.StepFn { + name := feature.MakeRandomK8sName(prefix) + p.shortNameToName[prefix] = name + opts = append(p.receiverOptions, opts...) + opts = append(opts, StartReceiver) + return Install(name, opts...) +} + +// SenderInstall installs an eventshub sender resource into the test env. +func (p *EventProber) SenderInstall(prefix string, opts ...EventsHubOption) feature.StepFn { + name := feature.MakeRandomK8sName(prefix) + p.shortNameToName[prefix] = name + return func(ctx context.Context, t feature.T) { + opts := append(opts, p.senderOptions...) + if len(p.target.uri) > 0 { + opts = append(opts, StartSenderURL(p.target.uri)) + } else if !p.target.gvr.Empty() { + opts = append(opts, StartSenderToResource(p.target.gvr, p.target.name)) + } else { + t.Fatal("no target is configured for event loop") + } + // Install into the env. + Install(name, opts...)(ctx, t) + } +} + +// SenderDone will poll until the sender sends all expected events. +func (p *EventProber) SenderDone(prefix string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + interval, timeout := environment.PollTimingsFromContext(ctx) + err := wait.PollImmediate(interval, timeout, func() (bool, error) { + events := p.SentBy(ctx, prefix) + log.Println(p.shortNameToName[prefix], "has sent", len(events)) + if len(events) == len(p.ids) { + return true, nil + } + return false, nil + }) + if err != nil { + t.Fatalf("timeout while waiting for sender to deliver all expected events: %v", err) + } + } +} + +// ReceiverDone will poll until the receiver has received all expected events. +func (p *EventProber) ReceiverDone(from, to string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + interval, timeout := environment.PollTimingsFromContext(ctx) + err := wait.PollImmediate(interval, timeout, func() (bool, error) { + sent := p.SentBy(ctx, from) + log.Println(p.shortNameToName[from], "has sent", len(sent)) + + received := p.ReceivedBy(ctx, to) + log.Println(p.shortNameToName[to], "has received", len(received)) + + rejected := p.RejectedBy(ctx, to) + log.Println(p.shortNameToName[to], "has rejected", len(rejected)) + + if len(sent) == len(received)+len(rejected) { + return true, nil + } + return false, nil + }) + if err != nil { + t.Fatalf("timeout while waiting for receiver to receive all expected events: %v", err) + } + } +} + +// CorrelateSent takes in an array of mixed Sent / Response events (matched with sentEventMatcher for example) +// and correlates them based on the sequence into a pair. +func CorrelateSent(origin string, in []EventInfo) []EventInfoCombined { + var out []EventInfoCombined + // not too many events, this will suffice... + for i, e := range in { + if e.Origin == origin && e.Kind == EventSent { + looking := e.Sequence + for j := i + 1; j <= len(in)-1; j++ { + if in[j].Kind == EventResponse && in[j].Sequence == looking { + out = append(out, EventInfoCombined{Sent: e, Response: in[j]}) + } + } + } + } + return out +} + +// SentBy returns events sent by the named sender. +func (p *EventProber) SentBy(ctx context.Context, prefix string) []EventInfoCombined { + name := p.shortNameToName[prefix] + store := StoreFromContext(ctx, name) + + return CorrelateSent(name, store.Collected()) +} + +// ReceivedBy returns events received by the named receiver. +func (p *EventProber) ReceivedBy(ctx context.Context, prefix string) []EventInfo { + name := p.shortNameToName[prefix] + store := StoreFromContext(ctx, name) + + events, _, _, _ := store.Find(func(info EventInfo) error { + if info.Observer == name && info.Kind == EventReceived { + return nil + } + return errors.New("not a match") + }) + + return events +} + +// RejectedBy returns events rejected by the named receiver. +func (p *EventProber) RejectedBy(ctx context.Context, prefix string) []EventInfo { + name := p.shortNameToName[prefix] + store := StoreFromContext(ctx, name) + + events, _, _, _ := store.Find(func(info EventInfo) error { + if info.Observer == name && info.Kind == EventRejected { + return nil + } + return errors.New("not a match") + }) + + return events +} + +// ReceivedOrRejectedBy returns events received or rejected by the named receiver. +func (p *EventProber) ReceivedOrRejectedBy(ctx context.Context, prefix string) []EventInfo { + name := p.shortNameToName[prefix] + store := StoreFromContext(ctx, name) + + events, _, _, _ := store.Find(func(info EventInfo) error { + if info.Observer == name && (info.Kind == EventReceived || info.Kind == EventRejected) { + return nil + } + return errors.New("not a match") + }) + + return events +} + +// ExpectYAMLEvents registered expected events into the prober. +func (p *EventProber) ExpectYAMLEvents(path string) error { + events, err := conformanceevent.FromYaml(path, true) + if err != nil { + return err + } + if len(events) == 0 { + return fmt.Errorf("failed to load events from %q", path) + } + for _, event := range events { + p.ids = append(p.ids, event.Attributes.ID) + } + return nil +} + +// ExpectEvents registers event IDs into the prober. +func (p *EventProber) ExpectEvents(ids []string) { + p.ids = append(p.ids, ids...) +} + +// SenderEventsFromURI configures a sender to send a url/yaml based events. +func (p *EventProber) SenderEventsFromURI(uri string) { + p.senderOptions = append(p.senderOptions, InputYAML(uri)) +} + +// SenderEventsFromSVC configures a sender to send a yaml based events fetched +// a service in the testing environment. Namespace of the svc will come from +// env.Namespace(), based on context from the StepFn. +func (p *EventProber) SenderEventsFromSVC(svcName, path string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + u, err := svc.Address(ctx, svcName) + if err != nil { + t.Error(err) + } + u.Path = path + p.senderOptions = append(p.senderOptions, InputYAML(u.String())) + } +} + +// SenderFullEvents creates `count` cloudevents.FullEvent events with new IDs into a +// sender and registers them for the prober. +// Warning: only call once. +func (p *EventProber) SenderFullEvents(count int) { + event := cetest.FullEvent() + if count == 1 { + id := uuid.New().String() + event.SetID(id) + p.ids = []string{id} + p.senderOptions = append(p.senderOptions, InputEvent(event)) + } else { + p.senderOptions = append(p.senderOptions, + InputEvent(event), SendMultipleEvents(count, 10*time.Millisecond), EnableIncrementalId) // TODO: make configurable. + p.ids = []string{} + for i := 1; i <= count; i++ { + p.ids = append(p.ids, strconv.Itoa(i)) + } + } +} + +// SenderMinEvents creates `count` cloudevents.MinEvent events with new IDs into a +// sender and registers them for the prober. +// Warning: only call once. +func (p *EventProber) SenderMinEvents(count int) { + event := cetest.MinEvent() + if count == 1 { + id := uuid.New().String() + event.SetID(id) + p.ids = []string{id} + p.senderOptions = append(p.senderOptions, InputEvent(event)) + } else { + p.senderOptions = append(p.senderOptions, InputEvent(event), SendMultipleEvents(count, 10*time.Millisecond)) // TODO: make configurable. + p.ids = []string{} + for i := 1; i <= count; i++ { + p.ids = append(p.ids, strconv.Itoa(i)) + } + } +} + +// AsKReference returns the short-named component as a KReference. +func (p *EventProber) AsKReference(prefix string) *duckv1.KReference { + return svc.AsKReference(p.shortNameToName[prefix]) +} + +// AssertSentAll tests that `fromPrefix` sent all known events known to the prober. +func (p *EventProber) AssertSentAll(fromPrefix string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + events := p.SentBy(ctx, fromPrefix) + if len(p.ids) != len(events) { + t.Errorf("expected %q to have sent %d events, actually sent %d", + fromPrefix, len(p.ids), len(events)) + } + for _, id := range p.ids { + found := false + for _, event := range events { + if id == event.Sent.SentId { + found = true + if event.Response.StatusCode < 200 || event.Response.StatusCode > 299 { + t.Errorf("Failed to send event id=%s, %s", id, event.Response.String()) + } + break + } + } + if !found { + t.Errorf("Failed to send event id=%s", id) + } + } + } +} + +// AssertReceivedAll tests that all events sent by `fromPrefix` were received by `toPrefix`. +func (p *EventProber) AssertReceivedAll(fromPrefix, toPrefix string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + sent := p.SentBy(ctx, fromPrefix) + ids := make([]string, len(sent)) + for i, s := range sent { + ids[i] = s.Sent.SentId + } + + events := p.ReceivedBy(ctx, toPrefix) + if len(ids) != len(events) { + t.Errorf("expected %q to have received %d events, actually received %d", + toPrefix, len(ids), len(events)) + } + for _, id := range ids { + found := false + for _, event := range events { + if event.Event != nil && id == event.Event.ID() { + found = true + break + } + } + if !found { + t.Errorf("Failed to receive event id=%s", id) + } + } + } +} + +// AssertReceivedAll tests that all events sent by `fromPrefix` were received by `toPrefix`. +func (p *EventProber) AssertReceivedOrRejectedAll(fromPrefix, toPrefix string) feature.StepFn { + return func(ctx context.Context, t feature.T) { + sent := p.SentBy(ctx, fromPrefix) + ids := make([]string, len(sent)) + for i, s := range sent { + ids[i] = s.Sent.SentId + } + + events := p.ReceivedOrRejectedBy(ctx, toPrefix) + + if len(ids) != len(events) { + t.Errorf("expected %q to have received %d events, actually received %d", + fromPrefix, len(ids), len(events)) + } + for _, id := range ids { + found := false + for _, event := range events { + if event.Event != nil && id == event.Event.ID() { + found = true + break + } + } + if !found { + t.Errorf("Failed to receive event id=%s", id) + } + } + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/100-sa.yaml b/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/100-sa.yaml new file mode 100644 index 000000000..b94996272 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/100-sa.yaml @@ -0,0 +1,19 @@ +# Copyright 2020 The Knative 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 +# +# https://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. + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .namespace }} + namespace: {{ .namespace }} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/101-rbac.yaml b/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/101-rbac.yaml new file mode 100644 index 000000000..5839e77b2 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/101-rbac.yaml @@ -0,0 +1,47 @@ +# Copyright 2020 The Knative 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 +# +# https://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. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ .namespace }} + namespace: {{ .namespace }} +rules: + - apiGroups: [ "" ] + resources: + - "pods" + verbs: + - "get" + - "list" + - apiGroups: [ "" ] + resources: + - "events" + verbs: + - "*" + +--- + +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .namespace }} + namespace: {{ .namespace }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ .namespace }} +subjects: + - kind: ServiceAccount + name: {{ .namespace }} + namespace: {{ .namespace }} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/rbac.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/rbac.go new file mode 100644 index 000000000..a684478cf --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/rbac/rbac.go @@ -0,0 +1,38 @@ +/* +Copyright 2021 The Knative 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 eventshub + +import ( + "context" + "embed" + + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/manifest" +) + +//go:embed *.yaml +var templates embed.FS + +// Install creates the necessary ServiceAccount, Role, RoleBinding for the eventshub. +// The resources are named according to the current namespace defined in the environment. +func Install() feature.StepFn { + return func(ctx context.Context, t feature.T) { + if _, err := manifest.InstallYamlFS(ctx, templates, map[string]interface{}{}); err != nil { + t.Fatal(err) + } + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/receiver/receiver.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/receiver/receiver.go new file mode 100644 index 000000000..ea772e1e1 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/receiver/receiver.go @@ -0,0 +1,231 @@ +/* +Copyright 2020 The Knative 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 receiver + +import ( + "context" + "fmt" + "net/http" + "strings" + "sync/atomic" + "time" + + cloudeventsbindings "github.com/cloudevents/sdk-go/v2/binding" + cloudeventshttp "github.com/cloudevents/sdk-go/v2/protocol/http" + "github.com/kelseyhightower/envconfig" + "go.uber.org/zap" + "knative.dev/pkg/logging" + + "knative.dev/reconciler-test/pkg/eventshub" + "knative.dev/reconciler-test/pkg/eventshub/dropevents" +) + +// Receiver is the entry point for sinking events into the event log. +type Receiver struct { + // Name is the name of this Receiver, used to filter if multiple observers. + Name string + // EventLogs is the list of EventLogger implementors to vent observed events. + EventLogs *eventshub.EventLogs + + ctx context.Context + seq uint64 + dropSeq uint64 + replyFunc func(context.Context, http.ResponseWriter, eventshub.EventInfo) + counter *dropevents.CounterHandler + responseWaitTime time.Duration + skipResponseCode int + skipResponseHeaders map[string]string +} + +type envConfig struct { + // ReceiverName is used to identify this instance of the receiver. + ReceiverName string `envconfig:"POD_NAME" default:"receiver-default" required:"true"` + + // ResponseWaitTime is the seconds to wait for the eventshub to write any response + ResponseWaitTime int `envconfig:"RESPONSE_WAIT_TIME" default:"0" required:"false"` + + // Reply is used to define if the observer should reply back + Reply bool `envconfig:"REPLY" default:"false" required:"false"` + + // The event type to use in the reply, if enabled + ReplyEventType string `envconfig:"REPLY_EVENT_TYPE" default:"" required:"false"` + + // The event source to use in the reply, if enabled + ReplyEventSource string `envconfig:"REPLY_EVENT_SOURCE" default:"" required:"false"` + + // The event data to use in the reply, if enabled + ReplyEventData string `envconfig:"REPLY_EVENT_DATA" default:"" required:"false"` + + // This string to append in the data field in the reply, if enabled. + // This will threat the data as text/plain field + ReplyAppendData string `envconfig:"REPLY_APPEND_DATA" default:"" required:"false"` + + // If events should be dropped, specify the strategy here. + SkipStrategy string `envconfig:"SKIP_ALGORITHM" default:"" required:"false"` + + // If events should be dropped according to Linear policy, this controls + // how many events are dropped. + SkipCounter uint64 `envconfig:"SKIP_COUNTER" default:"0" required:"false"` + + // If events should be dropped, specify the HTTP response code here. + SkipResponseCode int `envconfig:"SKIP_RESPONSE_CODE" default:"409" required:"false"` + + // If events should be dropped, specify additional HTTP Headers to return in response. + SkipResponseHeaders map[string]string `envconfig:"SKIP_RESPONSE_HEADERS" default:"" required:"false"` +} + +func NewFromEnv(ctx context.Context, eventLogs *eventshub.EventLogs) *Receiver { + var env envConfig + if err := envconfig.Process("", &env); err != nil { + logging.FromContext(ctx).Fatal("Failed to process env var", err) + } + + logging.FromContext(ctx).Infof("Receiver environment configuration: %+v", env) + + var replyFunc func(context.Context, http.ResponseWriter, eventshub.EventInfo) + if env.Reply { + logging.FromContext(ctx).Info("Receiver will reply with an event") + replyFunc = ReplyTransformerFunc(env.ReplyEventType, env.ReplyEventSource, env.ReplyEventData, env.ReplyAppendData) + } else { + logging.FromContext(ctx).Info("Receiver won't reply with an event") + replyFunc = NoOpReply + } + var counter *dropevents.CounterHandler + + if env.SkipStrategy != "" { + counter = &dropevents.CounterHandler{ + Skipper: dropevents.SkipperAlgorithmWithCount(env.SkipStrategy, env.SkipCounter), + } + } else { + counter = &dropevents.CounterHandler{ + // Don't skip anything, since count is 0. nop skipper. + Skipper: dropevents.NoopSkipper, + } + } + + var responseWaitTime time.Duration + if env.ResponseWaitTime != 0 { + responseWaitTime = time.Duration(env.ResponseWaitTime) * time.Second + } + + return &Receiver{ + Name: env.ReceiverName, + EventLogs: eventLogs, + ctx: ctx, + replyFunc: replyFunc, + counter: counter, + responseWaitTime: responseWaitTime, + skipResponseCode: env.SkipResponseCode, + skipResponseHeaders: env.SkipResponseHeaders, + } +} + +// Start will create the CloudEvents client and start listening for inbound +// HTTP requests. This is a is a blocking call. +func (o *Receiver) Start(ctx context.Context, handlerFuncs ...func(handler http.Handler) http.Handler) error { + var handler http.Handler = o + + for _, dec := range handlerFuncs { + handler = dec(handler) + } + + server := &http.Server{Addr: ":8080", Handler: handler} + + var err error + go func() { + err = server.ListenAndServe() + }() + + <-ctx.Done() + + if err != nil { + return fmt.Errorf("error while starting the HTTP server: %w", err) + } + + logging.FromContext(ctx).Info("Closing the HTTP server") + + return server.Close() +} + +func (o *Receiver) ServeHTTP(writer http.ResponseWriter, request *http.Request) { + // Special case probe events. + if request.Method == http.MethodHead { + writer.WriteHeader(http.StatusOK) + return + } + + m := cloudeventshttp.NewMessageFromHttpRequest(request) + defer m.Finish(nil) + + event, eventErr := cloudeventsbindings.ToEvent(context.TODO(), m) + headers := make(http.Header) + for k, v := range request.Header { + if !strings.HasPrefix(k, "Ce-") { + headers[k] = v + } + } + // Host header is removed from the request.Header map by net/http + if request.Host != "" { + headers.Set("Host", request.Host) + } + + eventErrStr := "" + if eventErr != nil { + eventErrStr = eventErr.Error() + } + + shouldSkip := o.counter.Skip() + var s uint64 + var kind eventshub.EventKind + if shouldSkip { + kind = eventshub.EventRejected + s = atomic.AddUint64(&o.dropSeq, 1) + } else { + kind = eventshub.EventReceived + s = atomic.AddUint64(&o.seq, 1) + } + + eventInfo := eventshub.EventInfo{ + Error: eventErrStr, + Event: event, + HTTPHeaders: headers, + Origin: request.RemoteAddr, + Observer: o.Name, + Time: time.Now(), + Sequence: s, + Kind: kind, + } + + if err := o.EventLogs.Vent(eventInfo); err != nil { + logging.FromContext(o.ctx).Fatalw("Error while venting the recorded event", zap.Error(err)) + } + + if o.responseWaitTime != 0 { + logging.FromContext(o.ctx).Debugf("Waiting for %v before replying", o.responseWaitTime.String()) + time.Sleep(o.responseWaitTime) + } + + if shouldSkip { + // Trigger a redelivery + for headerKey, headerValue := range o.skipResponseHeaders { + writer.Header().Set(headerKey, headerValue) + } + writer.WriteHeader(o.skipResponseCode) + } else { + o.replyFunc(o.ctx, writer, eventInfo) + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/receiver/reply.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/receiver/reply.go new file mode 100644 index 000000000..40ca80a05 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/receiver/reply.go @@ -0,0 +1,90 @@ +/* +Copyright 2020 The Knative 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 receiver + +import ( + "context" + "net/http" + + cloudevents "github.com/cloudevents/sdk-go/v2" + "github.com/cloudevents/sdk-go/v2/binding" + cehttp "github.com/cloudevents/sdk-go/v2/protocol/http" + "go.uber.org/zap" + "knative.dev/pkg/logging" + + "knative.dev/reconciler-test/pkg/eventshub" +) + +func NoOpReply(_ context.Context, writer http.ResponseWriter, _ eventshub.EventInfo) { + writer.WriteHeader(http.StatusAccepted) +} + +func ReplyTransformerFunc(replyEventType string, replyEventSource string, replyEventData string, replyAppendData string) func(context.Context, http.ResponseWriter, eventshub.EventInfo) { + return func(ctx context.Context, writer http.ResponseWriter, info eventshub.EventInfo) { + if info.Error != "" { + writer.WriteHeader(http.StatusBadRequest) + _, _ = writer.Write([]byte(info.Error)) + logging.FromContext(ctx).Warn("Conversion error in the event to send back", info.Error) + return + } + + if info.Event == nil { + writer.WriteHeader(http.StatusBadRequest) + _, _ = writer.Write([]byte("No event!")) + logging.FromContext(ctx).Warn("No event to send back") + return + } + + outputEvent := info.Event.Clone() + + if replyEventSource != "" { + logging.FromContext(ctx).Infof("Setting reply event source '%s'", replyEventSource) + outputEvent.SetSource(replyEventSource) + } + if replyEventType != "" { + logging.FromContext(ctx).Infof("Setting reply event type '%s'", replyEventType) + outputEvent.SetType(replyEventType) + } + if replyEventData != "" { + logging.FromContext(ctx).Infof("Setting reply event data '%s'", replyAppendData) + if err := outputEvent.SetData(cloudevents.ApplicationJSON, []byte(replyEventData)); err != nil { + logging.FromContext(ctx).Warn("Cannot set the event data") + } + } + if replyAppendData != "" { + var d string + if outputEvent.Data() == nil { + d = replyAppendData + } else { + if err := info.Event.DataAs(&d); err != nil { + logging.FromContext(ctx).Warn("Cannot read the event data as text/plain") + } + d = d + replyAppendData + } + logging.FromContext(ctx).Infof("Setting appended event data '%s'", d) + if err := outputEvent.SetData(cloudevents.TextPlain, d); err != nil { + logging.FromContext(ctx).Warn("Cannot set the event data") + } + } + + logging.FromContext(ctx).Infow("Replying with", zap.Stringer("event", outputEvent)) + err := cehttp.WriteResponseWriter(ctx, binding.ToMessage(&outputEvent), 200, writer) + if err != nil { + logging.FromContext(ctx).Warnw("Error while writing the event as response", zap.Error(err)) + } + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/constructor.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/constructor.go new file mode 100644 index 000000000..ccce1c89e --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/constructor.go @@ -0,0 +1,75 @@ +/* +Copyright 2020 The Knative 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 recorder_vent + +import ( + "context" + "time" + + "github.com/kelseyhightower/envconfig" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes/scheme" + ref "k8s.io/client-go/tools/reference" + kubeclient "knative.dev/pkg/client/injection/kube/client" + "knative.dev/pkg/logging" + "knative.dev/pkg/system" + + "knative.dev/reconciler-test/pkg/eventshub" +) + +type envConfig struct { + AgentName string `envconfig:"AGENT_NAME" default:"observer-default" required:"true"` + PodName string `envconfig:"POD_NAME" required:"true"` + Port int `envconfig:"PORT" default:"8080" required:"true"` +} + +const ( + maxRetry = 5 + sleepDuration = 5 * time.Second +) + +func NewFromEnv(ctx context.Context) eventshub.EventLog { + var env envConfig + if err := envconfig.Process("", &env); err != nil { + logging.FromContext(ctx).Fatal("Failed to process env var: ", err) + } + + logging.FromContext(ctx).Infof("Recorder vent environment configuration: %+v", env) + + return NewEventLog(ctx, env.AgentName, env.PodName) +} + +func NewEventLog(ctx context.Context, agentName string, podName string) eventshub.EventLog { + on, err := kubeclient.Get(ctx).CoreV1().Pods(system.Namespace()).Get(ctx, podName, metav1.GetOptions{}) + if err != nil { + logging.FromContext(ctx).Fatal("Error while trying to retrieve the pod", err) + } + + logging.FromContext(ctx).Infof("Going to send events to pod '%s' in namespace '%s'", on.Name, on.Namespace) + + reference, err := ref.GetReference(scheme.Scheme, on) + if err != nil { + logging.FromContext(ctx).Fatalf("Could not construct reference to: '%#v' due to: '%v'", on, err) + } + + return &recorder{ + ctx: ctx, + namespace: system.Namespace(), + agentName: agentName, + ref: reference, + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/doc.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/doc.go new file mode 100644 index 000000000..129e2ce36 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2020 The Knative 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 recorder_vent implements an eventshub.EventLog backed by Kubernetes +// Events using an event recorder. +package recorder_vent diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/recorder.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/recorder.go new file mode 100644 index 000000000..4d516260c --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/recorder_vent/recorder.go @@ -0,0 +1,128 @@ +/* +Copyright 2020 The Knative 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 recorder_vent + +import ( + "context" + "encoding/json" + "fmt" + "math/rand" + "time" + + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + restclient "k8s.io/client-go/rest" + kubeclient "knative.dev/pkg/client/injection/kube/client" + "knative.dev/pkg/logging" + + "knative.dev/reconciler-test/pkg/eventshub" +) + +type recorder struct { + ctx context.Context + namespace string + agentName string + + ref *corev1.ObjectReference +} + +func (r *recorder) Vent(observed eventshub.EventInfo) error { + if observed.Event != nil { + var event corev1.Event + err := json.Unmarshal(observed.Event.DataEncoded, &event) + if err == nil && event.Reason == eventshub.CloudEventObservedReason { + // prevent event loops from happening with APIServerSources + return nil + } + } + b, err := json.Marshal(observed) + if err != nil { + return err + } + message := string(b) + + t := time.Now() + // Note: DO NOT SET EventTime, or you'll trigger k8s api server hilarity: + // - https://github.com/kubernetes/kubernetes/issues/95913 + // - https://github.com/kubernetes/kubernetes/blob/master/pkg/apis/core/validation/events.go#L122 + event := &corev1.Event{ + ObjectMeta: metav1.ObjectMeta{ + Name: fmt.Sprintf("%v.%v.%d", r.ref.Name, observed.Kind, observed.Sequence), + Namespace: r.namespace, + }, + InvolvedObject: *r.ref, + Reason: eventshub.CloudEventObservedReason, + Message: message, + Source: corev1.EventSource{Component: r.agentName}, + FirstTimestamp: metav1.Time{Time: t}, + LastTimestamp: metav1.Time{Time: t}, + Count: 1, + Type: corev1.EventTypeNormal, + } + + return r.recordEvent(event) +} + +func (r *recorder) recordEvent(event *corev1.Event) error { + tries := 0 + for { + done, err := r.trySendEvent(event) + if done { + return nil + } + tries++ + if tries >= maxRetry { + logging.FromContext(r.ctx).Errorf("Unable to write event '%s' (retry limit exceeded!)", event.Name) + return err + } + // Randomize the first sleep so that various clients won't all be + // synced up if the master goes down. + if tries == 1 { + time.Sleep(time.Duration(float64(sleepDuration) * rand.Float64())) + } else { + time.Sleep(sleepDuration) + } + } +} + +func (r *recorder) trySendEvent(event *corev1.Event) (bool, error) { + newEv, err := kubeclient.Get(r.ctx).CoreV1().Events(r.namespace).CreateWithEventNamespace(event) + if err == nil { + logging.FromContext(r.ctx).Infof("Event '%s' sent correctly, uuid: %s", newEv.Name, newEv.UID) + return true, nil + } + + // If we can't contact the server, then hold everything while we keep trying. + // Otherwise, something about the event is malformed and we should abandon it. + switch err.(type) { + case *restclient.RequestConstructionError: + // We will construct the request the same next time, so don't keep trying. + logging.FromContext(r.ctx).Errorf("Unable to construct event '%s': '%v' (will not retry!)", event.Name, err) + return true, err + case *apierrors.StatusError: + logging.FromContext(r.ctx).Errorf("Server rejected event '%s'. Reason: '%v' (will not retry!). Event: %v", event.Name, err, event) + return true, err + case *apierrors.UnexpectedObjectError: + // We don't expect this; it implies the server's response didn't match a + // known pattern. Go ahead and retry. + default: + // This case includes actual http transport errors. Go ahead and retry. + } + logging.FromContext(r.ctx).Errorf("Unable to write event: '%v' (may retry after sleeping)", err) + return false, err +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/resources.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/resources.go new file mode 100644 index 000000000..9488e53d7 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/resources.go @@ -0,0 +1,88 @@ +/* +Copyright 2020 The Knative 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 eventshub + +import ( + "context" + "embed" + "strings" + + "knative.dev/reconciler-test/pkg/environment" + eventshubrbac "knative.dev/reconciler-test/pkg/eventshub/rbac" + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/k8s" + "knative.dev/reconciler-test/pkg/knative" + "knative.dev/reconciler-test/pkg/manifest" +) + +//go:embed *.yaml +var templates embed.FS + +func init() { + environment.RegisterPackage(thisPackage) +} + +// Install starts a new eventshub with the provided name +// Note: this function expects that the Environment is configured with the +// following options, otherwise it will panic: +// +// ctx, env := global.Environment( +// knative.WithKnativeNamespace("knative-namespace"), +// knative.WithLoggingConfig, +// knative.WithTracingConfig, +// k8s.WithEventListener, +// ) +func Install(name string, options ...EventsHubOption) feature.StepFn { + return func(ctx context.Context, t feature.T) { + // Compute the user provided envs + envs := make(map[string]string) + if err := compose(options...)(ctx, envs); err != nil { + t.Fatalf("Error while computing environment variables for eventshub: %s", err) + } + + // eventshub needs tracing and logging config + envs[ConfigLoggingEnv] = knative.LoggingConfigFromContext(ctx) + envs[ConfigTracingEnv] = knative.TracingConfigFromContext(ctx) + + // Register the event info store to assert later the events published by the eventshub + registerEventsHubStore( + k8s.EventListenerFromContext(ctx), + t, + name, + environment.FromContext(ctx).Namespace(), + ) + + // Install ServiceAccount, Role, RoleBinding + eventshubrbac.Install()(ctx, t) + + // Deploy + if _, err := manifest.InstallYamlFS(ctx, templates, map[string]interface{}{ + "name": name, + "envs": envs, + "image": ImageFromContext(ctx), + }); err != nil { + t.Fatal(err) + } + + k8s.WaitForPodRunningOrFail(ctx, t, name) + + // If the eventhubs starts an event receiver, we need to wait for the service endpoint to be synced + if strings.Contains(envs["EVENT_GENERATORS"], "receiver") { + k8s.WaitForServiceEndpointsOrFail(ctx, t, name, 1) + } + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/sender/sender.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/sender/sender.go new file mode 100644 index 000000000..a7c13e766 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/sender/sender.go @@ -0,0 +1,462 @@ +/* +Copyright 2020 The Knative 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 sender + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + nethttp "net/http" + "strconv" + "time" + "unicode" + + conformanceevent "github.com/cloudevents/conformance/pkg/event" + conformancehttp "github.com/cloudevents/conformance/pkg/http" + cloudevents "github.com/cloudevents/sdk-go/v2" + "github.com/cloudevents/sdk-go/v2/binding" + cehttp "github.com/cloudevents/sdk-go/v2/protocol/http" + "github.com/cloudevents/sdk-go/v2/types" + "github.com/kelseyhightower/envconfig" + "go.opencensus.io/plugin/ochttp" + "k8s.io/apimachinery/pkg/util/wait" + "knative.dev/pkg/logging" + "knative.dev/pkg/tracing/propagation/tracecontextb3" + + "knative.dev/reconciler-test/pkg/eventshub" +) + +type generator struct { + SenderName string `envconfig:"POD_NAME" default:"sender-default" required:"true"` + + // Sink url for the message destination + Sink string `envconfig:"SINK" required:"true"` + + // The duration to wait before starting sending the first message + Delay string `envconfig:"DELAY" default:"5" required:"false"` + + // ProbeSink will probe the sink until it responds. + ProbeSink bool `envconfig:"PROBE_SINK" default:"true"` + + // ProbeSinkTimeout defines the maximum amount of time in seconds to wait for the probe sink to succeed. + ProbeSinkTimeout int `envconfig:"PROBE_SINK_TIMEOUT" required:"false" default:"60"` + + // InputYAML points to a file, folder, or url to load CloudEvents Conformance yaml event payload to send. + // If set, InputEvent, InputHeaders, InputBody, MaxMessages are ignored. + InputYAML []string `envconfig:"INPUT_YAML" required:"false"` + + // InputEvent json encoded + InputEvent string `envconfig:"INPUT_EVENT" required:"false"` + + // The encoding of the cloud event: [binary, structured]. + EventEncoding string `envconfig:"EVENT_ENCODING" default:"binary" required:"false"` + + // InputHeaders to send (this overrides any event provided input) + InputHeaders map[string]string `envconfig:"INPUT_HEADERS" required:"false"` + + // InputBody to send (this overrides any event provided input) + InputBody string `envconfig:"INPUT_BODY" required:"false"` + + // InputMethod to use when sending the http request + InputMethod string `envconfig:"INPUT_METHOD" default:"POST" required:"false"` + + // Should tracing be added to events sent. + AddTracing bool `envconfig:"ADD_TRACING" default:"false" required:"false"` + + // Should add extension 'sequence' identifying the sequence number. + AddSequence bool `envconfig:"ADD_SEQUENCE" default:"false" required:"false"` + + // Override the event id with an incremental id. + IncrementalId bool `envconfig:"INCREMENTAL_ID" default:"false" required:"false"` + + // Override the event time with the time when sending the event. + OverrideTime bool `envconfig:"OVERRIDE_TIME" default:"false" required:"false"` + + // The duration between messages. + Period string `envconfig:"PERIOD" default:"5" required:"false"` + + // The number of messages to attempt to send. -1 for inferred, 0 for unlimited. + MaxMessages int `envconfig:"MAX_MESSAGES" default:"-1" required:"false"` + + // --- Processed State --- + + // baseEvent is parsed from InputEvent. + baseEvent *cloudevents.Event + + // sequence is state counter for outbound events. + sequence int + + // eventQueue defines a sequence of events to send. + eventQueue []conformanceevent.Event +} + +func Start(ctx context.Context, logs *eventshub.EventLogs) error { + var env generator + if err := envconfig.Process("", &env); err != nil { + return fmt.Errorf("failed to process env var. %w", err) + } + if err := env.init(); err != nil { + return err + } + + logging.FromContext(ctx).Infof("Sender environment configuration: %+v", env) + + period, err := time.ParseDuration(durationWithUnit(env.Period)) + if err != nil { + return err + } + + delay, err := time.ParseDuration(durationWithUnit(env.Delay)) + if err != nil { + return err + } + + if delay > 0 { + logging.FromContext(ctx).Info("will sleep for ", delay) + time.Sleep(delay) + logging.FromContext(ctx).Info("awake, continuing") + } + + if env.ProbeSink { + probingTimeout := time.Duration(env.ProbeSinkTimeout) * time.Second + // Probe the sink for up to a minute. + if err := wait.PollImmediate(100*time.Millisecond, probingTimeout, func() (bool, error) { + req, err := nethttp.NewRequest(nethttp.MethodHead, env.Sink, nil) + if err != nil { + return false, err + } + + if _, err := nethttp.DefaultClient.Do(req); err != nil { + return false, nil + } + return true, nil + }); err != nil { + return fmt.Errorf("probing the sink '%s' using timeout %s failed: %w", env.Sink, probingTimeout, err) + } + } + + httpClient := &nethttp.Client{} + if env.AddTracing { + httpClient.Transport = &ochttp.Transport{ + Base: nethttp.DefaultTransport, + Propagation: tracecontextb3.TraceContextEgress, + } + } + + switch env.EventEncoding { + case "binary": + ctx = cloudevents.WithEncodingBinary(ctx) + case "structured": + ctx = cloudevents.WithEncodingStructured(ctx) + default: + return fmt.Errorf("unsupported encoding option: %q", env.EventEncoding) + } + + ticker := time.NewTicker(period) + for { + + req, event, err := env.next(ctx) + if err != nil { + return err + } + + res, err := httpClient.Do(req) + // Publish sent event info + if err := logs.Vent(env.sentInfo(event, req, err)); err != nil { + return fmt.Errorf("cannot forward event info: %w", err) + } + + if err == nil { + // Vent the response info + if err := logs.Vent(env.responseInfo(res, event)); err != nil { + return fmt.Errorf("cannot forward event info: %w", err) + } + } + + if !env.hasNext() { + return nil + } + + // Check if ctx is done before the next loop + select { + // Wait for next tick + case <-ticker.C: + // Keep looping. + case <-ctx.Done(): + logging.FromContext(ctx).Infof("Canceled sending messages because context was closed") + return nil + } + } +} + +func (g *generator) sentInfo(event *cloudevents.Event, req *nethttp.Request, err error) eventshub.EventInfo { + var eventId string + if event != nil { + eventId = event.ID() + } + + if err != nil { + return eventshub.EventInfo{ + Kind: eventshub.EventSent, + Error: err.Error(), + Origin: g.SenderName, + Observer: g.SenderName, + Time: time.Now(), + Sequence: uint64(g.sequence), + SentId: eventId, + } + } + + sentEventInfo := eventshub.EventInfo{ + Kind: eventshub.EventSent, + Event: event, + Origin: g.SenderName, + Observer: g.SenderName, + Time: time.Now(), + Sequence: uint64(g.sequence), + SentId: eventId, + } + + sentHeaders := make(nethttp.Header) + for k, v := range req.Header { + sentHeaders[k] = v + } + sentEventInfo.HTTPHeaders = sentHeaders + + if g.InputBody != "" { + sentEventInfo.Body = []byte(g.InputBody) + } + + return sentEventInfo +} + +func (g *generator) responseInfo(res *nethttp.Response, event *cloudevents.Event) eventshub.EventInfo { + var eventId string + if event != nil { + eventId = event.ID() + } + + responseInfo := eventshub.EventInfo{ + Kind: eventshub.EventResponse, + HTTPHeaders: res.Header, + Origin: g.Sink, + Observer: g.SenderName, + Time: time.Now(), + Sequence: uint64(g.sequence), + StatusCode: res.StatusCode, + SentId: eventId, + } + + responseMessage := cehttp.NewMessageFromHttpResponse(res) + + if responseMessage.ReadEncoding() == binding.EncodingUnknown { + body, err := ioutil.ReadAll(res.Body) + + if err != nil { + responseInfo.Error = err.Error() + } else { + responseInfo.Body = body + } + } else { + responseEvent, err := binding.ToEvent(context.Background(), responseMessage) + if err != nil { + responseInfo.Error = err.Error() + } else { + responseInfo.Event = responseEvent + } + } + return responseInfo +} + +func (g *generator) init() error { + if g.InputEvent != "" { + if err := json.Unmarshal([]byte(g.InputEvent), &g.baseEvent); err != nil { + return fmt.Errorf("unable to unmarshal the event from json: %w", err) + } + // Inferred number is 1. + if g.MaxMessages == -1 { + g.MaxMessages = 1 + } + } + + if len(g.InputYAML) == 0 && g.InputEvent == "" && g.InputBody == "" && len(g.InputHeaders) == 0 { + return fmt.Errorf("input values not provided") + } + + if len(g.InputYAML) > 0 { + if g.baseEvent != nil { + return errors.New("only use InputYAML or InputEvent, not both") + } + + for _, path := range g.InputYAML { + events, err := conformanceevent.FromYaml(path, true) + if err != nil { + return err + } + fmt.Println("Loaded YAML events.", len(events)) + if len(events) > 0 { + g.eventQueue = append(g.eventQueue, events...) + } + } + // Inferred number is len(g.eventQueue). + if g.MaxMessages == -1 { + g.MaxMessages = len(g.eventQueue) + } + } + + return nil +} + +func (g *generator) hasNext() bool { + if g.MaxMessages == 0 { + return true + } + return g.sequence < g.MaxMessages +} + +func (g *generator) next(ctx context.Context) (*nethttp.Request, *cloudevents.Event, error) { + g.sequence++ + + if len(g.eventQueue) > 0 { + return g.nextQueued(ctx) + } + return g.nextGenerated(ctx) +} + +func (g *generator) nextQueued(ctx context.Context) (*nethttp.Request, *cloudevents.Event, error) { + next := g.eventQueue[0] + + if g.MaxMessages == 0 { + // Move to the back. + g.eventQueue = append(g.eventQueue[1:], next) + } else { + // Pop off the front. + if len(g.eventQueue) > 1 { + g.eventQueue = g.eventQueue[1:] + } else { + g.eventQueue = nil + } + } + + if g.AddSequence { + if next.Attributes.Extensions == nil { + next.Attributes.Extensions = make(conformanceevent.Extensions) + } + next.Attributes.Extensions["sequence"] = strconv.Itoa(g.sequence) + } + if g.IncrementalId { + next.Attributes.ID = strconv.Itoa(g.sequence) + } + if g.OverrideTime { + now := types.Timestamp{Time: time.Now()} + next.Attributes.Time = now.String() + } + + req, err := conformancehttp.EventToRequest(g.Sink, next) + if err != nil { + return nil, nil, err + } + + event := eventToEvent(next) + + if len(g.InputHeaders) != 0 { + for k, v := range g.InputHeaders { + req.Header.Add(k, v) + } + } + + return req, event, nil +} + +func eventToEvent(conf conformanceevent.Event) *cloudevents.Event { + event := cloudevents.NewEvent(conf.Attributes.SpecVersion) + + event.SetSpecVersion(conf.Attributes.SpecVersion) + event.SetType(conf.Attributes.Type) + if t, _ := types.ParseTimestamp(conf.Attributes.Time); t != nil { + event.SetTime(t.Time) + } + event.SetID(conf.Attributes.ID) + event.SetSource(conf.Attributes.Source) + event.SetSubject(conf.Attributes.Subject) + event.SetDataSchema(conf.Attributes.DataSchema) + event.SetDataContentType(conf.Attributes.DataContentType) + for key, value := range conf.Attributes.Extensions { + event.SetExtension(key, value) + } + + return &event +} + +func (g *generator) nextGenerated(ctx context.Context) (*nethttp.Request, *cloudevents.Event, error) { + req, err := nethttp.NewRequest(g.InputMethod, g.Sink, nil) + if err != nil { + logging.FromContext(ctx).Error("Cannot create the request: ", err) + return nil, nil, err + } + + var event *cloudevents.Event + if g.baseEvent != nil { + e := g.baseEvent.Clone() + event = &e + + if g.AddSequence { + event.SetExtension("sequence", g.sequence) + } + if g.IncrementalId { + event.SetID(strconv.Itoa(g.sequence)) + } + if g.OverrideTime { + event.SetTime(time.Now()) + } + + logging.FromContext(ctx).Info("I'm going to send\n", event) + + err := cehttp.WriteRequest(ctx, binding.ToMessage(event), req) + if err != nil { + logging.FromContext(ctx).Error("Cannot write the event: ", err) + return nil, nil, err + } + } + + if len(g.InputHeaders) != 0 { + for k, v := range g.InputHeaders { + req.Header.Add(k, v) + } + } + + if g.InputBody != "" { + req.Body = ioutil.NopCloser(bytes.NewReader([]byte(g.InputBody))) + } + + return req, event, nil +} + +func durationWithUnit(s string) string { + // [-+]?([0-9]*(\.[0-9]*)?[a-z]+)+ + + if len(s) > 0 { + if !unicode.IsLower(rune(s[len(s)-1])) { + return s + "s" + } + } + + return s +} diff --git a/vendor/knative.dev/reconciler-test/pkg/eventshub/utils.go b/vendor/knative.dev/reconciler-test/pkg/eventshub/utils.go new file mode 100644 index 000000000..386f99fa0 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/eventshub/utils.go @@ -0,0 +1,95 @@ +/* +Copyright 2020 The Knative 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 eventshub + +import ( + "context" + "net/http" + "os" + "strconv" + "strings" + "time" + + "go.opencensus.io/plugin/ochttp" + "go.uber.org/zap" + "knative.dev/pkg/logging" + "knative.dev/pkg/tracing" + "knative.dev/pkg/tracing/config" + "knative.dev/pkg/tracing/propagation/tracecontextb3" +) + +const ( + ConfigTracingEnv = "K_CONFIG_TRACING" + ConfigLoggingEnv = "K_CONFIG_LOGGING" +) + +func ParseHeaders(serializedHeaders string) http.Header { + h := make(http.Header) + for _, kv := range strings.Split(serializedHeaders, ",") { + splitted := strings.Split(kv, "=") + h.Set(splitted[0], splitted[1]) + } + return h +} + +// ParseDurationStr parses `durationStr` as number of seconds (not time.Duration string), +// if parsing fails, returns back default duration. +func ParseDurationStr(durationStr string, defaultDuration int) time.Duration { + var duration time.Duration + if d, err := strconv.Atoi(durationStr); err != nil { + duration = time.Duration(defaultDuration) * time.Second + } else { + duration = time.Duration(d) * time.Second + } + return duration +} + +// ConfigureTracing can be used in test-images to configure tracing +func ConfigureTracing(logger *zap.SugaredLogger, serviceName string) error { + tracingEnv := os.Getenv(ConfigTracingEnv) + + if tracingEnv == "" { + return tracing.SetupStaticPublishing(logger, serviceName, config.NoopConfig()) + } + + conf, err := config.JSONToTracingConfig(tracingEnv) + if err != nil { + return err + } + + return tracing.SetupStaticPublishing(logger, serviceName, conf) +} + +// ConfigureTracing can be used in test-images to configure tracing +func ConfigureLogging(ctx context.Context, name string) context.Context { + loggingEnv := os.Getenv(ConfigLoggingEnv) + conf, err := logging.JSONToConfig(loggingEnv) + if err != nil { + logging.FromContext(ctx).Warn("Error while trying to read the config logging env: ", err) + return ctx + } + l, _ := logging.NewLoggerFromConfig(conf, name) + return logging.WithLogger(ctx, l) +} + +// WithTracing wraps the provided handler in a tracing handler +func WithTracing(handler http.Handler) http.Handler { + return &ochttp.Handler{ + Propagation: tracecontextb3.TraceContextEgress, + Handler: handler, + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/context.go b/vendor/knative.dev/reconciler-test/pkg/feature/context.go new file mode 100644 index 000000000..ab1d16b35 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/feature/context.go @@ -0,0 +1,39 @@ +/* +Copyright 2021 The Knative 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 feature + +import ( + "context" +) + +type envKey struct{} + +// ContextWith decorates the given context with the provided Feature, and returns +// the resulting context. +func ContextWith(ctx context.Context, f *Feature) context.Context { + return context.WithValue(ctx, envKey{}, f) +} + +// FromContext returns the Feature from Context, if not found FromContext will +// panic. +// TODO: revisit if we really want to panic here... likely not. +func FromContext(ctx context.Context) *Feature { + if e, ok := ctx.Value(envKey{}).(*Feature); ok { + return e + } + panic("no Feature found in context") +} diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/feature.go b/vendor/knative.dev/reconciler-test/pkg/feature/feature.go new file mode 100644 index 000000000..fdce51b58 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/feature/feature.go @@ -0,0 +1,247 @@ +/* +Copyright 2020 The Knative 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 feature + +import ( + "context" + "fmt" + "runtime" + "strings" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/apis" + "knative.dev/pkg/injection/clients/dynamicclient" + + "knative.dev/reconciler-test/pkg/state" +) + +// Feature is a list of steps and feature name. +type Feature struct { + Name string + Steps []Step + State state.Store + // Contains all the resources created as part of this Feature. + refs []corev1.ObjectReference +} + +// NewFeatureNamed creates a new feature with the provided name +func NewFeatureNamed(name string) *Feature { + f := new(Feature) + f.Name = name + return f +} + +// NewFeature creates a new feature with name taken from the caller name +func NewFeature() *Feature { + f := new(Feature) + + pc, _, _, _ := runtime.Caller(1) + caller := runtime.FuncForPC(pc) + if caller != nil { + splitted := strings.Split(caller.Name(), ".") + f.Name = splitted[len(splitted)-1] + } + + return f +} + +// FeatureSet is a list of features and feature set name. +type FeatureSet struct { + Name string + Features []Feature +} + +// StepFn is the function signature for steps. +type StepFn func(ctx context.Context, t T) + +// Step is a structure to hold the step function, step name and state, level and +// timing configuration. +type Step struct { + Name string + S States + L Levels + T Timing + Fn StepFn +} + +// TestName returns the constructed test name based on the timing, step, state, +// level, and the Name provided in the step. +func (s *Step) TestName() string { + switch s.T { + case Assert: + return fmt.Sprintf("[%s/%s]%s", s.S, s.L, s.Name) + default: + return s.Name + } +} + +// Reference adds references to keep track of for example, for cleaning things +// after a Feature completes. +func (f *Feature) Reference(ref ...corev1.ObjectReference) { + f.refs = append(f.refs, ref...) +} + +// References returns all known resources to the Feature registered via +// `Reference`. +func (f *Feature) References() []corev1.ObjectReference { + return f.refs +} + +// DeleteResourcesFn delete all known resources to the Feature registered +// via `Reference`. Expected to be used as a StepFn. +func (f *Feature) DeleteResources(ctx context.Context, t T) { + dc := dynamicclient.Get(ctx) + for _, ref := range f.References() { + gv, err := schema.ParseGroupVersion(ref.APIVersion) + if err != nil { + t.Errorf("Could not parse GroupVersion for %+v", ref.APIVersion) + } else { + resource := apis.KindToResource(gv.WithKind(ref.Kind)) + t.Logf("Deleting %s/%s of GVR: %+v", ref.Namespace, ref.Name, resource) + if err := dc.Resource(resource).Namespace(ref.Namespace).Delete(ctx, ref.Name, *metav1.NewDeleteOptions(0)); err != nil { + t.Logf("Warning, failed to delete %s/%s of GVR: %+v", ref.Namespace, ref.Name, resource) + } + } + } + f.refs = []corev1.ObjectReference(nil) +} + +// Setup adds a step function to the feature set at the Setup timing phase. +func (f *Feature) Setup(name string, fn StepFn) { + f.AddStep(Step{ + Name: name, + S: Any, + L: All, + T: Setup, + Fn: fn, + }) +} + +// Requirement adds a step function to the feature set at the Requirement timing phase. +func (f *Feature) Requirement(name string, fn StepFn) { + f.AddStep(Step{ + Name: name, + S: Any, + L: All, + T: Requirement, + Fn: fn, + }) +} + +// Assert is a shortcut for Stable().Must(name, fn), +// useful for developing integration tests that don't require assertion levels. +func (f *Feature) Assert(name string, fn StepFn) { + f.AddStep(Step{ + Name: name, + S: Stable, + L: Must, + T: Assert, + Fn: fn, + }) +} + +// Assert adds a step function to the feature set at the Assert timing phase. +func (a *Asserter) Assert(l Levels, name string, fn StepFn) { + a.f.AddStep(Step{ + Name: fmt.Sprintf("%s %s", a.name, name), + S: a.s, + L: l, + T: Assert, + Fn: fn, + }) +} + +// Teardown adds a step function to the feature set at the Teardown timing phase. +func (f *Feature) Teardown(name string, fn StepFn) { + f.AddStep(Step{ + Name: name, + S: Any, + L: All, + T: Teardown, + Fn: fn, + }) +} + +// AddStep appends one or more steps to the Feature. +func (f *Feature) AddStep(step ...Step) { + f.Steps = append(f.Steps, step...) +} + +// Assertable is a fluent interface based on Levels for creating an Assert step. +type Assertable interface { + Must(name string, fn StepFn) Assertable + Should(name string, fn StepFn) Assertable + May(name string, fn StepFn) Assertable + MustNot(name string, fn StepFn) Assertable + ShouldNot(name string, fn StepFn) Assertable +} + +// Alpha is a fluent style method for creating an Assert step in Alpha State. +func (f *Feature) Alpha(name string) Assertable { + return f.asserter(Alpha, name) +} + +// Beta is a fluent style method for creating an Assert step in Beta State. +func (f *Feature) Beta(name string) Assertable { + return f.asserter(Beta, name) +} + +// Stable is a fluent style method for creating an Assert step in Stable State. +func (f *Feature) Stable(name string) Assertable { + return f.asserter(Stable, name) +} + +func (f *Feature) asserter(s States, name string) Assertable { + return &Asserter{ + f: f, + name: name, + s: s, + } +} + +type Asserter struct { + f *Feature + name string + s States +} + +func (a *Asserter) Must(name string, fn StepFn) Assertable { + a.Assert(Must, name, fn) + return a +} + +func (a *Asserter) Should(name string, fn StepFn) Assertable { + a.Assert(Should, name, fn) + return a +} + +func (a *Asserter) May(name string, fn StepFn) Assertable { + a.Assert(May, name, fn) + return a +} + +func (a *Asserter) MustNot(name string, fn StepFn) Assertable { + a.Assert(MustNot, name, fn) + return a +} + +func (a *Asserter) ShouldNot(name string, fn StepFn) Assertable { + a.Assert(ShouldNot, name, fn) + return a +} diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/level.go b/vendor/knative.dev/reconciler-test/pkg/feature/level.go new file mode 100644 index 000000000..ff3c26e4b --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/feature/level.go @@ -0,0 +1,80 @@ +/* +Copyright 2020 The Knative 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 feature + +import ( + "strings" +) + +type Levels uint8 + +// Descriptions from: https://tools.ietf.org/html/rfc2119 + +const ( + // Must means that the definition is an absolute requirement of the specification. + Must Levels = 1 << iota + + // MustNot means that the definition is an absolute prohibition of the specification. + MustNot + + // Should means that there may exist valid reasons in particular circumstances to + // ignore a particular item + Should + + // Should means that there may exist valid reasons in particular circumstances when the + // particular behavior is acceptable or even useful + ShouldNot + + // May means that an item is truly optional + May + + // All flag enables all requirement levels + All = Must | MustNot | Should | ShouldNot | May +) + +func (l Levels) String() string { + if l == 0 { + return "None" + } + if l == All { + return "All" + } + + var b strings.Builder + + for level, name := range LevelMapping { + if l&level == 0 { + continue + } + + if b.Len() != 0 { + b.WriteString("|") + } + + b.WriteString(name) + } + + return b.String() +} + +var LevelMapping = map[Levels]string{ + Must: "MUST", + MustNot: "MUST NOT", + Should: "SHOULD", + ShouldNot: "SHOULD NOT", + May: "MAY", +} diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/name.go b/vendor/knative.dev/reconciler-test/pkg/feature/name.go new file mode 100644 index 000000000..0410791ce --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/feature/name.go @@ -0,0 +1,110 @@ +/* +Copyright 2020 The Knative 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 feature + +import ( + "math/rand" + "strings" + "time" + "unicode" + + "knative.dev/pkg/kmeta" +) + +const ( + letterBytes = "abcdefghijklmnopqrstuvwxyz" + randSuffixLen = 8 + sep = '-' + testNamePrefix = "Test" +) + +func init() { + // Properly seed the random number generator so RandomString() is actually random. + // Otherwise, rerunning tests will generate the same names for the test resources, causing conflicts with + // already existing resources. + seed := time.Now().UTC().UnixNano() + rand.Seed(seed) +} + +type Namer interface { + Name() string +} + +// ObjectPrefixForTest returns the Name prefix for this test's random names. +func ObjectPrefixForTest(t Namer) string { + return MakeK8sNamePrefix(strings.TrimPrefix(t.Name(), testNamePrefix)) +} + +// ObjectNameForTest generates a random object Name based on the test Name. +func ObjectNameForTest(t Namer) string { + return kmeta.ChildName(ObjectPrefixForTest(t), string(sep)+RandomString()) +} + +// AppendRandomString will generate a random string that begins with prefix. +// This is useful if you want to make sure that your tests can run at the same +// time against the same environment without conflicting. +// This method will use "-" as the separator between the prefix and +// the random suffix. +func AppendRandomString(prefix string) string { + return strings.Join([]string{prefix, RandomString()}, string(sep)) +} + +// RandomString will generate a random string. +func RandomString() string { + suffix := make([]byte, randSuffixLen) + + for i := range suffix { + suffix[i] = letterBytes[rand.Intn(len(letterBytes))] + } + return string(suffix) +} + +// MakeRandomK8sName +func MakeRandomK8sName(prefix string) string { + return MakeK8sNamePrefix(AppendRandomString(prefix)) +} + +// MakeK8sNamePrefix converts each chunk of non-alphanumeric character into a single dash +// and also convert camelcase tokens into dash-delimited lowercase tokens. +func MakeK8sNamePrefix(s string) string { + var sb strings.Builder + newToken := false + for _, c := range s { + if !(unicode.IsLetter(c) || unicode.IsNumber(c)) { + newToken = true + continue + } + if sb.Len() > 0 && (newToken || unicode.IsUpper(c)) { + sb.WriteRune(sep) + } + sb.WriteRune(unicode.ToLower(c)) + newToken = false + } + return sb.String() +} + +// GetBaseFuncName returns the baseFuncName parsed from the fullFuncName. +// eg. test/e2e.TestMain will return TestMain. +func GetBaseFuncName(fullFuncName string) string { + name := fullFuncName + // Possibly there is no parent package, so only remove it from the Name if '/' exists + if strings.ContainsRune(name, '/') { + name = name[strings.LastIndex(name, "/")+1:] + } + name = name[strings.LastIndex(name, ".")+1:] + return name +} diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/states.go b/vendor/knative.dev/reconciler-test/pkg/feature/states.go new file mode 100644 index 000000000..899f0449d --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/feature/states.go @@ -0,0 +1,67 @@ +/* +Copyright 2020 The Knative 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 feature + +import ( + "strings" +) + +type States uint8 + +const ( + // Alpha implies a feature is experimental and may change + Alpha States = 1 << iota + + // Beta implies a feature is complete but may have unknown bugs or issues + Beta + + // Stable implies a feature is ready for production + Stable + + // Any flag enables any feature states + Any = Alpha | Beta | Stable +) + +func (s States) String() string { + if s == 0 { + return "None" + } + if s == Any { + return "Any" + } + + var b strings.Builder + + for state, name := range StatesMapping { + if s&state == 0 { + continue + } + + if b.Len() != 0 { + b.WriteString("|") + } + b.WriteString(name) + } + + return b.String() +} + +var StatesMapping = map[States]string{ + Alpha: "Alpha", + Beta: "Beta", + Stable: "Stable", +} diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/t.go b/vendor/knative.dev/reconciler-test/pkg/feature/t.go new file mode 100644 index 000000000..a729faca3 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/feature/t.go @@ -0,0 +1,46 @@ +/* +Copyright 2021 The Knative 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 feature + +import "time" + +// T is an interface similar to testing.T passed to StepFn to perform logging and assertions +type T interface { + Name() string + + Log(args ...interface{}) + Logf(format string, args ...interface{}) + + Error(args ...interface{}) + Errorf(format string, args ...interface{}) + Fail() + + Fatal(args ...interface{}) + Fatalf(format string, args ...interface{}) + FailNow() + + Skip(args ...interface{}) + Skipf(format string, args ...interface{}) + SkipNow() + + Failed() bool + Skipped() bool + + // Note: these are step scoped! + Cleanup(f func()) + Deadline() (deadline time.Time, ok bool) +} diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/timing.go b/vendor/knative.dev/reconciler-test/pkg/feature/timing.go new file mode 100644 index 000000000..ba14fbe8e --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/feature/timing.go @@ -0,0 +1,41 @@ +/* +Copyright 2020 The Knative 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 feature + +type Timing uint8 + +const ( + Setup Timing = iota + Requirement + Assert + Teardown +) + +func (t Timing) String() string { + return timingMapping[t] +} + +func Timings() []Timing { + return []Timing{Setup, Requirement, Assert, Teardown} +} + +var timingMapping = map[Timing]string{ + Setup: "Setup", + Requirement: "Requirement", + Assert: "Assert", + Teardown: "Teardown", +} diff --git a/vendor/knative.dev/reconciler-test/pkg/images/cmd.go b/vendor/knative.dev/reconciler-test/pkg/images/cmd.go new file mode 100644 index 000000000..4a8c38cfb --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/images/cmd.go @@ -0,0 +1,41 @@ +/* +Copyright 2020 The Knative 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 images + +import ( + "os" + "os/exec" + "strings" +) + +// Helper functions to run shell commands. + +func cmd(cmdLine string) *exec.Cmd { + cmdSplit := strings.Split(cmdLine, " ") + cmd := cmdSplit[0] + args := cmdSplit[1:] + c := exec.Command(cmd, args...) + c.Stderr = os.Stdout // Pipe the stderr in stdout + return c +} + +func runCmd(cmdLine string) (string, error) { + cmd := cmd(cmdLine) + + cmdOut, err := cmd.Output() + return string(cmdOut), err +} diff --git a/vendor/knative.dev/reconciler-test/pkg/images/ko.go b/vendor/knative.dev/reconciler-test/pkg/images/ko.go new file mode 100644 index 000000000..adde2080f --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/images/ko.go @@ -0,0 +1,35 @@ +/* +Copyright 2020 The Knative 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 images + +import ( + "fmt" + "os" +) + +// Use ko to publish the image. +func KoPublish(path string) (string, error) { + platform := os.Getenv("PLATFORM") + if len(platform) > 0 { + platform = " --platform=" + platform + } + out, err := runCmd(fmt.Sprintf("ko publish%s -B %s", platform, path)) + if err != nil { + return "", err + } + return out, nil +} diff --git a/vendor/knative.dev/reconciler-test/pkg/k8s/events.go b/vendor/knative.dev/reconciler-test/pkg/k8s/events.go new file mode 100644 index 000000000..bb2588083 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/k8s/events.go @@ -0,0 +1,124 @@ +/* +Copyright 2020 The Knative 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 k8s + +import ( + "context" + "sync" + + corev1 "k8s.io/api/core/v1" + "k8s.io/client-go/informers" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/cache" + kubeclient "knative.dev/pkg/client/injection/kube/client" + "knative.dev/pkg/logging" + + "knative.dev/reconciler-test/pkg/environment" +) + +type eventListenerEnvKey struct{} + +func WithEventListener(ctx context.Context, env environment.Environment) (context.Context, error) { + return context.WithValue( + ctx, + eventListenerEnvKey{}, + newEventListener(kubeclient.Get(ctx), env.Namespace(), logging.FromContext(ctx).Infof), + ), nil +} + +var _ environment.EnvOpts = WithEventListener + +func EventListenerFromContext(ctx context.Context) *EventListener { + if e, ok := ctx.Value(eventListenerEnvKey{}).(*EventListener); ok { + return e + } + panic("no event listener found in the context, make sure you properly configured the env opts using WithEventListener") +} + +// EventHandler is the callback type for the EventListener +type EventHandler interface { + Handle(event *corev1.Event) +} + +// EventListener is a type that broadcasts new k8s events to subscribed EventHandler +// The scope of EventListener should be global in the Environment lifecycle +type EventListener struct { + cancel context.CancelFunc + + lock sync.Mutex + handlers map[string]EventHandler + + eventsSeen int +} + +func newEventListener(client kubernetes.Interface, namespace string, logf func(string, ...interface{})) *EventListener { + ctx, cancelCtx := context.WithCancel(context.Background()) + informerFactory := informers.NewSharedInformerFactoryWithOptions( + client, + 0, + informers.WithNamespace(namespace), + ) + eventsInformer := informerFactory.Core().V1().Events().Informer() + + el := EventListener{ + cancel: cancelCtx, + handlers: make(map[string]EventHandler), + } + + eventsInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: func(obj interface{}) { + el.handle(obj.(*corev1.Event)) + }, + }) + + go func() { + eventsInformer.Run(ctx.Done()) + el.lock.Lock() + defer el.lock.Unlock() + logf("EventListener stopped, %v events seen", el.eventsSeen) + }() + + return &el +} + +func (el *EventListener) handle(event *corev1.Event) { + el.lock.Lock() + defer el.lock.Unlock() + el.eventsSeen++ + for _, handler := range el.handlers { + handler.Handle(event) + } +} + +func (el *EventListener) GetHandler(name string) EventHandler { + el.lock.Lock() + defer el.lock.Unlock() + return el.handlers[name] +} + +func (el *EventListener) AddHandler(name string, handler EventHandler) int { + el.lock.Lock() + defer el.lock.Unlock() + el.handlers[name] = handler + // Return the number of events that have already been seen. This helps debug scenarios where + // the expected event was seen, but only before this handler was added. + return el.eventsSeen +} + +func (el *EventListener) Stop() { + el.cancel() +} diff --git a/vendor/knative.dev/reconciler-test/pkg/k8s/job.go b/vendor/knative.dev/reconciler-test/pkg/k8s/job.go new file mode 100644 index 000000000..54fbc0bed --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/k8s/job.go @@ -0,0 +1,175 @@ +/* +Copyright 2020 The Knative 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 k8s + +import ( + "context" + "fmt" + "log" + "time" + + batchv1 "k8s.io/api/batch/v1" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" + "knative.dev/pkg/logging" +) + +// WaitUntilJobDone waits until a job has finished. +// Timing is optional but if provided is [interval, timeout]. +func WaitUntilJobDone(ctx context.Context, client kubernetes.Interface, namespace, name string, timing ...time.Duration) error { + interval, timeout := PollTimings(ctx, timing) + + err := wait.PollImmediate(interval, timeout, func() (bool, error) { + job, err := client.BatchV1().Jobs(namespace).Get(context.Background(), name, metav1.GetOptions{}) + if err != nil { + if apierrors.IsNotFound(err) { + log.Println(namespace, name, "not found", err) + // keep polling + return false, nil + } + return false, err + } + return IsJobComplete(job), nil + }) + if err != nil { + return err + } + + return nil +} + +// WaitForJobTerminationMessage waits for a job to end and then collects the termination message. +// Timing is optional but if provided is [interval, timeout]. +func WaitForJobTerminationMessage(ctx context.Context, client kubernetes.Interface, namespace, name string, timing ...time.Duration) (string, error) { + interval, timeout := PollTimings(ctx, timing) + + // poll until the pod is terminated. + err := wait.PollImmediate(interval, timeout, func() (bool, error) { + pod, err := GetJobPodByJobName(context.Background(), client, namespace, name) + if err != nil { + if apierrors.IsNotFound(err) { + log.Println(namespace, name, "not found", err) + // keep polling + return false, nil + } + return false, err + } + if pod != nil { + for _, cs := range pod.Status.ContainerStatuses { + if cs.State.Terminated != nil { + return true, nil + } + } + } + return false, nil + }) + + if err != nil { + return "", err + } + pod, err := GetJobPodByJobName(context.Background(), client, namespace, name) + if err != nil { + return "", err + } + return GetFirstTerminationMessage(pod), nil +} + +func IsJobComplete(job *batchv1.Job) bool { + for _, c := range job.Status.Conditions { + if c.Type == batchv1.JobComplete && c.Status == corev1.ConditionTrue { + return true + } + } + return false +} + +func IsJobSucceeded(job *batchv1.Job) bool { + return !IsJobFailed(job) +} + +func IsJobFailed(job *batchv1.Job) bool { + for _, c := range job.Status.Conditions { + if c.Type == batchv1.JobFailed && c.Status == corev1.ConditionTrue { + return true + } + } + return false +} + +func JobFailedMessage(job *batchv1.Job) string { + for _, c := range job.Status.Conditions { + if c.Type == batchv1.JobFailed && c.Status == corev1.ConditionTrue { + return fmt.Sprintf("[%s] %s", c.Reason, c.Message) + } + } + return "" +} + +// GetJobProd will find the Pod that belongs to the resource that created it. +// Uses label ""controller-uid as the label selector. So, your job should +// tag the job with that label as the UID of the resource that's needing it. +// For example, if you create a storage object that requires us to create +// a notification for it, the controller should set the label on the +// Job responsible for creating the Notification for it with the label +// "controller-uid" set to the uid of the storage CR. +func GetJobPod(ctx context.Context, kubeClientset kubernetes.Interface, namespace, uid, operation string) (*corev1.Pod, error) { + logger := logging.FromContext(ctx) + logger.Infof("Looking for Pod with UID: %q action: %q", uid, operation) + matchLabels := map[string]string{ + "resource-uid": uid, + "action": operation, + } + labelSelector := &metav1.LabelSelector{ + MatchLabels: matchLabels, + } + pods, err := kubeClientset.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{LabelSelector: labels.Set(labelSelector.MatchLabels).String()}) + if err != nil { + return nil, err + } + for _, pod := range pods.Items { + logger.Infof("Found pod: %q", pod.Name) + return &pod, nil + } + return nil, fmt.Errorf("Pod not found") +} + +// GetJobPodByJobName will find the Pods that belong to that job. Each pod +// for a given job will have label called: "job-name" set to the job that +// it belongs to, so just filter by that. +func GetJobPodByJobName(ctx context.Context, kubeClientset kubernetes.Interface, namespace, jobName string) (*corev1.Pod, error) { + logger := logging.FromContext(ctx) + logger.Infof("Looking for Pod with jobname: %q", jobName) + matchLabels := map[string]string{ + "job-name": jobName, + } + labelSelector := &metav1.LabelSelector{ + MatchLabels: matchLabels, + } + pods, err := kubeClientset.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{LabelSelector: labels.Set(labelSelector.MatchLabels).String()}) + if err != nil { + return nil, err + } + for _, pod := range pods.Items { + logger.Infof("Found pod: %q", pod.Name) + return &pod, nil + } + return nil, fmt.Errorf("Pod not found") +} diff --git a/vendor/knative.dev/reconciler-test/pkg/k8s/logs.go b/vendor/knative.dev/reconciler-test/pkg/k8s/logs.go new file mode 100644 index 000000000..1421bfb2c --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/k8s/logs.go @@ -0,0 +1,57 @@ +/* +Copyright 2020 The Knative 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 k8s + +import ( + "context" + "fmt" + "strings" + + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/client-go/kubernetes" +) + +func LogsFor(client kubernetes.Interface, namespace, name string, gvr schema.GroupVersionResource) (string, error) { + // Get all pods in this namespace. + pods, err := client.CoreV1().Pods(namespace).List(context.Background(), metav1.ListOptions{}) + if err != nil { + return "", err + } + + logs := make([]string, 0) + + // Look for a pod with the name that was passed in inside the pod name. + for _, pod := range pods.Items { + if strings.Contains(pod.Name, name) { + // Collect all the logs from all the containers for this pod. + if l, err := client.CoreV1().Pods(namespace).GetLogs(pod.Name, &corev1.PodLogOptions{}).DoRaw(context.Background()); err != nil { + logs = append(logs, err.Error()) + } else { + logs = append(logs, string(l)) + } + } + } + + // Did we find a match like the given name? + if len(logs) == 0 { + return "", fmt.Errorf(`pod for "%s/%s" [%s] not found`, namespace, name, gvr.String()) + } + + return strings.Join(logs, "\n"), nil +} diff --git a/vendor/knative.dev/reconciler-test/pkg/k8s/pod.go b/vendor/knative.dev/reconciler-test/pkg/k8s/pod.go new file mode 100644 index 000000000..ebda10aa0 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/k8s/pod.go @@ -0,0 +1,51 @@ +/* +Copyright 2020 The Knative 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 k8s + +import ( + "context" + "encoding/json" + "fmt" + + corev1 "k8s.io/api/core/v1" +) + +func GetFirstTerminationMessage(pod *corev1.Pod) string { + if pod != nil { + for _, cs := range pod.Status.ContainerStatuses { + if cs.State.Terminated != nil && cs.State.Terminated.Message != "" { + return cs.State.Terminated.Message + } + } + } + return "" +} + +func GetOperationsResult(ctx context.Context, pod *corev1.Pod, result interface{}) error { + if pod == nil { + return fmt.Errorf("pod was nil") + } + terminationMessage := GetFirstTerminationMessage(pod) + if terminationMessage == "" { + return fmt.Errorf("did not find termination message for pod %q", pod.Name) + } + err := json.Unmarshal([]byte(terminationMessage), &result) + if err != nil { + return fmt.Errorf("failed to unmarshal terminationmessage: %q : %q", terminationMessage, err) + } + return nil +} diff --git a/vendor/knative.dev/reconciler-test/pkg/k8s/steps.go b/vendor/knative.dev/reconciler-test/pkg/k8s/steps.go new file mode 100644 index 000000000..2978fa60a --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/k8s/steps.go @@ -0,0 +1,129 @@ +/* +Copyright 2020 The Knative 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 k8s + +import ( + "context" + "fmt" + "log" + "time" + + "knative.dev/pkg/apis" + "knative.dev/pkg/network" + + apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/wait" + + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/injection/clients/dynamicclient" + + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/feature" +) + +// IsReady returns a reusable feature.StepFn to assert if a resource is ready +// within the time given. Timing is optional but if provided is [interval, timeout]. +func IsReady(gvr schema.GroupVersionResource, name string, timing ...time.Duration) feature.StepFn { + return func(ctx context.Context, t feature.T) { + interval, timeout := PollTimings(ctx, timing) + env := environment.FromContext(ctx) + if err := WaitForResourceReady(ctx, env.Namespace(), name, gvr, interval, timeout); err != nil { + t.Error(gvr, "did not become ready,", err) + } + } +} + +// IsNotReady returns a reusable feature.StepFn to assert if a resource is not ready +// within the time given. Timing is optional but if provided is [interval, timeout]. +func IsNotReady(gvr schema.GroupVersionResource, name string, timing ...time.Duration) feature.StepFn { + return func(ctx context.Context, t feature.T) { + interval, timeout := PollTimings(ctx, timing) + env := environment.FromContext(ctx) + if err := WaitForResourceNotReady(ctx, env.Namespace(), name, gvr, interval, timeout); err != nil { + t.Error(gvr, "did become ready,", err) + } + } +} + +// IsAddressable tests to see if a resource becomes Addressable within the time +// given. Timing is optional but if provided is [interval, timeout]. +func IsAddressable(gvr schema.GroupVersionResource, name string, timing ...time.Duration) feature.StepFn { + return func(ctx context.Context, t feature.T) { + interval, timeout := PollTimings(ctx, timing) + lastMsg := "" + err := wait.PollImmediate(interval, timeout, func() (bool, error) { + addr, err := Address(ctx, gvr, name) + if err != nil { + if apierrors.IsNotFound(err) { + // keep polling + return false, nil + } + return false, err + } + if addr == nil { + msg := fmt.Sprintf("%s %s has no status.address.url, %s", gvr, name, err) + if msg != lastMsg { + log.Println(msg) + lastMsg = msg + } + return false, nil + } + + // Success! + log.Printf("%s %s is addressable: %s\n", gvr, name, addr) + return true, nil + }) + if err != nil { + t.Error(gvr, "did not become addressable,", err) + } + } +} + +// Address attempts to resolve an Addressable address into a URL. If the +// resource is found but not Addressable, Address will return (nil, nil). +func Address(ctx context.Context, gvr schema.GroupVersionResource, name string) (*apis.URL, error) { + env := environment.FromContext(ctx) + + // Special case Service. + if gvr.Group == "" && gvr.Version == "v1" && gvr.Resource == "services" { + u := "http://" + network.GetServiceHostname(name, env.Namespace()) + return apis.ParseURL(u) + } + + like := &duckv1.AddressableType{} + us, err := dynamicclient.Get(ctx).Resource(gvr).Namespace(env.Namespace()).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + return nil, err + } + obj := like.DeepCopy() + if err = runtime.DefaultUnstructuredConverter.FromUnstructured(us.Object, obj); err != nil { + return nil, fmt.Errorf("error from DefaultUnstructured.Dynamiconverter. %w", err) + } + obj.ResourceVersion = gvr.Version + obj.APIVersion = gvr.GroupVersion().String() + + if obj.Status.Address == nil || obj.Status.Address.URL == nil { + // Not Addressable (yet?). + return nil, nil + } + + // Success! + return obj.Status.Address.URL, nil +} diff --git a/vendor/knative.dev/reconciler-test/pkg/k8s/wait.go b/vendor/knative.dev/reconciler-test/pkg/k8s/wait.go new file mode 100644 index 000000000..687a5a1da --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/k8s/wait.go @@ -0,0 +1,323 @@ +/* +Copyright 2020 The Knative 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 k8s + +import ( + "context" + "encoding/json" + "fmt" + "log" + "strings" + "time" + + "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "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/apimachinery/pkg/util/wait" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + kubeclient "knative.dev/pkg/client/injection/kube/client" + "knative.dev/pkg/injection/clients/dynamicclient" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/feature" +) + +// PollTimings will find the the correct timings based on priority: +// - passed timing slice [interval, timeout]. +// - values from from context. +// - defaults. +func PollTimings(ctx context.Context, timings []time.Duration) (time.Duration /*interval*/, time.Duration /*timeout*/) { + // Use the passed timing first, but it could be nil or a strange length. + if len(timings) >= 2 { + return timings[0], timings[1] + } + + var interval *time.Duration + + // Use the passed timings if only interval is provided. + if len(timings) == 1 { + interval = &timings[0] + } + + di, timeout := environment.PollTimingsFromContext(ctx) + if interval == nil { + interval = &di + } + + return *interval, timeout +} + +// WaitForReadyOrDone will wait for a resource to become ready or succeed. +// Timing is optional but if provided is [interval, timeout]. +func WaitForReadyOrDone(ctx context.Context, ref corev1.ObjectReference, timing ...time.Duration) error { + interval, timeout := PollTimings(ctx, timing) + + k := ref.GroupVersionKind() + gvr, _ := meta.UnsafeGuessKindToResource(k) + + switch gvr.Resource { + case "jobs": + err := WaitUntilJobDone(ctx, kubeclient.Get(ctx), ref.Namespace, ref.Name, interval, timeout) + if err != nil { + return err + } + return nil + + default: + err := WaitForResourceReady(ctx, ref.Namespace, ref.Name, gvr, interval, timeout) + if err != nil { + return err + } + } + + return nil +} + +// WaitForResourceReady waits until the specified resource in the given namespace are ready. +// Timing is optional but if provided is [interval, timeout]. +func WaitForResourceReady(ctx context.Context, namespace, name string, gvr schema.GroupVersionResource, timing ...time.Duration) error { + return WaitForResourceCondition(ctx, namespace, name, gvr, isReady(name), timing...) +} + +// WaitForResourceNotReady waits until the specified resource in the given namespace is not ready. +// Only the top level ready condition is considered (internal `happy` condition of knative.dev/pkg). +// Timing is optional but if provided is [interval, timeout]. +func WaitForResourceNotReady(ctx context.Context, namespace, name string, gvr schema.GroupVersionResource, timing ...time.Duration) error { + return WaitForResourceCondition(ctx, namespace, name, gvr, isNotReady(name), timing...) +} + +// ConditionFunc is a function that determines whether a condition on a resource is satisfied. +type ConditionFunc func(resource duckv1.KResource) bool + +// WaitForResourceCondition waits until the specified resource in the given namespace satisfies a given condition. +// Timing is optional but if provided is [interval, timeout]. +func WaitForResourceCondition(ctx context.Context, namespace, name string, gvr schema.GroupVersionResource, condition ConditionFunc, timing ...time.Duration) error { + interval, timeout := PollTimings(ctx, timing) + + like := &duckv1.KResource{} + return wait.PollImmediate(interval, timeout, func() (bool, error) { + client := dynamicclient.Get(ctx) + + us, err := client.Resource(gvr).Namespace(namespace).Get(ctx, name, metav1.GetOptions{}) + if err != nil { + if apierrors.IsNotFound(err) { + log.Println(namespace, name, "not found", err) + // keep polling + return false, nil + } + return false, err + } + obj := like.DeepCopy() + if err = runtime.DefaultUnstructuredConverter.FromUnstructured(us.Object, obj); err != nil { + log.Fatalf("Error DefaultUnstructured.Dynamiconverter. %v", err) + } + obj.ResourceVersion = gvr.Version + obj.APIVersion = gvr.GroupVersion().String() + + // First see if the resource has conditions. + if len(obj.Status.Conditions) == 0 { + return false, nil // keep polling + } + + // Verify condition. + return condition(*obj), nil + }) +} + +func isReady(name string) ConditionFunc { + lastMsg := "" + return func(obj duckv1.KResource) bool { + ready := readyCondition(obj) + if ready != nil { + if !ready.IsTrue() { + msg := fmt.Sprintf("%s is not %s, %s: %s", name, ready.Type, ready.Reason, ready.Message) + if msg != lastMsg { + log.Println(msg) + lastMsg = msg + } + } + + log.Printf("%s is %s, %s: %s\n", name, ready.Type, ready.Reason, ready.Message) + return ready.IsTrue() + } + + // Last resort, look at all conditions. + // As a side-effect of this test, + // if a resource has no conditions, then it is ready. + allReady := true + for _, c := range obj.Status.Conditions { + if !c.IsTrue() { + msg := fmt.Sprintf("%s is not %s, %s: %s", name, c.Type, c.Reason, c.Message) + if msg != lastMsg { + log.Println(msg) + lastMsg = msg + } + allReady = false + break + } + } + return allReady + } +} + +func isNotReady(name string) ConditionFunc { + lastMsg := "" + return func(obj duckv1.KResource) bool { + ready := readyCondition(obj) + if ready == nil { + msg := fmt.Sprintf("%s hasn't any of %s or %s conditions", name, apis.ConditionReady, apis.ConditionSucceeded) + if msg != lastMsg { + log.Println(msg) + lastMsg = msg + } + return false + } + resource, err := json.MarshalIndent(obj, " ", " ") + if err != nil { + resource = []byte(err.Error()) + } + log.Printf("%s is %s, %s: %s\n\nResource: %s\n", name, ready.Type, ready.Reason, ready.Message, string(resource)) + return ready.IsFalse() + } +} + +// readyCondition returns Ready or Succeeded condition. +func readyCondition(obj duckv1.KResource) *apis.Condition { + // Ready type. + ready := obj.Status.GetCondition(apis.ConditionReady) + if ready != nil { + return ready + } + // Succeeded type. + return obj.Status.GetCondition(apis.ConditionSucceeded) +} + +// WaitForServiceEndpointsOrFail polls the status of the specified Service +// every interval until number of service endpoints >= numOfEndpoints. +func WaitForServiceEndpointsOrFail(ctx context.Context, t feature.T, svcName string, numberOfExpectedEndpoints int) { + endpointsService := kubeclient.Get(ctx).CoreV1().Endpoints(environment.FromContext(ctx).Namespace()) + interval, timeout := PollTimings(ctx, nil) + err := wait.PollImmediate(interval, timeout, func() (bool, error) { + endpoint, err := endpointsService.Get(ctx, svcName, metav1.GetOptions{}) + if err != nil { + return false, err + } + + return countEndpointsNum(endpoint) >= numberOfExpectedEndpoints, nil + }) + if err != nil { + t.Fatalf("Failed while waiting for %d endpoints in service %s: %+v", numberOfExpectedEndpoints, svcName, errors.WithStack(err)) + } +} + +// WaitForPodRunningOrFail waits for the given pod to be in running state. +func WaitForPodRunningOrFail(ctx context.Context, t feature.T, podName string) { + podClient := kubeclient.Get(ctx).CoreV1().Pods(environment.FromContext(ctx).Namespace()) + p := podClient + interval, timeout := PollTimings(ctx, nil) + err := wait.PollImmediate(interval, timeout, func() (bool, error) { + p, err := p.Get(ctx, podName, metav1.GetOptions{}) + if err != nil { + return true, err + } + return podRunning(p), nil + }) + if err != nil { + sb := strings.Builder{} + if p, err := podClient.Get(ctx, podName, metav1.GetOptions{}); err != nil { + sb.WriteString(err.Error()) + sb.WriteString("\n") + } else { + for _, c := range p.Spec.Containers { + if b, err := PodLogs(ctx, podName, c.Name, environment.FromContext(ctx).Namespace()); err != nil { + sb.WriteString(err.Error()) + } else { + sb.Write(b) + } + sb.WriteString("\n") + } + } + t.Fatalf("Failed while waiting for pod %s running: %+v", podName, errors.WithStack(err)) + } +} + +// PodLogs returns Pod logs for given Pod and Container in the namespace +func PodLogs(ctx context.Context, podName, containerName, namespace string) ([]byte, error) { + podClient := kubeclient.Get(ctx).CoreV1().Pods(namespace) + podList, err := podClient.List(ctx, metav1.ListOptions{}) + if err != nil { + return nil, err + } + for i := range podList.Items { + // Pods are big, so avoid copying. + pod := &podList.Items[i] + if strings.Contains(pod.Name, podName) { + result := podClient.GetLogs(pod.Name, &corev1.PodLogOptions{ + Container: containerName, + }).Do(ctx) + return result.Raw() + } + } + return nil, fmt.Errorf("could not find logs for %s/%s:%s", namespace, podName, containerName) +} + +// WaitForAddress waits until a resource has an address. +// Timing is optional but if provided is [interval, timeout]. +func WaitForAddress(ctx context.Context, gvr schema.GroupVersionResource, name string, timing ...time.Duration) (*apis.URL, error) { + interval, timeout := PollTimings(ctx, timing) + + var addr *apis.URL + err := wait.PollImmediate(interval, timeout, func() (bool, error) { + var err error + addr, err = Address(ctx, gvr, name) + if err == nil && addr == nil { + // keep polling + return false, nil + } + if err != nil { + if apierrors.IsNotFound(err) { + // keep polling + return false, nil + } + // seems fatal. + return false, err + } + // success! + return true, nil + }) + return addr, err +} + +func countEndpointsNum(e *corev1.Endpoints) int { + if e == nil || e.Subsets == nil { + return 0 + } + num := 0 + for _, sub := range e.Subsets { + num += len(sub.Addresses) + } + return num +} + +// podRunning will check the status conditions of the pod and return true if it's Running. +func podRunning(pod *corev1.Pod) bool { + return pod.Status.Phase == corev1.PodRunning || pod.Status.Phase == corev1.PodSucceeded +} diff --git a/vendor/knative.dev/reconciler-test/pkg/knative/knative_namespace_config.go b/vendor/knative.dev/reconciler-test/pkg/knative/knative_namespace_config.go new file mode 100644 index 000000000..60914c1d5 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/knative/knative_namespace_config.go @@ -0,0 +1,38 @@ +/* +Copyright 2020 The Knative 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 + + https://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 knative + +import ( + "context" + + "knative.dev/reconciler-test/pkg/environment" +) + +type knativeNamespaceConfig struct{} + +func WithKnativeNamespace(namespace string) environment.EnvOpts { + return func(ctx context.Context, env environment.Environment) (context.Context, error) { + return context.WithValue(ctx, knativeNamespaceConfig{}, namespace), nil + } +} + +func KnativeNamespaceFromContext(ctx context.Context) string { + if e, ok := ctx.Value(knativeNamespaceConfig{}).(string); ok { + return e + } + panic("no knative namespace found in the context, make sure you properly configured the env opts using WithKnativeNamespace") +} diff --git a/vendor/knative.dev/reconciler-test/pkg/knative/logging_config.go b/vendor/knative.dev/reconciler-test/pkg/knative/logging_config.go new file mode 100644 index 000000000..9b4c100c7 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/knative/logging_config.go @@ -0,0 +1,60 @@ +/* +Copyright 2020 The Knative 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 + + https://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 knative + +import ( + "context" + "fmt" + + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + kubeclient "knative.dev/pkg/client/injection/kube/client" + "knative.dev/pkg/logging" + + "knative.dev/reconciler-test/pkg/environment" +) + +type loggingConfigEnvKey struct{} + +func WithLoggingConfig(ctx context.Context, env environment.Environment) (context.Context, error) { + knativeNamespace := KnativeNamespaceFromContext(ctx) + cm, err := kubeclient.Get(ctx).CoreV1().ConfigMaps(knativeNamespace).Get(context.Background(), logging.ConfigMapName(), metav1.GetOptions{}) + if err != nil { + return nil, fmt.Errorf("error while retrieving the %s config map in namespace %s: %+v", logging.ConfigMapName(), knativeNamespace, errors.WithStack(err)) + } + + config, err := logging.NewConfigFromMap(cm.Data) + if err != nil { + return nil, fmt.Errorf("error while parsing the %s config map in namespace %s: %+v", logging.ConfigMapName(), knativeNamespace, errors.WithStack(err)) + } + + configSerialized, err := logging.ConfigToJSON(config) + if err != nil { + return nil, fmt.Errorf("error while serializing the %s config map in namespace %s: %+v", logging.ConfigMapName(), knativeNamespace, errors.WithStack(err)) + } + + return context.WithValue(ctx, loggingConfigEnvKey{}, configSerialized), nil +} + +var _ environment.EnvOpts = WithLoggingConfig + +func LoggingConfigFromContext(ctx context.Context) string { + if e, ok := ctx.Value(loggingConfigEnvKey{}).(string); ok { + return e + } + panic("no logging config found in the context, make sure you properly configured the env opts using WithLoggingConfig") +} diff --git a/vendor/knative.dev/reconciler-test/pkg/knative/tracing_config.go b/vendor/knative.dev/reconciler-test/pkg/knative/tracing_config.go new file mode 100644 index 000000000..b4119e899 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/knative/tracing_config.go @@ -0,0 +1,60 @@ +/* +Copyright 2020 The Knative 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 + + https://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 knative + +import ( + "context" + "fmt" + + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + kubeclient "knative.dev/pkg/client/injection/kube/client" + configtracing "knative.dev/pkg/tracing/config" + + "knative.dev/reconciler-test/pkg/environment" +) + +type tracingConfigEnvKey struct{} + +func WithTracingConfig(ctx context.Context, env environment.Environment) (context.Context, error) { + knativeNamespace := KnativeNamespaceFromContext(ctx) + cm, err := kubeclient.Get(ctx).CoreV1().ConfigMaps(knativeNamespace).Get(context.Background(), configtracing.ConfigName, metav1.GetOptions{}) + if err != nil { + return ctx, fmt.Errorf("error while retrieving the %s config map in namespace %s: %+v", configtracing.ConfigName, knativeNamespace, errors.WithStack(err)) + } + + config, err := configtracing.NewTracingConfigFromConfigMap(cm) + if err != nil { + return ctx, fmt.Errorf("error while parsing the %s config map in namespace %s: %+v", configtracing.ConfigName, knativeNamespace, errors.WithStack(err)) + } + + configSerialized, err := configtracing.TracingConfigToJSON(config) + if err != nil { + return ctx, fmt.Errorf("error while serializing the %s config map in namespace %s: %+v", configtracing.ConfigName, knativeNamespace, errors.WithStack(err)) + } + + return context.WithValue(ctx, tracingConfigEnvKey{}, configSerialized), nil +} + +var _ environment.EnvOpts = WithTracingConfig + +func TracingConfigFromContext(ctx context.Context) string { + if e, ok := ctx.Value(tracingConfigEnvKey{}).(string); ok { + return e + } + panic("no tracing config found in the context, make sure you properly configured the env opts using WithTracingConfig") +} diff --git a/vendor/knative.dev/reconciler-test/pkg/manifest/installer.go b/vendor/knative.dev/reconciler-test/pkg/manifest/installer.go new file mode 100644 index 000000000..8057d6598 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/manifest/installer.go @@ -0,0 +1,123 @@ +/* +Copyright 2020 The Knative 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 manifest + +import ( + "bufio" + "context" + "io/fs" + "log" + "os" + "path" + "runtime" + "strings" + + "knative.dev/pkg/injection/clients/dynamicclient" + "knative.dev/reconciler-test/pkg/environment" + "knative.dev/reconciler-test/pkg/feature" +) + +// CfgFn is the function signature of configuration mutation options. +type CfgFn func(map[string]interface{}) + +// Deprecated: use InstallYamlFS +func InstallYaml(ctx context.Context, dir string, base map[string]interface{}) (Manifest, error) { + return InstallYamlFS(ctx, os.DirFS(dir), base) +} + +func InstallYamlFS(ctx context.Context, fsys fs.FS, base map[string]interface{}) (Manifest, error) { + env := environment.FromContext(ctx) + cfg := env.TemplateConfig(base) + f := feature.FromContext(ctx) + + yamls, err := ParseTemplatesFS(fsys, env.Images(), cfg) + if err != nil { + return nil, err + } + + dynamicClient := dynamicclient.Get(ctx) + + manifest, err := NewYamlManifest(yamls, false, dynamicClient) + if err != nil { + return nil, err + } + + // Apply yaml. + if err := manifest.ApplyAll(); err != nil { + return manifest, err + } + + // Save the refs to Environment and Feature + env.Reference(manifest.References()...) + f.Reference(manifest.References()...) + + // Temp + refs := manifest.References() + log.Println("Created:") + for _, ref := range refs { + log.Println(ref) + } + return manifest, nil +} + +func InstallLocalYaml(ctx context.Context, base map[string]interface{}) (Manifest, error) { + pwd, _ := os.Getwd() + log.Println("PWD: ", pwd) + _, filename, _, _ := runtime.Caller(1) + log.Println("FILENAME: ", filename) + + return InstallYamlFS(ctx, os.DirFS(path.Dir(filename)), base) +} + +// Deprecated, use ImagesFromFS instead. +func ImagesLocalYaml() []string { + pwd, _ := os.Getwd() + log.Println("PWD: ", pwd) + _, filename, _, _ := runtime.Caller(1) + log.Println("FILENAME: ", filename) + + return ImagesFromFS(os.DirFS(path.Dir(filename))) +} + +func ImagesFromFS(fsys fs.FS) []string { + var images []string + + _ = fs.WalkDir(fsys, ".", func(path string, info fs.DirEntry, err error) error { + if info == nil || info.IsDir() { + return nil + } + if strings.HasSuffix(info.Name(), "yaml") { + file, err := fsys.Open(path) + if err != nil { + log.Fatal(err) + } + defer file.Close() + + scanner := bufio.NewScanner(file) + for scanner.Scan() { + parts := strings.Split(scanner.Text(), "ko://") + if len(parts) == 2 { + image := strings.ReplaceAll(parts[1], "\"", "") + images = append(images, image) + } + } + } + return nil + }) + + return images +} diff --git a/vendor/knative.dev/reconciler-test/pkg/manifest/manifest.go b/vendor/knative.dev/reconciler-test/pkg/manifest/manifest.go new file mode 100644 index 000000000..0721d1e08 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/manifest/manifest.go @@ -0,0 +1,212 @@ +/* +Copyright 2020 The Knative 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 manifest + +import ( + "context" + "fmt" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/api/meta" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/client-go/dynamic" + "k8s.io/klog" +) + +type Manifest interface { + // Either updates or creates all resources in the manifest + ApplyAll() error + // Updates or creates a particular resource + Apply(*unstructured.Unstructured) error + // Deletes all resources in the manifest + DeleteAll() error + // Deletes a particular resource + Delete(spec *unstructured.Unstructured) error + // Returns a deep copy of the matching resource read from the file + Find(apiVersion string, kind string, name string) *unstructured.Unstructured + // Returns the resource fetched from the api server, nil if not found + Get(spec *unstructured.Unstructured) (*unstructured.Unstructured, error) + // Returns a deep copy of all resources in the manifest + DeepCopyResources() []unstructured.Unstructured + // ResourceNames is a convenient list of all the resource names in the manifest + ResourceNames() []string + // References is a convenient list of all resources in the manifest as object references + References() []corev1.ObjectReference +} + +type YamlManifest struct { + client dynamic.Interface + resources []unstructured.Unstructured +} + +var _ Manifest = &YamlManifest{} + +func NewYamlManifest(pathname string, recursive bool, client dynamic.Interface) (Manifest, error) { + klog.Info("Reading YAML filepath: ", pathname, " recursive: ", recursive) + resources, err := Parse(pathname, recursive) + if err != nil { + return nil, err + } + return &YamlManifest{resources: resources, client: client}, nil +} + +func (f *YamlManifest) ApplyAll() error { + for _, spec := range f.resources { + if err := f.Apply(&spec); err != nil { + return err + } + } + return nil +} + +func (f *YamlManifest) Apply(spec *unstructured.Unstructured) error { + current, err := f.Get(spec) + if err != nil { + return err + } + if current == nil { + klog.Info("Creating type ", spec.GroupVersionKind(), " name ", spec.GetName()) + gvr, _ := meta.UnsafeGuessKindToResource(spec.GroupVersionKind()) + if _, err := f.client.Resource(gvr).Namespace(spec.GetNamespace()).Create(context.Background(), spec, v1.CreateOptions{}); err != nil { + return err + } + } else { + // Update existing one + if UpdateChanged(spec.UnstructuredContent(), current.UnstructuredContent()) { + klog.Info("Updating type ", spec.GroupVersionKind(), " name ", spec.GetName()) + + gvr, _ := meta.UnsafeGuessKindToResource(spec.GroupVersionKind()) + if _, err = f.client.Resource(gvr).Namespace(current.GetNamespace()).Update(context.Background(), current, v1.UpdateOptions{}); err != nil { + return err + } + } + } + return nil +} + +func (f *YamlManifest) DeleteAll() error { + a := make([]unstructured.Unstructured, len(f.resources)) + copy(a, f.resources) + // we want to delete in reverse order + for left, right := 0, len(a)-1; left < right; left, right = left+1, right-1 { + a[left], a[right] = a[right], a[left] + } + for _, spec := range a { + if err := f.Delete(&spec); err != nil { + return err + } + } + return nil +} + +func (f *YamlManifest) Delete(spec *unstructured.Unstructured) error { + current, err := f.Get(spec) + if current == nil && err == nil { + return nil + } + klog.Info("Deleting type ", spec.GroupVersionKind(), " name ", spec.GetName()) + gvr, _ := meta.UnsafeGuessKindToResource(spec.GroupVersionKind()) + if err := f.client.Resource(gvr).Namespace(spec.GetNamespace()).Delete(context.Background(), spec.GetName(), v1.DeleteOptions{}); err != nil { + // ignore GC race conditions triggered by owner references + if !errors.IsNotFound(err) { + return err + } + } + return nil +} + +func (f *YamlManifest) Get(spec *unstructured.Unstructured) (*unstructured.Unstructured, error) { + gvr, _ := meta.UnsafeGuessKindToResource(spec.GroupVersionKind()) + result, err := f.client.Resource(gvr).Namespace(spec.GetNamespace()).Get(context.Background(), spec.GetName(), v1.GetOptions{}) + if err != nil { + result = nil + if errors.IsNotFound(err) { + err = nil + } + } + return result, err +} + +func (f *YamlManifest) Find(apiVersion string, kind string, name string) *unstructured.Unstructured { + for _, spec := range f.resources { + if spec.GetAPIVersion() == apiVersion && + spec.GetKind() == kind && + spec.GetName() == name { + return spec.DeepCopy() + } + } + return nil +} + +func (f *YamlManifest) DeepCopyResources() []unstructured.Unstructured { + result := make([]unstructured.Unstructured, len(f.resources)) + for i, spec := range f.resources { + result[i] = *spec.DeepCopy() + } + return result +} + +func (f *YamlManifest) ResourceNames() []string { + var names []string + for _, spec := range f.resources { + names = append(names, fmt.Sprintf("%s/%s (%s)", spec.GetNamespace(), spec.GetName(), spec.GroupVersionKind())) + } + return names +} + +func (f *YamlManifest) References() []corev1.ObjectReference { + var refs []corev1.ObjectReference + for _, spec := range f.resources { + + ref := corev1.ObjectReference{ + Name: spec.GetName(), + Namespace: spec.GetNamespace(), + APIVersion: spec.GetAPIVersion(), + Kind: spec.GetKind(), + } + + refs = append(refs, ref) + } + return refs +} + +// We need to preserve the top-level target keys, specifically +// 'metadata.resourceVersion', 'spec.clusterIP', and any existing +// entries in a ConfigMap's 'data' field. So we only overwrite fields +// set in our src resource. +func UpdateChanged(src, tgt map[string]interface{}) bool { + changed := false + for k, v := range src { + if v, ok := v.(map[string]interface{}); ok { + if tgt[k] == nil { + tgt[k], changed = v, true + } else if UpdateChanged(v, tgt[k].(map[string]interface{})) { + // This could be an issue if a field in a nested src + // map doesn't overwrite its corresponding tgt + changed = true + } + continue + } + if !equality.Semantic.DeepEqual(v, tgt[k]) { + tgt[k], changed = v, true + } + } + return changed +} diff --git a/vendor/knative.dev/reconciler-test/pkg/manifest/templates.go b/vendor/knative.dev/reconciler-test/pkg/manifest/templates.go new file mode 100644 index 000000000..3a194b0f3 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/manifest/templates.go @@ -0,0 +1,232 @@ +/* +Copyright 2020 The Knative 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 manifest + +import ( + "bytes" + "io" + "io/fs" + "io/ioutil" + "log" + "os" + "path" + "path/filepath" + "regexp" + "runtime" + "sort" + "strings" + "text/template" +) + +// ExecuteTemplates executes a set of templates found at path, filtering on +// suffix. Executed into memory and returned. +func ExecuteTemplates(path, suffix string, images map[string]string, data map[string]interface{}) (map[string]string, error) { + files := make(map[string]string, 1) + + err := filepath.Walk(path, func(path string, info os.FileInfo, err error) error { + if info == nil || info.IsDir() { + return nil + } + if strings.HasSuffix(info.Name(), suffix) { + t, err := template.ParseFiles(path) + if err != nil { + log.Print("parse: ", err) + return err + } + buffer := &bytes.Buffer{} + + // Execute the template and save the result to the buffer. + err = t.Execute(buffer, data) + if err != nil { + log.Print("execute: ", err) + return err + } + + // Set image. + yaml := buffer.String() + for key, image := range images { + yaml = strings.Replace(yaml, key, image, -1) + } + + files[path] = yaml + } + return nil + }) + + if err != nil { + return nil, err + } + return files, nil +} + +// executeTemplatesFS executes a set of templates in the given filesystem, filtering on +// suffix. Executed into memory and returned. +func executeTemplatesFS(fsys fs.FS, suffix string, images map[string]string, data map[string]interface{}) (map[string]string, error) { + files := make(map[string]string, 1) + + err := fs.WalkDir(fsys, ".", func(path string, info fs.DirEntry, err error) error { + if info == nil || info.IsDir() { + return nil + } + if strings.HasSuffix(info.Name(), suffix) { + t, err := template.ParseFS(fsys, path) + if err != nil { + log.Print("parse: ", err) + return err + } + buffer := &bytes.Buffer{} + + // Execute the template and save the result to the buffer. + err = t.Execute(buffer, data) + if err != nil { + log.Print("execute: ", err) + return err + } + + // Set image. + yaml := buffer.String() + for key, image := range images { + yaml = strings.Replace(yaml, key, image, -1) + } + + files[path] = yaml + } + return nil + }) + + if err != nil { + return nil, err + } + return files, nil +} + +// ParseTemplates walks through all the template yaml file in the given directory +// and produces instantiated yaml file in a temporary directory. +// Returns the name of the temporary directory. +// Deprecated: Use ParseTemplatesFS. +func ParseTemplates(path string, images map[string]string, cfg map[string]interface{}) (string, error) { + return templatesToTmp(ExecuteTemplates(path, "yaml", images, cfg)) +} + +// ParseTemplatesFS walks through all the template yaml file in the given FS +// and produces instantiated yaml file in a temporary directory. +// Returns the name of the temporary directory. +func ParseTemplatesFS(fsys fs.FS, images map[string]string, cfg map[string]interface{}) (string, error) { + return templatesToTmp(executeTemplatesFS(fsys, "yaml", images, cfg)) +} + +func templatesToTmp(files map[string]string, err error) (string, error) { + if err != nil { + return "", err + } + + tmpDir, err := ioutil.TempDir("", "processed_yaml") + if err != nil { + panic(err) + } + + for file, contents := range files { + name := filepath.Base(filepath.Base(file)) + name = strings.Replace(name, ".yaml", "-*.yaml", 1) + + tmpFile, err := ioutil.TempFile(tmpDir, name) + if err != nil { + panic(err) + } + _, _ = tmpFile.WriteString(contents) + } + + log.Print("new files in ", tmpDir) + return tmpDir, nil +} + +// ExecuteYAML process the templates found in files named "*.yaml" and return the f. +func ExecuteYAML(fsys fs.FS, images map[string]string, cfg map[string]interface{}) (map[string]string, error) { + return executeTemplatesFS(fsys, "yaml", images, cfg) +} + +// ExecuteLocalYAML will look in the callers filesystem and process the +// templates found in files named "*.yaml" and return the f. +// Deprecated: Use ExecuteYAML instead. +func ExecuteLocalYAML(images map[string]string, cfg map[string]interface{}) (map[string]string, error) { + pwd, _ := os.Getwd() + log.Println("PWD: ", pwd) + _, filename, _, _ := runtime.Caller(1) + + return ExecuteTemplates(path.Dir(filename), "yaml", images, cfg) +} + +func removeBlanks(in string) string { + in = strings.TrimSpace(in) + // find one or more tabs and spaces ending with a new line. + regex, err := regexp.Compile("[ |\t]+\n") + if err != nil { + return in + } + in = regex.ReplaceAllString(in, "") + + // find all two more more newlines and replaces them with a single. + regex, err = regexp.Compile("\n{2,}") + if err != nil { + return in + } + return regex.ReplaceAllString(in, "\n") +} + +func removeComments(in string) string { + // find strings starting with # and ending with \n and remove them. + regex, err := regexp.Compile("#.*\n") + if err != nil { + return in + } + return regex.ReplaceAllString(in, "") +} + +// OutputYAML writes out each file contents to out after removing comments and +// blank lines. This also adds a YAML file separator "---" between each file. +// Files is a map of "filename" to "file contents". +func OutputYAML(out io.Writer, files map[string]string) { + names := make([]string, 0) + for name := range files { + names = append(names, name) + } + sort.Strings(names) + + more := false + for _, name := range names { + file := files[name] + + if more { + _, _ = out.Write([]byte("---\n")) + } + more = true + yaml := removeBlanks(removeComments(file)) + _, _ = out.Write([]byte(yaml)) + _, _ = out.Write([]byte("\n")) + } +} + +// ExecuteTemplate instantiates the given template with data +func ExecuteTemplate(tpl string, data map[string]interface{}) (string, error) { + t, err := template.New("").Parse(tpl) + if err != nil { + panic(err) + } + buffer := &bytes.Buffer{} + err = t.Execute(buffer, data) + return buffer.String(), err +} diff --git a/vendor/knative.dev/reconciler-test/pkg/manifest/yaml.go b/vendor/knative.dev/reconciler-test/pkg/manifest/yaml.go new file mode 100644 index 000000000..88ab4c14d --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/manifest/yaml.go @@ -0,0 +1,155 @@ +/* +Copyright 2020 The Knative 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 manifest + +import ( + "io" + "io/ioutil" + "net/http" + "net/url" + "os" + "path" + "strings" + + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/util/yaml" +) + +// Parse parses YAML files into Unstructured objects. +// +// It supports 5 cases today: +// 1. pathname = path to a file --> parses that file. +// 2. pathname = path to a directory, recursive = false --> parses all files in +// that directory. +// 3. pathname = path to a directory, recursive = true --> parses all files in +// that directory and it's descendants +// 4. pathname = url --> fetches the contents of that URL and parses them as YAML. +// 5. pathname = combination of all previous cases, the string can contain +// multiple records (file, directory or url) separated by comma +func Parse(pathname string, recursive bool) ([]unstructured.Unstructured, error) { + + pathnames := strings.Split(pathname, ",") + aggregated := []unstructured.Unstructured{} + for _, pth := range pathnames { + els, err := read(pth, recursive) + if err != nil { + return nil, err + } + + aggregated = append(aggregated, els...) + } + return aggregated, nil +} + +// read contains logic to distinguish the type of record in pathname +// (file, directory or url) and calls the appropriate function +func read(pathname string, recursive bool) ([]unstructured.Unstructured, error) { + if isURL(pathname) { + return readURL(pathname) + } + + info, err := os.Stat(pathname) + if err != nil { + return nil, err + } + + if info.IsDir() { + return readDir(pathname, recursive) + } + return readFile(pathname) +} + +// readFile parses a single file. +func readFile(pathname string) ([]unstructured.Unstructured, error) { + file, err := os.Open(pathname) + if err != nil { + return nil, err + } + defer file.Close() + + return decode(file) +} + +// readDir parses all files in a single directory and it's descendant directories +// if the recursive flag is set to true. +func readDir(pathname string, recursive bool) ([]unstructured.Unstructured, error) { + list, err := ioutil.ReadDir(pathname) + if err != nil { + return nil, err + } + + aggregated := []unstructured.Unstructured{} + for _, f := range list { + name := path.Join(pathname, f.Name()) + var els []unstructured.Unstructured + + switch { + case f.IsDir() && recursive: + els, err = readDir(name, recursive) + case !f.IsDir(): + els, err = readFile(name) + } + + if err != nil { + return nil, err + } + aggregated = append(aggregated, els...) + } + return aggregated, nil +} + +// readURL fetches a URL and parses its contents as YAML. +func readURL(url string) ([]unstructured.Unstructured, error) { + resp, err := http.Get(url) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + return decode(resp.Body) +} + +// decode consumes the given reader and parses its contents as YAML. +func decode(reader io.Reader) ([]unstructured.Unstructured, error) { + decoder := yaml.NewYAMLToJSONDecoder(reader) + objs := []unstructured.Unstructured{} + var err error + for { + out := unstructured.Unstructured{} + err = decoder.Decode(&out) + if err != nil { + break + } + objs = append(objs, out) + } + if err != io.EOF { + return nil, err + } + return objs, nil +} + +// isURL checks whether or not the given path parses as a URL. +func isURL(pathname string) bool { + uri, err := url.ParseRequestURI(pathname) + if err != nil { + return false + } + if uri.Scheme == "" { + return false + } + return true +} diff --git a/vendor/knative.dev/reconciler-test/pkg/milestone/emitter.go b/vendor/knative.dev/reconciler-test/pkg/milestone/emitter.go new file mode 100644 index 000000000..74199a6bd --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/milestone/emitter.go @@ -0,0 +1,212 @@ +/* +Copyright 2021 The Knative 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 milestone + +import ( + "context" + "fmt" + "time" + + cloudevents "github.com/cloudevents/sdk-go/v2" + "github.com/kelseyhightower/envconfig" + "go.uber.org/zap" + "knative.dev/pkg/apis" + "knative.dev/pkg/logging" + + "knative.dev/reconciler-test/pkg/feature" +) + +const ( + enableRetry = true + retryBackoff = 10 * time.Millisecond + maxTries = 3 +) + +type envConfig struct { + MilestoneEventsTarget string `envconfig:"MILESTONE_EVENTS_TARGET"` +} + +// Emitter sends milestone events. +type Emitter interface { + // Helpers to create known events. + + Environment(env map[string]string) + NamespaceCreated(namespace string) + NamespaceDeleted(namespace string) + TestStarted(feature string, t feature.T) + TestFinished(feature string, t feature.T) + StepsPlanned(feature string, steps map[feature.Timing][]feature.Step, t feature.T) + StepStarted(feature string, step *feature.Step, t feature.T) + StepFinished(feature string, step *feature.Step, t feature.T) + TestSetStarted(featureSet string, t feature.T) + TestSetFinished(featureSet string, t feature.T) + Finished() + Exception(reason, messageFormat string, messageA ...interface{}) +} + +// NewMilestoneEmitterFromEnv will attempt to pull the env var +// `MILESTONE_EVENTS_TARGET` as the target uri for sending milestone events. +func NewMilestoneEmitterFromEnv(instance, namespace string) (Emitter, error) { + var env envConfig + if err := envconfig.Process("", &env); err != nil { + return nil, err + } + if len(env.MilestoneEventsTarget) > 0 { + fmt.Printf("milestone events target: %s\n\n", env.MilestoneEventsTarget) + return NewMilestoneEmitter(instance, namespace, env.MilestoneEventsTarget) + } + return &NilSafeClient{}, nil +} + +// NewMilestoneEmitter will convert target uri to a milestone event sender and return it. +// +func NewMilestoneEmitter(instance, namespace, uri string) (Emitter, error) { + target, err := apis.ParseURL(uri) + if err != nil { + return nil, err + } + switch target.Scheme { + case "http", "https": + p, err := cloudevents.NewHTTP(cloudevents.WithTarget(target.String())) + if err != nil { + return nil, err + } + client, err := cloudevents.NewClient(p, cloudevents.WithTimeNow(), cloudevents.WithUUIDs()) + return &NilSafeClient{ + Client: client, + Factory: NewFactory(instance, namespace), + }, err + default: + return nil, fmt.Errorf("unsupported milestone event target uri: %q", target.String()) + } +} + +// NilSafeClient is a simple wrapper around a cloudevent client that implements +// Emitter to provide nil check safety. +type NilSafeClient struct { + Client cloudevents.Client + Factory *Factory +} + +func (n *NilSafeClient) Environment(env map[string]string) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.Environment(env)) +} + +func (n *NilSafeClient) NamespaceCreated(namespace string) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.NamespaceCreated(namespace)) +} + +func (n *NilSafeClient) NamespaceDeleted(namespace string) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.NamespaceDeleted(namespace)) +} + +func (n *NilSafeClient) TestStarted(feature string, t feature.T) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.TestStarted(feature, t.Name())) +} + +func (n *NilSafeClient) TestFinished(feature string, t feature.T) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.TestFinished(feature, t.Name(), t.Skipped(), t.Failed())) +} + +func (n *NilSafeClient) StepsPlanned(feature string, steps map[feature.Timing][]feature.Step, t feature.T) { + if n == nil || n.Client == nil { + return + } + + sm := make(map[string][]string) + for k, v := range steps { + sm[k.String()] = make([]string, len(v)) + for i, step := range v { + sm[k.String()][i] = step.Name + } + } + + n.Event(context.Background(), n.Factory.StepsPlanned(feature, sm, t.Name())) +} + +func (n *NilSafeClient) StepStarted(feature string, step *feature.Step, t feature.T) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.StepStarted(feature, step.Name, step.T.String(), step.L.String(), t.Name())) +} + +func (n *NilSafeClient) StepFinished(feature string, step *feature.Step, t feature.T) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.StepFinished(feature, step.Name, step.T.String(), step.L.String(), t.Name(), t.Skipped(), t.Failed())) +} + +func (n *NilSafeClient) TestSetStarted(featureSet string, t feature.T) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.TestSetStarted(featureSet, t.Name())) +} + +func (n *NilSafeClient) TestSetFinished(featureSet string, t feature.T) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.TestSetFinished(featureSet, t.Name(), t.Skipped(), t.Failed())) +} + +func (n *NilSafeClient) Finished() { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.Finished()) +} + +func (n *NilSafeClient) Exception(reason, messageFormat string, messageA ...interface{}) { + if n == nil || n.Client == nil { + return + } + n.Event(context.Background(), n.Factory.Exception(reason, messageFormat, messageA...)) +} + +// Event implements Emitter.Event. +func (n *NilSafeClient) Event(ctx context.Context, event cloudevents.Event) { + if n == nil || n.Client == nil { + return + } + if enableRetry { + // Adds retry to the outbound send attempt. + ctx = cloudevents.ContextWithRetriesExponentialBackoff(ctx, retryBackoff, maxTries) + } + if result := n.Client.Send(ctx, event); cloudevents.IsUndelivered(result) { + logging.FromContext(ctx).Errorw("failed to deliver milestone event", zap.Error(result)) + } else if cloudevents.IsNACK(result) { + logging.FromContext(ctx).Errorw("milestone event target returned NACK", zap.Error(result), zap.String("event", event.Type())) + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/milestone/factory.go b/vendor/knative.dev/reconciler-test/pkg/milestone/factory.go new file mode 100644 index 000000000..9d4f89179 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/milestone/factory.go @@ -0,0 +1,266 @@ +/* +Copyright 2021 The Knative 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 milestone + +import ( + "fmt" + "strings" + + cloudevents "github.com/cloudevents/sdk-go/v2" +) + +const ( + EnvironmentType = "dev.knative.rekt.environment.v1" + NamespaceCreatedType = "dev.knative.rekt.namespace.created.v1" + NamespaceDeletedType = "dev.knative.rekt.namespace.deleted.v1" + TestStartedType = "dev.knative.rekt.test.started.v1" + TestFinishedType = "dev.knative.rekt.test.finished.v1" + StepsPlannedType = "dev.knative.rekt.steps.planned.v1" + StepStartedType = "dev.knative.rekt.step.started.v1" + StepFinishedType = "dev.knative.rekt.step.finished.v1" + TestSetStartedType = "dev.knative.rekt.testset.started.v1" + TestSetFinishedType = "dev.knative.rekt.testset.finished.v1" + FinishedType = "dev.knative.rekt.finished.v1" + ExceptionType = "dev.knative.rekt.exception.v1" +) + +func NewFactory(id, namespace string) *Factory { + return &Factory{ + Source: "knative.dev/reconciler-test/" + id, // TODO: revisit. + Subject: fmt.Sprintf("/api/v1/namespaces/%s", namespace), + } +} + +type Factory struct { + Subject string + Source string +} + +func (ef *Factory) Environment(env map[string]string) cloudevents.Event { + event := ef.baseEvent(EnvironmentType) + + _ = event.SetData(cloudevents.ApplicationJSON, env) + + return event +} + +func (ef *Factory) baseEvent(eventType string) cloudevents.Event { + event := cloudevents.NewEvent() + + event.SetSubject(ef.Subject) + event.SetSource(ef.Source) + event.SetType(eventType) + + return event +} + +func (ef *Factory) NamespaceCreated(namespace string) cloudevents.Event { + event := ef.baseEvent(NamespaceCreatedType) + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]string{ + "namespace": namespace, + }) + + return event +} + +func (ef *Factory) NamespaceDeleted(namespace string) cloudevents.Event { + event := ef.baseEvent(NamespaceDeletedType) + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]string{ + "namespace": namespace, + }) + + return event +} + +func (ef *Factory) TestStarted(feature, testName string) cloudevents.Event { + event := ef.baseEvent(TestStartedType) + + lparts := strings.Split(testName, "/") + if len(lparts) > 0 { + event.SetExtension("testparent", lparts[0]) + } + + event.SetExtension("feature", feature) + event.SetExtension("testname", testName) + + // TODO: we can log a whole lot of stuff here but we need a more formal structure to track + // where we are in the test to be able to assemble it. + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]interface{}{ + "feature": feature, + "testName": testName, + }) + + return event +} + +func (ef *Factory) TestFinished(feature, testName string, skipped, failed bool) cloudevents.Event { + event := ef.baseEvent(TestFinishedType) + + lparts := strings.Split(testName, "/") + if len(lparts) > 0 { + event.SetExtension("testparent", lparts[0]) + } + + event.SetExtension("feature", feature) + event.SetExtension("testname", testName) + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]interface{}{ + "feature": feature, + "testName": testName, + "skipped": skipped, + "failed": failed, + "passed": !failed && !skipped, + }) + + return event +} + +func (ef *Factory) StepsPlanned(feature string, steps map[string][]string, testName string) cloudevents.Event { + event := ef.baseEvent(StepsPlannedType) + + lparts := strings.Split(testName, "/") + if len(lparts) > 0 { + event.SetExtension("testparent", lparts[0]) + } + + event.SetExtension("feature", feature) + event.SetExtension("testname", testName) + + // TODO: we can log a whole lot of stuff here but we need a more formal structure to track + // where we are in the test to be able to assemble it. + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]interface{}{ + "feature": feature, + "steps": steps, + "testName": testName, + }) + + return event +} + +func (ef *Factory) StepStarted(feature, stepName, timing, level, testName string) cloudevents.Event { + event := ef.baseEvent(StepStartedType) + + lparts := strings.Split(testName, "/") + if len(lparts) > 0 { + event.SetExtension("testparent", lparts[0]) + } + + event.SetExtension("feature", feature) + event.SetExtension("stepname", stepName) + event.SetExtension("steptiming", timing) + event.SetExtension("steplevel", level) + event.SetExtension("testname", testName) + + // TODO: we can log a whole lot of stuff here but we need a more formal structure to track + // where we are in the test to be able to assemble it. + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]interface{}{ + "feature": feature, + "stepName": stepName, + "stepTiming": timing, + "stepLevel": level, + "testName": testName, + }) + + return event +} + +func (ef *Factory) StepFinished(feature, stepName, timing, level, testName string, skipped, failed bool) cloudevents.Event { + event := ef.baseEvent(StepFinishedType) + + lparts := strings.Split(testName, "/") + if len(lparts) > 0 { + event.SetExtension("testparent", lparts[0]) + } + + event.SetExtension("feature", feature) + event.SetExtension("stepname", stepName) + event.SetExtension("steptiming", timing) + event.SetExtension("steplevel", level) + event.SetExtension("testname", testName) + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]interface{}{ + "feature": feature, + "stepName": stepName, + "stepTiming": timing, + "stepLevel": level, + "testName": testName, + "skipped": skipped, + "failed": failed, + "passed": !failed && !skipped, + }) + + return event +} + +func (ef *Factory) TestSetStarted(featureSet, testName string) cloudevents.Event { + event := ef.baseEvent(TestSetStartedType) + + event.SetExtension("featureset", featureSet) + event.SetExtension("testname", testName) + + // TODO: we can log a whole lot of stuff here but we need a more formal structure to track + // where we are in the test to be able to assemble it. + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]interface{}{ + "featureSet": featureSet, + "testName": testName, + }) + + return event +} + +func (ef *Factory) TestSetFinished(featureSet, testName string, skipped, failed bool) cloudevents.Event { + event := ef.baseEvent(TestSetFinishedType) + + event.SetExtension("featureset", featureSet) + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]interface{}{ + "featureSet": featureSet, + "testName": testName, + "skipped": skipped, + "failed": failed, + "passed": !failed && !skipped, + }) + + return event +} + +func (ef *Factory) Finished() cloudevents.Event { + event := ef.baseEvent(FinishedType) + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]string{}) + + return event +} + +func (ef *Factory) Exception(reason, messageFormat string, messageA ...interface{}) cloudevents.Event { + event := ef.baseEvent(ExceptionType) + + event.SetExtension("reason", reason) + + _ = event.SetData(cloudevents.ApplicationJSON, map[string]string{ + "reason": reason, + "message": fmt.Sprintf(messageFormat, messageA...), + }) + + return event +} diff --git a/vendor/knative.dev/reconciler-test/pkg/state/context.go b/vendor/knative.dev/reconciler-test/pkg/state/context.go new file mode 100644 index 000000000..8f449ca02 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/state/context.go @@ -0,0 +1,70 @@ +/* +Copyright 2021 The Knative 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 state + +import ( + "context" +) + +type envKey struct{} + +// ContextWith decorates the given context with the provided Store, and returns +// the resulting context. +func ContextWith(ctx context.Context, s Store) context.Context { + return context.WithValue(ctx, envKey{}, s) +} + +// FromContext returns the Store from Context, if not found FromContext will +// panic. +// TODO: revisit if we really want to panic here... likely not. +func FromContext(ctx context.Context) Store { + if e, ok := ctx.Value(envKey{}).(Store); ok { + return e + } + panic("no Store found in context") +} + +// Fail is defined to avoid circular dependency with the feature package. +type fail interface { + Error(args ...interface{}) +} + +// Get the string value from the kvstore from key. +func GetStringOrFail(ctx context.Context, t fail, key string) string { + value := "" + state := FromContext(ctx) + if err := state.Get(ctx, key, &value); err != nil { + t.Error(err) + } + return value +} + +// Get gets the key from the Store into the provided value +func GetOrFail(ctx context.Context, t fail, key string, value interface{}) { + state := FromContext(ctx) + if err := state.Get(ctx, key, value); err != nil { + t.Error(err) + } +} + +// Set sets the key into the Store from the provided value +func SetOrFail(ctx context.Context, t fail, key string, value interface{}) { + state := FromContext(ctx) + if err := state.Set(ctx, key, value); err != nil { + t.Error(err) + } +} diff --git a/vendor/knative.dev/reconciler-test/pkg/state/interfaces.go b/vendor/knative.dev/reconciler-test/pkg/state/interfaces.go new file mode 100644 index 000000000..34f958cb3 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/state/interfaces.go @@ -0,0 +1,27 @@ +/* +Copyright 2021 The Knative 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 state + +import "context" + +// This is a subset of knative.dev/pkg/kvstore.Interface +type Store interface { + // Get gets the key from the Store into the provided value + Get(ctx context.Context, key string, value interface{}) error + // Set sets the key into the Store from the provided value + Set(ctx context.Context, key string, value interface{}) error +} diff --git a/vendor/knative.dev/reconciler-test/pkg/state/kvstore.go b/vendor/knative.dev/reconciler-test/pkg/state/kvstore.go new file mode 100644 index 000000000..082bc103f --- /dev/null +++ b/vendor/knative.dev/reconciler-test/pkg/state/kvstore.go @@ -0,0 +1,67 @@ +/* +Copyright 2021 The Knative 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 state + +import ( + "context" + "encoding/json" + "fmt" + "sync" +) + +type KVStore struct { + store map[string]string + mux sync.Mutex +} + +// Get retrieves and unmarshals the value from the map. +func (cs *KVStore) Get(_ context.Context, key string, value interface{}) error { + cs.mux.Lock() + defer cs.mux.Unlock() + + if cs.store == nil { + cs.store = make(map[string]string) + } + + v, ok := cs.store[key] + + if !ok { + return fmt.Errorf("key %s does not exist", key) + } + err := json.Unmarshal([]byte(v), value) + if err != nil { + return fmt.Errorf("failed to Unmarshal %q: %v", v, err) + } + return nil +} + +// Set marshals and sets the value given under specified key. +func (cs *KVStore) Set(_ context.Context, key string, value interface{}) error { + cs.mux.Lock() + defer cs.mux.Unlock() + + if cs.store == nil { + cs.store = make(map[string]string) + } + + bytes, err := json.Marshal(value) + if err != nil { + return fmt.Errorf("failed to Marshal: %v", err) + } + cs.store[key] = string(bytes) + return nil +} diff --git a/vendor/knative.dev/reconciler-test/resources/svc/service.go b/vendor/knative.dev/reconciler-test/resources/svc/service.go new file mode 100644 index 000000000..e0d63b2f0 --- /dev/null +++ b/vendor/knative.dev/reconciler-test/resources/svc/service.go @@ -0,0 +1,82 @@ +/* +Copyright 2021 The Knative 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 svc + +import ( + "context" + "embed" + + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/apis" + duckv1 "knative.dev/pkg/apis/duck/v1" + "knative.dev/pkg/tracker" + + "knative.dev/reconciler-test/pkg/feature" + "knative.dev/reconciler-test/pkg/k8s" + "knative.dev/reconciler-test/pkg/manifest" +) + +//go:embed *.yaml +var templates embed.FS + +func GVR() schema.GroupVersionResource { + return schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"} +} + +// Install will create a Service resource mapping :80 to :8080 on the provided +// selector for pods. +func Install(name, selectorKey, selectorValue string) feature.StepFn { + cfg := map[string]interface{}{ + "name": name, + "selectorKey": selectorKey, + "selectorValue": selectorValue, + } + + return func(ctx context.Context, t feature.T) { + if _, err := manifest.InstallYamlFS(ctx, templates, cfg); err != nil { + t.Fatal(err) + } + } +} + +// AsKReference returns a KReference for a Service without namespace. +func AsKReference(name string) *duckv1.KReference { + return &duckv1.KReference{ + Kind: "Service", + Name: name, + APIVersion: "v1", + } +} + +func AsTrackerReference(name string) *tracker.Reference { + return &tracker.Reference{ + Kind: "Service", + Name: name, + APIVersion: "v1", + } +} + +func AsDestinationRef(name string) *duckv1.Destination { + return &duckv1.Destination{ + Ref: AsKReference(name), + } +} + +// Address +func Address(ctx context.Context, name string) (*apis.URL, error) { + return k8s.Address(ctx, GVR(), name) +} diff --git a/vendor/knative.dev/reconciler-test/resources/svc/service.yaml b/vendor/knative.dev/reconciler-test/resources/svc/service.yaml new file mode 100644 index 000000000..e96ad589a --- /dev/null +++ b/vendor/knative.dev/reconciler-test/resources/svc/service.yaml @@ -0,0 +1,26 @@ +# Copyright 2021 The Knative 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. + +apiVersion: v1 +kind: Service +metadata: + name: {{ .name }} + namespace: {{ .namespace }} +spec: + selector: + {{ .selectorKey }}: {{ .selectorValue }} + ports: + - protocol: TCP + port: 80 + targetPort: 8080 diff --git a/vendor/knative.dev/serving/pkg/apis/serving/fieldmask.go b/vendor/knative.dev/serving/pkg/apis/serving/fieldmask.go index 772cd764f..4ea939b29 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/fieldmask.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/fieldmask.go @@ -366,6 +366,7 @@ func HTTPGetActionMask(in *corev1.HTTPGetAction) *corev1.HTTPGetAction { out.Path = in.Path out.Scheme = in.Scheme out.HTTPHeaders = in.HTTPHeaders + out.Port = in.Port return out } @@ -381,6 +382,7 @@ func TCPSocketActionMask(in *corev1.TCPSocketAction) *corev1.TCPSocketAction { // Allowed fields out.Host = in.Host + out.Port = in.Port return out } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go index 3c737c355..583f3387c 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go @@ -324,14 +324,19 @@ func ValidatePodSpec(ctx context.Context, ps corev1.PodSpec) *apis.FieldError { errs = errs.Also(err.ViaField("volumes")) } + port, err := validateContainersPorts(ps.Containers) + if err != nil { + errs = errs.Also(err.ViaField("containers[*]")) + } + switch len(ps.Containers) { case 0: errs = errs.Also(apis.ErrMissingField("containers")) case 1: - errs = errs.Also(ValidateContainer(ctx, ps.Containers[0], volumes). + errs = errs.Also(ValidateContainer(ctx, ps.Containers[0], volumes, port). ViaFieldIndex("containers", 0)) default: - errs = errs.Also(validateContainers(ctx, ps.Containers, volumes)) + errs = errs.Also(validateContainers(ctx, ps.Containers, volumes, port)) } if ps.ServiceAccountName != "" { for _, err := range validation.IsDNS1123Subdomain(ps.ServiceAccountName) { @@ -356,20 +361,20 @@ func validateInitContainers(ctx context.Context, containers []corev1.Container, return errs } -func validateContainers(ctx context.Context, containers []corev1.Container, volumes map[string]corev1.Volume) (errs *apis.FieldError) { +func validateContainers(ctx context.Context, containers []corev1.Container, volumes map[string]corev1.Volume, port corev1.ContainerPort) (errs *apis.FieldError) { features := config.FromContextOrDefaults(ctx).Features if features.MultiContainer != config.Enabled { return errs.Also(&apis.FieldError{Message: fmt.Sprintf("multi-container is off, "+ "but found %d containers", len(containers))}) } - errs = errs.Also(validateContainersPorts(containers).ViaField("containers")) for i := range containers { // Probes are not allowed on other than serving container, // ref: http://bit.ly/probes-condition if len(containers[i].Ports) == 0 { + // Note, if we allow readiness/liveness checks on sidecars, we should pass in an *empty* port here, not the main container's port. errs = errs.Also(validateSidecarContainer(WithinSidecarContainer(ctx), containers[i], volumes).ViaFieldIndex("containers", i)) } else { - errs = errs.Also(ValidateContainer(WithinUserContainer(ctx), containers[i], volumes).ViaFieldIndex("containers", i)) + errs = errs.Also(ValidateContainer(WithinUserContainer(ctx), containers[i], volumes, port).ViaFieldIndex("containers", i)) } } return errs @@ -386,21 +391,38 @@ func AllMountedVolumes(containers []corev1.Container) sets.String { return volumeNames } -// validateContainersPorts validates port when specified multiple containers -func validateContainersPorts(containers []corev1.Container) *apis.FieldError { +// validateContainersPorts validates port when specified multiple containers, +// and returns the single serving port if error is nil +func validateContainersPorts(containers []corev1.Container) (corev1.ContainerPort, *apis.FieldError) { var count int + var port = corev1.ContainerPort{ + Name: "http", + ContainerPort: 8080, + } for i := range containers { - count += len(containers[i].Ports) + if c := len(containers[i].Ports); c > 0 { + count += c + if containers[i].Ports[0].ContainerPort != 0 { + port.ContainerPort = containers[i].Ports[0].ContainerPort + } + if containers[i].Ports[0].Name != "" { + port.Name = containers[i].Ports[0].Name + } + } } // When no container ports are specified. - if count == 0 { - return apis.ErrMissingField("ports") + if count == 0 && len(containers) > 1 { + return port, apis.ErrMissingField("ports") } // More than one container sections have ports. if count > 1 { - return apis.ErrMultipleOneOf("ports") + return port, &apis.FieldError{ + Message: "more than one container port is set", + Paths: []string{"ports"}, + Details: "Only a single port is allowed across all containers", + } } - return nil + return port, nil } // validateSidecarContainer validate fields for non serving containers @@ -447,27 +469,14 @@ func validateInitContainer(ctx context.Context, container corev1.Container, volu } // ValidateContainer validate fields for serving containers -func ValidateContainer(ctx context.Context, container corev1.Container, volumes map[string]corev1.Volume) (errs *apis.FieldError) { - // Single container cannot have multiple ports - errs = errs.Also(portValidation(container.Ports).ViaField("ports")) +func ValidateContainer(ctx context.Context, container corev1.Container, volumes map[string]corev1.Volume, port corev1.ContainerPort) (errs *apis.FieldError) { // Liveness Probes - errs = errs.Also(validateProbe(container.LivenessProbe).ViaField("livenessProbe")) + errs = errs.Also(validateProbe(container.LivenessProbe, port).ViaField("livenessProbe")) // Readiness Probes - errs = errs.Also(validateReadinessProbe(container.ReadinessProbe).ViaField("readinessProbe")) + errs = errs.Also(validateReadinessProbe(container.ReadinessProbe, port).ViaField("readinessProbe")) return errs.Also(validate(ctx, container, volumes)) } -func portValidation(containerPorts []corev1.ContainerPort) *apis.FieldError { - if len(containerPorts) > 1 { - return &apis.FieldError{ - Message: "More than one container port is set", - Paths: []string{apis.CurrentField}, - Details: "Only a single port is allowed", - } - } - return nil -} - func validate(ctx context.Context, container corev1.Container, volumes map[string]corev1.Volume) *apis.FieldError { if equality.Semantic.DeepEqual(container, corev1.Container{}) { return apis.ErrMissingField(apis.CurrentField) @@ -653,12 +662,12 @@ func validateContainerPortBasic(port corev1.ContainerPort) *apis.FieldError { return errs } -func validateReadinessProbe(p *corev1.Probe) *apis.FieldError { +func validateReadinessProbe(p *corev1.Probe, port corev1.ContainerPort) *apis.FieldError { if p == nil { return nil } - errs := validateProbe(p) + errs := validateProbe(p, port) if p.PeriodSeconds < 0 { errs = errs.Also(apis.ErrOutOfBoundsValue(p.PeriodSeconds, 0, math.MaxInt32, "periodSeconds")) @@ -700,7 +709,7 @@ func validateReadinessProbe(p *corev1.Probe) *apis.FieldError { return errs } -func validateProbe(p *corev1.Probe) *apis.FieldError { +func validateProbe(p *corev1.Probe, port corev1.ContainerPort) *apis.FieldError { if p == nil { return nil } @@ -714,10 +723,18 @@ func validateProbe(p *corev1.Probe) *apis.FieldError { if h.HTTPGet != nil { handlers = append(handlers, "httpGet") errs = errs.Also(apis.CheckDisallowedFields(*h.HTTPGet, *HTTPGetActionMask(h.HTTPGet))).ViaField("httpGet") + getPort := h.HTTPGet.Port + if (getPort.StrVal != "" && getPort.StrVal != port.Name) || (getPort.IntVal != 0 && getPort.IntVal != port.ContainerPort) { + errs = errs.Also(apis.ErrInvalidValue(getPort.String(), "httpGet.port", "May only probe containerPort")) + } } if h.TCPSocket != nil { handlers = append(handlers, "tcpSocket") errs = errs.Also(apis.CheckDisallowedFields(*h.TCPSocket, *TCPSocketActionMask(h.TCPSocket))).ViaField("tcpSocket") + tcpPort := h.TCPSocket.Port + if (tcpPort.StrVal != "" && tcpPort.StrVal != port.Name) || (tcpPort.IntVal != 0 && tcpPort.IntVal != port.ContainerPort) { + errs = errs.Also(apis.ErrInvalidValue(tcpPort.String(), "tcpSocket.port", "May only probe containerPort")) + } } if h.Exec != nil { handlers = append(handlers, "exec") diff --git a/vendor/modules.txt b/vendor/modules.txt index a4bc7280d..c45936148 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,9 +1,12 @@ -# cloud.google.com/go v0.97.0 +# cloud.google.com/go v0.98.0 +## explicit cloud.google.com/go/compute/metadata # contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d contrib.go.opencensus.io/exporter/ocagent # contrib.go.opencensus.io/exporter/prometheus v0.4.0 contrib.go.opencensus.io/exporter/prometheus +# contrib.go.opencensus.io/exporter/zipkin v0.1.2 +contrib.go.opencensus.io/exporter/zipkin # github.com/Azure/go-autorest v14.2.0+incompatible github.com/Azure/go-autorest # github.com/Azure/go-autorest/autorest v0.11.17 @@ -44,6 +47,9 @@ github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1 github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1 # github.com/cespare/xxhash/v2 v2.1.1 github.com/cespare/xxhash/v2 +# github.com/cloudevents/conformance v0.2.0 +github.com/cloudevents/conformance/pkg/event +github.com/cloudevents/conformance/pkg/http # github.com/cloudevents/sdk-go/v2 v2.4.1 ## explicit github.com/cloudevents/sdk-go/v2 @@ -59,6 +65,7 @@ github.com/cloudevents/sdk-go/v2/event/datacodec/text github.com/cloudevents/sdk-go/v2/event/datacodec/xml github.com/cloudevents/sdk-go/v2/protocol github.com/cloudevents/sdk-go/v2/protocol/http +github.com/cloudevents/sdk-go/v2/test github.com/cloudevents/sdk-go/v2/types # github.com/containerd/containerd v1.5.7 github.com/containerd/containerd/errdefs @@ -130,7 +137,8 @@ github.com/go-kit/log github.com/go-kit/log/level # github.com/go-logfmt/logfmt v0.5.0 github.com/go-logfmt/logfmt -# github.com/go-logr/logr v1.2.0 +# github.com/go-logr/logr v1.2.2 +## explicit github.com/go-logr/logr # github.com/go-openapi/jsonpointer v0.19.5 github.com/go-openapi/jsonpointer @@ -299,15 +307,27 @@ github.com/opencontainers/go-digest github.com/opencontainers/image-spec/specs-go github.com/opencontainers/image-spec/specs-go/v1 # github.com/openzipkin/zipkin-go v0.3.0 +## explicit +github.com/openzipkin/zipkin-go +github.com/openzipkin/zipkin-go/idgenerator github.com/openzipkin/zipkin-go/model +github.com/openzipkin/zipkin-go/propagation +github.com/openzipkin/zipkin-go/reporter +github.com/openzipkin/zipkin-go/reporter/http # github.com/pelletier/go-toml v1.9.4 github.com/pelletier/go-toml +# github.com/pelletier/go-toml/v2 v2.0.0-beta.2 +github.com/pelletier/go-toml/v2 +github.com/pelletier/go-toml/v2/internal/ast +github.com/pelletier/go-toml/v2/internal/tracker +github.com/pelletier/go-toml/v2/internal/unsafe # github.com/peterbourgon/diskv v2.0.1+incompatible github.com/peterbourgon/diskv # github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 ## explicit github.com/phayes/freeport # github.com/pkg/errors v0.9.1 +## explicit github.com/pkg/errors # github.com/pmezard/go-difflib v1.0.0 github.com/pmezard/go-difflib/difflib @@ -318,6 +338,7 @@ github.com/prometheus/client_golang/prometheus/promhttp # github.com/prometheus/client_model v0.2.0 github.com/prometheus/client_model/go # github.com/prometheus/common v0.32.1 +## explicit github.com/prometheus/common/expfmt github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg github.com/prometheus/common/model @@ -357,6 +378,7 @@ github.com/spf13/viper/internal/encoding/toml github.com/spf13/viper/internal/encoding/yaml # github.com/stretchr/testify v1.7.0 github.com/stretchr/testify/assert +github.com/stretchr/testify/require # github.com/subosito/gotenv v1.2.0 github.com/subosito/gotenv # github.com/thediveo/enumflag v0.10.0 @@ -439,7 +461,7 @@ golang.org/x/mod/internal/lazyregexp golang.org/x/mod/modfile golang.org/x/mod/module golang.org/x/mod/semver -# golang.org/x/net v0.0.0-20211101193420-4a448f8816b3 +# golang.org/x/net v0.0.0-20211020060615-d418f374d309 golang.org/x/net/context golang.org/x/net/context/ctxhttp golang.org/x/net/http/httpguts @@ -451,7 +473,7 @@ golang.org/x/net/internal/socks golang.org/x/net/internal/timeseries golang.org/x/net/proxy golang.org/x/net/trace -# golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5 +# golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 golang.org/x/oauth2 golang.org/x/oauth2/authhandler golang.org/x/oauth2/google @@ -462,7 +484,7 @@ golang.org/x/oauth2/jwt # golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sync/errgroup golang.org/x/sync/semaphore -# golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 +# golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 golang.org/x/sys/execabs golang.org/x/sys/internal/unsafeheader golang.org/x/sys/plan9 @@ -484,7 +506,8 @@ golang.org/x/text/unicode/norm golang.org/x/text/width # golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac golang.org/x/time/rate -# golang.org/x/tools v0.1.7 +# golang.org/x/tools v0.1.8 +## explicit golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/internal/gcimporter golang.org/x/tools/go/internal/packagesdriver @@ -502,7 +525,7 @@ golang.org/x/xerrors golang.org/x/xerrors/internal # gomodules.xyz/jsonpatch/v2 v2.2.0 gomodules.xyz/jsonpatch/v2 -# google.golang.org/api v0.60.0 +# google.golang.org/api v0.61.0 google.golang.org/api/support/bundler # google.golang.org/appengine v1.6.7 google.golang.org/appengine @@ -515,11 +538,12 @@ google.golang.org/appengine/internal/modules google.golang.org/appengine/internal/remote_api google.golang.org/appengine/internal/urlfetch google.golang.org/appengine/urlfetch -# google.golang.org/genproto v0.0.0-20211027162914-98a5263abeca +# google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12 google.golang.org/genproto/googleapis/api/httpbody google.golang.org/genproto/googleapis/rpc/status google.golang.org/genproto/protobuf/field_mask # google.golang.org/grpc v1.42.0 +## explicit google.golang.org/grpc google.golang.org/grpc/attributes google.golang.org/grpc/backoff @@ -613,6 +637,7 @@ gopkg.in/yaml.v3 ## explicit gotest.tools/v3/assert gotest.tools/v3/assert/cmp +gotest.tools/v3/icmd gotest.tools/v3/internal/assert gotest.tools/v3/internal/difflib gotest.tools/v3/internal/format @@ -767,6 +792,65 @@ k8s.io/client-go/discovery/cached/disk k8s.io/client-go/discovery/fake k8s.io/client-go/dynamic k8s.io/client-go/dynamic/fake +k8s.io/client-go/informers +k8s.io/client-go/informers/admissionregistration +k8s.io/client-go/informers/admissionregistration/v1 +k8s.io/client-go/informers/admissionregistration/v1beta1 +k8s.io/client-go/informers/apiserverinternal +k8s.io/client-go/informers/apiserverinternal/v1alpha1 +k8s.io/client-go/informers/apps +k8s.io/client-go/informers/apps/v1 +k8s.io/client-go/informers/apps/v1beta1 +k8s.io/client-go/informers/apps/v1beta2 +k8s.io/client-go/informers/autoscaling +k8s.io/client-go/informers/autoscaling/v1 +k8s.io/client-go/informers/autoscaling/v2beta1 +k8s.io/client-go/informers/autoscaling/v2beta2 +k8s.io/client-go/informers/batch +k8s.io/client-go/informers/batch/v1 +k8s.io/client-go/informers/batch/v1beta1 +k8s.io/client-go/informers/certificates +k8s.io/client-go/informers/certificates/v1 +k8s.io/client-go/informers/certificates/v1beta1 +k8s.io/client-go/informers/coordination +k8s.io/client-go/informers/coordination/v1 +k8s.io/client-go/informers/coordination/v1beta1 +k8s.io/client-go/informers/core +k8s.io/client-go/informers/core/v1 +k8s.io/client-go/informers/discovery +k8s.io/client-go/informers/discovery/v1 +k8s.io/client-go/informers/discovery/v1beta1 +k8s.io/client-go/informers/events +k8s.io/client-go/informers/events/v1 +k8s.io/client-go/informers/events/v1beta1 +k8s.io/client-go/informers/extensions +k8s.io/client-go/informers/extensions/v1beta1 +k8s.io/client-go/informers/flowcontrol +k8s.io/client-go/informers/flowcontrol/v1alpha1 +k8s.io/client-go/informers/flowcontrol/v1beta1 +k8s.io/client-go/informers/internalinterfaces +k8s.io/client-go/informers/networking +k8s.io/client-go/informers/networking/v1 +k8s.io/client-go/informers/networking/v1beta1 +k8s.io/client-go/informers/node +k8s.io/client-go/informers/node/v1 +k8s.io/client-go/informers/node/v1alpha1 +k8s.io/client-go/informers/node/v1beta1 +k8s.io/client-go/informers/policy +k8s.io/client-go/informers/policy/v1 +k8s.io/client-go/informers/policy/v1beta1 +k8s.io/client-go/informers/rbac +k8s.io/client-go/informers/rbac/v1 +k8s.io/client-go/informers/rbac/v1alpha1 +k8s.io/client-go/informers/rbac/v1beta1 +k8s.io/client-go/informers/scheduling +k8s.io/client-go/informers/scheduling/v1 +k8s.io/client-go/informers/scheduling/v1alpha1 +k8s.io/client-go/informers/scheduling/v1beta1 +k8s.io/client-go/informers/storage +k8s.io/client-go/informers/storage/v1 +k8s.io/client-go/informers/storage/v1alpha1 +k8s.io/client-go/informers/storage/v1beta1 k8s.io/client-go/kubernetes k8s.io/client-go/kubernetes/fake k8s.io/client-go/kubernetes/scheme @@ -856,6 +940,45 @@ k8s.io/client-go/kubernetes/typed/storage/v1alpha1 k8s.io/client-go/kubernetes/typed/storage/v1alpha1/fake k8s.io/client-go/kubernetes/typed/storage/v1beta1 k8s.io/client-go/kubernetes/typed/storage/v1beta1/fake +k8s.io/client-go/listers/admissionregistration/v1 +k8s.io/client-go/listers/admissionregistration/v1beta1 +k8s.io/client-go/listers/apiserverinternal/v1alpha1 +k8s.io/client-go/listers/apps/v1 +k8s.io/client-go/listers/apps/v1beta1 +k8s.io/client-go/listers/apps/v1beta2 +k8s.io/client-go/listers/autoscaling/v1 +k8s.io/client-go/listers/autoscaling/v2beta1 +k8s.io/client-go/listers/autoscaling/v2beta2 +k8s.io/client-go/listers/batch/v1 +k8s.io/client-go/listers/batch/v1beta1 +k8s.io/client-go/listers/certificates/v1 +k8s.io/client-go/listers/certificates/v1beta1 +k8s.io/client-go/listers/coordination/v1 +k8s.io/client-go/listers/coordination/v1beta1 +k8s.io/client-go/listers/core/v1 +k8s.io/client-go/listers/discovery/v1 +k8s.io/client-go/listers/discovery/v1beta1 +k8s.io/client-go/listers/events/v1 +k8s.io/client-go/listers/events/v1beta1 +k8s.io/client-go/listers/extensions/v1beta1 +k8s.io/client-go/listers/flowcontrol/v1alpha1 +k8s.io/client-go/listers/flowcontrol/v1beta1 +k8s.io/client-go/listers/networking/v1 +k8s.io/client-go/listers/networking/v1beta1 +k8s.io/client-go/listers/node/v1 +k8s.io/client-go/listers/node/v1alpha1 +k8s.io/client-go/listers/node/v1beta1 +k8s.io/client-go/listers/policy/v1 +k8s.io/client-go/listers/policy/v1beta1 +k8s.io/client-go/listers/rbac/v1 +k8s.io/client-go/listers/rbac/v1alpha1 +k8s.io/client-go/listers/rbac/v1beta1 +k8s.io/client-go/listers/scheduling/v1 +k8s.io/client-go/listers/scheduling/v1alpha1 +k8s.io/client-go/listers/scheduling/v1beta1 +k8s.io/client-go/listers/storage/v1 +k8s.io/client-go/listers/storage/v1alpha1 +k8s.io/client-go/listers/storage/v1beta1 k8s.io/client-go/pkg/apis/clientauthentication k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1 k8s.io/client-go/pkg/apis/clientauthentication/v1beta1 @@ -896,7 +1019,8 @@ k8s.io/client-go/util/retry k8s.io/client-go/util/workqueue # k8s.io/klog v1.0.0 k8s.io/klog -# k8s.io/klog/v2 v2.30.0 +# k8s.io/klog/v2 v2.40.1 +## explicit k8s.io/klog/v2 # k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 k8s.io/kube-openapi/pkg/util/proto @@ -921,7 +1045,7 @@ knative.dev/client/pkg/serving/v1 knative.dev/client/pkg/util knative.dev/client/pkg/util/mock knative.dev/client/pkg/wait -# knative.dev/eventing v0.27.0 +# knative.dev/eventing v0.27.2 ## explicit knative.dev/eventing/pkg/apis/config knative.dev/eventing/pkg/apis/duck @@ -954,15 +1078,20 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1/fake knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2 knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1beta2/fake -# knative.dev/hack v0.0.0-20211104075903-0f69979bbb7d +knative.dev/eventing/test/test_images/wathola-forwarder +knative.dev/eventing/test/upgrade/prober/wathola/client +knative.dev/eventing/test/upgrade/prober/wathola/config +knative.dev/eventing/test/upgrade/prober/wathola/event +knative.dev/eventing/test/upgrade/prober/wathola/forwarder +knative.dev/eventing/test/upgrade/prober/wathola/sender +# knative.dev/hack v0.0.0-20211122163517-fe1340f21191 ## explicit knative.dev/hack -# knative.dev/networking v0.0.0-20211104064801-6871f98f7b4d -## explicit +# knative.dev/networking v0.0.0-20211101215640-8c71a2708e7d knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking knative.dev/networking/pkg/apis/networking/v1alpha1 -# knative.dev/pkg v0.0.0-20211104080002-e7547eabc6ee +# knative.dev/pkg v0.0.0-20211101212339-96c0204a70dc ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -971,6 +1100,7 @@ knative.dev/pkg/apis/duck/v1 knative.dev/pkg/apis/duck/v1beta1 knative.dev/pkg/changeset knative.dev/pkg/client/injection/ducks/duck/v1/addressable +knative.dev/pkg/client/injection/kube/client knative.dev/pkg/configmap knative.dev/pkg/controller knative.dev/pkg/environment @@ -998,11 +1128,34 @@ knative.dev/pkg/test/logging knative.dev/pkg/test/monitoring knative.dev/pkg/test/spoof knative.dev/pkg/test/zipkin +knative.dev/pkg/tracing knative.dev/pkg/tracing/config knative.dev/pkg/tracing/propagation knative.dev/pkg/tracing/propagation/tracecontextb3 knative.dev/pkg/tracker -# knative.dev/serving v0.27.0 +# knative.dev/reconciler-test v0.0.0-20211101214439-9839937c9b13 +## explicit +knative.dev/reconciler-test/cmd/eventshub +knative.dev/reconciler-test/pkg/environment +knative.dev/reconciler-test/pkg/eventshub +knative.dev/reconciler-test/pkg/eventshub/assert +knative.dev/reconciler-test/pkg/eventshub/dropevents +knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfibonacci +knative.dev/reconciler-test/pkg/eventshub/dropevents/dropeventsfirst +knative.dev/reconciler-test/pkg/eventshub/logger_vent +knative.dev/reconciler-test/pkg/eventshub/rbac +knative.dev/reconciler-test/pkg/eventshub/receiver +knative.dev/reconciler-test/pkg/eventshub/recorder_vent +knative.dev/reconciler-test/pkg/eventshub/sender +knative.dev/reconciler-test/pkg/feature +knative.dev/reconciler-test/pkg/images +knative.dev/reconciler-test/pkg/k8s +knative.dev/reconciler-test/pkg/knative +knative.dev/reconciler-test/pkg/manifest +knative.dev/reconciler-test/pkg/milestone +knative.dev/reconciler-test/pkg/state +knative.dev/reconciler-test/resources/svc +# knative.dev/serving v0.27.1 ## explicit knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1